Skip to content
B2B GroupPartner API

Getting started

From a sandbox client to your first code and redemption in five steps.

  1. 1Get a sandbox client
  2. 2Get a token
  3. 3Issue a code
  4. 4Simulate a redemption
  5. 5Look the code up

The B2B Group Partner API lets your own systems issue gift codes to your members, import codes you already have, look codes up, deactivate them, and receive webhooks when a member redeems a code and when the order ships. You keep the link between a member and a code in your own system, and you never send us personal data about your members. When a member redeems a code, we store what the member types to receive the gift - name, delivery address, email and phone - to ship the order, and we send it to you in code.redeemed.

This guide takes you through the whole flow in the sandbox: a client, a token, a code, a redemption and a lookup.

1. Environments

EnvironmentBase URLUsed for
Sandboxhttps://api-sandbox.b2bgroup.dkBuilding and testing. Codes can only be redeemed in a sandbox shop and are removed by the automatic cleanup at 03:00 Danish time.
Productionhttps://api.b2bgroup.dkReal codes and real orders.

A client (a client id and secret) belongs to exactly one environment and only works on that host. Start in the sandbox. Production is enabled for your account by B2B Group when you are ready.

2. Get a client

Your contact at B2B Group invites you to the developer portal at https://developer.b2bgroup.dk. You sign in with a link sent to your email - there is no password. In the portal you create a sandbox client, choose its scopes and copy the client secret. The secret is shown once. Store it in your secret manager, not in source code.

Scopes decide what a client may do:

ScopeAllows
codes:issuePOST /v1/codes/issue, POST /v1/codes/issue-batch
codes:readGET /v1/codes/{code}, GET /v1/codes/{code}/status, GET /v1/codes
codes:managePOST /v1/codes/import, POST /v1/codes/{code}/deactivate, the sandbox simulation routes
webhooks:manageEverything under /v1/webhook-endpoints

3. Get a token

curl -s https://api-sandbox.b2bgroup.dk/v1/oauth/token \
  -d grant_type=client_credentials \
  -d client_id="$CLIENT_ID" \
  -d client_secret="$CLIENT_SECRET"
{
  "accessToken": "eyJhbGciOi...",
  "tokenType": "Bearer",
  "expiresIn": 3600,
  "scope": "codes:issue codes:read codes:manage webhooks:manage",
  "environment": "sandbox"
}

Send the token as Authorization: Bearer <accessToken> on every other call. Reuse it until it is about to expire; see Authentication for examples in C#, Node and Python.

4. Issue a code

curl -s https://api-sandbox.b2bgroup.dk/v1/codes/issue \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "campaign": "welcome-2027", "externalMemberRef": "M-482913" }'
{
  "code": "ABC-7K3Q-M8ZP",
  "expiresAt": "2029-10-01T00:00:00Z",
  "valid": true,
  "status": "active",
  "campaign": "welcome-2027",
  "externalMemberRef": "M-482913",
  "issuedAt": "2026-10-01T08:00:00Z",
  "version": 1,
  "failedAttempts": 0,
  "tier": 1
}

externalMemberRef is your own reference - a member number or any opaque id. Send the code to your member yourself. The expiry is set from the validity agreed for the campaign or your account; add "expiresAt": "2027-12-31T23:59:59Z" (UTC, in the future) to the request when you calculate it yourself. The code gets tier 1 unless you send "tier" with a whole number from 1 to 100; the tier decides which gifts the code can be used for. See Codes.

5. Simulate a redemption

In production a member redeems the code in the shop. In the sandbox you do it with one call:

curl -s https://api-sandbox.b2bgroup.dk/v1/sandbox/codes/ABC-7K3Q-M8ZP/redeem \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "selection": [ { "sku": "BBP-1234", "quantity": 1 } ],
        "delivery": { "name": "Test Member", "address": "Test Street 1", "zip": "6760", "city": "Ribe" } }'

The answer is the code's full picture with status used and a redemption that holds the order id. See Sandbox for the SKUs you can use and how to ship the order.

6. Look the code up

curl -s https://api-sandbox.b2bgroup.dk/v1/codes/ABC-7K3Q-M8ZP -H "Authorization: Bearer $TOKEN"

7. Receive webhooks

Register an https endpoint with POST /v1/webhook-endpoints and you receive code.redeemed, code.shipped and code.deactivated as they happen. See Webhooks.

Next steps

  • Codes - issue, import, list for a daily pull, deactivate.
  • Errors - the error shape and every error code.
  • Versioning - how the dated contract version works.
  • IP allowlist - lock a client to your servers' addresses.
  • Client certificates (mTLS) - lock a client to the certificates your servers present.

Every response carries X-Request-Id. Include it when you contact us about a specific call.