Affilibee
Toggle sidebar

Blog

Product updates, development progress, and practical guides for running an API-first affiliate program with Affilibee.

API v2: what's new and how to upgrade

· Edward Karlsson

When we started Affilibee, the API had one job: let your platform tell us that an order happened. That single endpoint was enough to prove the idea of a headless affiliate system, where your backend reports purchases and no tracking script ever touches your storefront.

But reporting orders is only half of running an affiliate program. From the start, our goal has been that merchants can run the whole program from their own systems: affiliates signing up on your own site, and commissions showing up in your own back office, instead of everyone being sent to a separate platform. API v2 is the biggest step so far in that direction.

From one endpoint to seventeen

Version 1 had a single endpoint for creating orders, plus a separate endpoint for test orders. Version 2 has 17 endpoints, grouped around the parts of a program you actually work with:

  • Orders. Create orders as before, and now also list them, fetch a single order, update its shipping value, and cancel it. A cancelled order's commission drops to zero. Orders that are already part of a payout, or more than a month old, can't be cancelled.
  • Affiliates. List your affiliates (optionally filtered by tier), fetch a single affiliate, invite new affiliates by email, and look up the invitations you've sent.
  • Affiliate requests. List the people who have applied to your program, filtered by status, and accept or decline them, with an optional message. You can build the approval step into your own back office instead of logging in to ours.
  • Tiers and segments. Read your commission tiers and product segments, so your own systems can show which rates apply to whom.

Every endpoint is documented in the API reference, with example requests in several languages and example responses for both success and errors.

Responses you can rely on

In v1, the shape of a response depended a little on what happened. Successful requests returned a message and some data, and validation errors were tucked inside data.errors.

In v2, every response from every endpoint follows the same envelope:

{
  "success": true,
  "data": {
    "order": {
      "uuid": "9c8b7f6a-5d4e-3c2b-1a0f-9e8d7c6b5a4f",
      "order_no": "ORDER-1001"
    }
  },
  "errors": null,
  "meta": {
    "trace_id": "20260321:api:abc12"
  }
}

success tells you whether the request worked, data holds the result, and errors holds validation messages when something is wrong. Your integration can parse every response with the same few lines of code.

The meta.trace_id is the small detail we're most pleased with. Every request gets its own trace ID. If something looks off, send us that ID and we can find the exact request, what you sent, and what we answered, without a back-and-forth about timestamps.

Test without touching real data

In v1, testing meant calling a separate test endpoint. In v2, every endpoint has a sandbox twin under /api/v2/sandbox/, backed by its own isolated data.

When you create an API token under Settings → API Tokens, you choose whether it's a live token or a testing token. Testing tokens only work against the sandbox, and live tokens only work against the live API. Use a token against the wrong environment and the request is rejected with 403 Forbidden before anything is read or changed. An integration under development simply cannot create a real order or affect a real commission by mistake.

Read more in Authentication and Testing your integration.

Try it in five minutes

To get from reading to sending requests quickly, we publish ready-made Postman collections for both sandbox and live. Every request comes pre-filled with working example values. Add your testing token and you can create an order, fetch it, update it, and cancel it without writing any code.

What stays the same

Upgrading doesn't mean rewriting your integration:

  • Authentication still uses a Bearer token in the Authorization header.
  • Rate limits are still 60 requests per minute per merchant.
  • Creating orders takes exactly the same payload as in v1: affiliate slug, order number, currency, order rows, and customer, with amounts in the smallest currency unit, such as cents.

Upgrading from v1 in four steps

  1. Switch the path. Every v2 endpoint lives under /api/v2/, so /api/orders/create becomes /api/v2/orders/create.
  2. Read the new envelope. Check success, read results from data, and read validation messages from errors instead of data.errors.
  3. Log the trace ID. Store meta.trace_id alongside your own order, so support questions can point at the exact request.
  4. Move testing to the sandbox. Create a testing token and point your test environment at /api/v2/sandbox/ instead of the v1 test endpoint.

In practice, the request barely changes:

# v1
curl -X POST https://affilibee.com/api/orders/create \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d @order.json

# v2
curl -X POST https://affilibee.com/api/v2/orders/create \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d @order.json

Reading the response is where the envelope pays off:

const response = await fetch('https://affilibee.com/api/v2/orders/create', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AFFILIBEE_TOKEN}`,
    'Content-Type': 'application/json',
    Accept: 'application/json',
  },
  body: JSON.stringify(order),
});

const { success, data, errors, meta } = await response.json();

if (!success) {
  console.error('Affilibee rejected the order', errors, meta.trace_id);
} else {
  saveAffilibeeReference(order.order_no, data.order.uuid, meta.trace_id);
}

The upgrade guide has the full details.

What happens to v1

Nothing, for now. Version 1 keeps working exactly as it does today for at least another year, and we won't switch it off until everyone has had the chance to migrate. If you're still on v1, there's no rush, but new integrations should start on v2, and every new endpoint will only be added there.

Behind the scenes

I built most of the v2 API, while Johan set up the documentation pages that every endpoint is described on: the reference layout, the request and response examples, and the navigation you use to find your way around. Building the endpoints and the docs side by side meant nothing shipped without documentation, and writing the docs often showed us where an endpoint could be simpler.

What's next

API v2 isn't finished. Our aim is that everything you can do in the Affilibee dashboard, you can also do through the API, so you can build the affiliate experience into your own site and back office. That means more endpoints to complete the picture. Webhooks are also high on our wish list, so your systems can hear about new orders, affiliate requests, and commission changes the moment they happen, instead of asking for them. We're not making promises about dates yet, but that's the direction.

If you're integrating and something is missing from the API, tell us. It directly shapes what we build next.

— Edward

From Café Orion to launch: the story behind Affilibee

· Edward Karlsson

From Café Orion to launch: the story behind Affilibee

Affilibee is live. Before this blog fills up with feature announcements and development updates, I want to tell you how it came to be. It started long before the first line of code, with two colleagues, one very busy project, and a cup of coffee in Borås.

Two colleagues, one big transition

A few years ago, Johan and I worked at the same company, as part of a larger team. I was one of the developers and Johan was a project manager. The company was in the middle of moving to a new ERP system, which meant integrations and workflows across the business had to be rethought and rebuilt, often while the old ones were still running. At the same time, the team was building a new multi-brand platform for selling wallpaper, with a headless CMS at its core.

A project like that shows you very quickly who you work well with. Johan and I kept ending up on the same pieces of work, with him keeping the plan together and making sure things were built in the right order, while I spent my days deep in the code. We complemented each other well, and together with the rest of the team we got the platform out the door.

The search that came up empty

Somewhere in the middle of building that platform, I went looking for an affiliate system. I assumed it would take an afternoon.

It didn't. Every option I found fell into at least one of these traps:

  • Bloated. Dashboards packed with modules, reports, and settings we would never touch, but would still pay for.
  • Expensive. Pricing built for large enterprises, with a monthly bill that was hard to justify for a growing business.
  • Heavy on the storefront. Most tools wanted a large JavaScript snippet on every page to track visitors and conversions. We had worked hard to keep the platform fast, and adding someone else's script felt like a step backwards.
  • Confusing. Interfaces so crowded that simple tasks, like inviting a partner or checking a commission, took far too many clicks.

There was also the experience for the affiliates themselves. We didn't want them to feel like they were being sent off to a big, separate system run by a third company. They should sign up on our own site and follow their commissions there too, so the whole program felt like part of our brand. And behind the scenes, the system should take care of paying the affiliates for us.

What I actually wanted was something small and focused: a headless affiliate system with a good API, where our own platform stays in charge and simply reports when a purchase has happened. I couldn't find one. It looked like a real gap in the market and, more personally, like a tool I would love to work with myself.

A coffee at Café Orion

A few months after the platform launched, I was headhunted by a Swedish software development company that works with big fashion brands. It was a great opportunity, but it also meant no longer working with Johan every day, and that was genuinely sad.

We are good friends, though, so we didn't let it end there. We met up at Café Orion in Borås, and over coffee the conversation turned into a question: what if we built something together, on the side, that we would own ourselves?

I told Johan about the affiliate system I couldn't find. He saw the same gap, and by the time we left the café, we had decided to build it.

Why a bee?

The name comes from how affiliate marketing actually works. It is never one person doing everything. Think of a merchant as the hive and the affiliates as the bees: many individuals flying out in different directions, each bringing something back. For bees, that is honey. For an affiliate program, it is sales, and the commission is the honey everyone gets a share of.

Many people working together, each contributing a little, adding up to something much bigger. That is Affilibee. Our codebase is even named apis-mellifera, Latin for the western honey bee.

What we set out to build

From the start we agreed on a few principles, and they still guide every decision we make:

  1. Simple to use. Stay with the core: affiliates, commissions, orders, and payouts. If a feature doesn't clearly help a merchant run their program, it doesn't go in.
  2. Fairly priced. Leaving out the features nobody uses means nobody pays for them either. Affilibee should be an affordable choice, not an enterprise contract.
  3. Headless, with an API that is actually useful. Affilibee doesn't need to own your storefront. Your platform captures the affiliate link, keeps it through checkout, and reports the completed order to our API. How Affilibee works walks through the whole flow.
  4. Nothing extra on your pages. No third-party tracking script slowing down your storefront. Purchases are reported from your backend, where you stay in control of what is sent and when.

From planner to pair programmer

The first commit landed on 28 December 2022, in the quiet days between Christmas and New Year, and by the end of that day there was already a dashboard.

In the beginning, our roles looked familiar: I wrote the code, and Johan planned and managed the project. That didn't last long. Johan wanted to learn programming himself, and soon we were working as a pair, with Johan on the frontend and me tinkering away in the backend. He took to it so well that, looking at the commit history today, he has made about twice as many commits as I have. I have decided to be proud of that rather than competitive ;)

Building at side-project speed

When you build something on the side, you build it around your life, and life happened. There were stretches where the project moved fast and long stretches where almost nothing happened. Johan became a father and bought a house. I needed time away to take care of family matters.

But the idea never went away. We kept coming back to it, with a big push in the autumn of 2024 and more waves through 2025 and into this year. Every time we picked it up again, the core idea was still exactly what we wanted to build.

We're live

And here we are. Affilibee is launched, it is live, and we are loving it. It is the affiliate system I was looking for back then: lightweight, headless, and focused on the things that matter.

If you are a merchant or a developer, the best place to start is Getting started or the API introduction. You can connect your platform and test everything against the sandbox with a testing token before a single real order goes through. See Authentication and Testing your integration for how.

This blog is where we will share what we build next, how things work under the hood, and what we learn along the way. Thanks for reading, and if you have questions or ideas, we would love to hear from you.

— Edward & Johan

We help teams run affiliate programs through API-first integrations that fit the platform they already use.

© 2025 Affilibee Handelsbolag (969802-2481)

Integrations

API Integration
How can we assist you today?

Fill in the form below and we'll get back to you as soon as possible.

Name
Email
Message