Affilibee
Toggle sidebar

Create order

API reference for sending completed orders from your platform into Affilibee for attribution and commission processing.

Endpoint

POST
/api/v2/orders/create

Authorization

Learn more
Authorization
string
header
required

The Bearer token generated in the Affilibee dashboard.

Body

application/json

affiliate_slug
string
required

The affiliate slug for the order. Validation: must exist, belong to the authenticated merchant, and be active.

order_no
string
required

Your unique order reference. Validation: must be unique and cannot exceed 255 characters.

total_shipping_value
numeric
required

Total shipping amount for the order. Validation: must be 0 or greater.

currency_code
string
required

Currency code for the order, such as USD or EUR. Validation: must exist in Affilibee and match the merchant account currency.

customer
object

Customer details to associate with the order. If you send this object, include the customer email.

name
string

Customer name. Validation: maximum 255 characters.

email
string

Customer email address. Validation: must be a valid email address and cannot exceed 255 characters. When the customer object is sent, this field should be included so Affilibee can look up or create the customer record.

order_rows
array
required

Line items included in the order. Validation: at least one order row is required; orders without order rows are rejected. Each row is validated independently.

product_sku
string

SKU for the product. Validation: maximum 255 characters.

product_name
string
required

Product name. Validation: maximum 255 characters.

segment_slug
string

Product segment slug. Validation: maximum 255 characters. If omitted, or if it does not match any of your segments, Affilibee falls back to the merchant's default segment.

price_value
numeric
required

Line-item price amount. Validation: must be 0 or greater.

tax_value
numeric

Tax amount for the line item. Validation: must be 0 or greater.

quantity
numeric
required

Quantity for the line item. Validation: must be greater than 0.

Example requests

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 '{
  "affiliate_slug": "affiliate123",
  "order_no": "ORDER-001",
  "total_shipping_value": 1500,
  "currency_code": "USD",
  "order_rows": [
    {
      "product_sku": "SKU123",
      "product_name": "Product Name A",
      "segment_slug": "segment-001",
      "price_value": 10000,
      "tax_value": 500,
      "quantity": 2
    }
  ],
  "customer": {
    "name": "John Doe",
    "email": "john.doe@example.com"
  }
}'
const token = "YOUR_ACCESS_TOKEN";
const url = "https://affilibee.com/api/v2/orders/create";

const payload = {
  affiliate_slug: "affiliate123",
  order_no: "ORDER-001",
  total_shipping_value: 1500,
  currency_code: "USD",
  order_rows: [
    {
      product_sku: "SKU123",
      product_name: "Product Name A",
      segment_slug: "segment-001",
      price_value: 10000,
      tax_value: 500,
      quantity: 2
    }
  ],
  customer: {
    name: "John Doe",
    email: "john.doe@example.com"
  }
};

fetch(url, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${token}`,
    "Content-Type": "application/json",
    "Accept": "application/json"
  },
  body: JSON.stringify(payload)
})
  .then(response => response.json())
  .then(data => console.log("Success:", data))
  .catch(error => console.error("Error:", error));
import requests

token = "YOUR_ACCESS_TOKEN"
url = "https://affilibee.com/api/v2/orders/create"

payload = {
  "affiliate_slug": "affiliate123",
  "order_no": "ORDER-001",
  "total_shipping_value": 1500,
  "currency_code": "USD",
  "order_rows": [
    {
      "product_sku": "SKU123",
      "product_name": "Product Name A",
      "segment_slug": "segment-001",
      "price_value": 10000,
      "tax_value": 500,
      "quantity": 2,
    }
  ],
  "customer": {
    "name": "John Doe",
    "email": "john.doe@example.com",
  },
}

response = requests.post(
  url,
  headers={
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  json=payload,
)

print(response.json())
<?php

require 'vendor/autoload.php';

use GuzzleHttp\Client;

$token = 'YOUR_ACCESS_TOKEN';

$client = new Client([
    'base_uri' => 'https://affilibee.com/api/v2',
    'headers' => [
        'Authorization' => "Bearer $token",
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
    ],
]);

$payload = [
    'affiliate_slug' => 'affiliate123',
    'order_no' => 'ORDER-001',
    'total_shipping_value' => 1500,
    'currency_code' => 'USD',
    'order_rows' => [
        [
            'product_sku' => 'SKU123',
            'product_name' => 'Product Name A',
            'segment_slug' => 'segment-001',
            'price_value' => 10000,
            'tax_value' => 500,
            'quantity' => 2,
        ],
    ],
    'customer' => [
        'name' => 'John Doe',
        'email' => 'john.doe@example.com',
    ],
];

$response = $client->post('orders/create', [
    'body' => json_encode($payload),
]);

echo $response->getBody();
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        using var client = new HttpClient();
        var url = "https://affilibee.com/api/v2/orders/create";
        var token = "YOUR_ACCESS_TOKEN";

        var payload = new
        {
            affiliate_slug = "affiliate123",
            order_no = "ORDER-001",
            total_shipping_value = 1500,
            currency_code = "USD",
            order_rows = new[]
            {
                new {
                    product_sku = "SKU123",
                    product_name = "Product Name A",
                    segment_slug = "segment-001",
                    price_value = 10000,
                    tax_value = 500,
                    quantity = 2
                }
            },
            customer = new {
                name = "John Doe",
                email = "john.doe@example.com"
            }
        };

        var json = System.Text.Json.JsonSerializer.Serialize(payload);
        var content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");

        client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", $"Bearer {token}");
        client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

        var response = await client.PostAsync(url, content);
        var responseString = await response.Content.ReadAsStringAsync();

        Console.WriteLine(responseString);
    }
}

Responses

application/json

201
Created

Returned when the order is accepted for commission processing.

401
Unauthorized

Returned when the request does not include a valid Bearer token. See the Authentication page for the required token format.

403
Forbidden

Returned when a testing token is used on the live API, or a live token on the sandbox API.

422
Unprocessable Content

Returned when the request body fails validation.

Response examples

{
    "success": true,
    "data": {
        "order": {
            "uuid": "9c8b7f6a-5d4e-3c2b-1a0z-9y8x7w6v5u4t",
            "order_no": "54321"
        }
    },
    "errors": null,
    "meta": {
        "trace_id": "20260321:api:abc12"
    }
}
{
    "success": false,
    "data": null,
    "errors": {
        "message": [
            "Unauthenticated."
        ]
    },
    "meta": {
        "trace_id": "20260321:api:abc12"
    }
}
{
    "success": false,
    "data": null,
    "errors": {
        "message": [
            "This token cannot be used on the live API. Use a live token."
        ]
    },
    "meta": {
        "trace_id": "20260321:api:abc12"
    }
}
{
    "success": false,
    "data": null,
    "errors": {
        "order_no": [
            "The order no field is required."
        ],
        "affiliate_slug": [
            "The affiliate slug field is required."
        ]
    },
    "meta": {
        "trace_id": "20260321:api:abc12"
    }
}

Notes

  • Send monetary values in the smallest currency unit, such as cents for USD.

  • If your platform sells in multiple currencies, convert values before submission and make sure they match the currency registered for the merchant account.

  • Submit the order only after your platform has captured the affiliate slug, stored the attribution, and determined that the order is valid to report.

Got questions? We're here for you.

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