API reference

A small REST API over HTTPS. Every response uses one envelope. Money is always a decimal string such as "10.50" — never a JSON number, because 10.50 parses back as 10.5. The number of decimal places follows the currency, so read the currency field before you assume two.

Get started

1

Authentication

Send x-api-key and x-api-secret on every request. The secret is shown once, stored hashed, and revocable with the credential.

-H "x-api-key: $KEY" \
-H "x-api-secret: $SECRET"
2

Scopes

A key carries scopes; a call without the scope it needs returns FORBIDDEN.

catalog:read
purchase
orders:read
3

Idempotency

Send an x-idempotency-key header (8-128 chars) on POST /b2b/orders. A retry with the same key replays the first result — the order is never placed twice. Idempotency keys belong to your account, not to the key pair, so regenerating your API credentials does not reset them. Also pass your own externalRef to look an order up later by your reference.

Endpoints

GET/b2b/catalog
Scope: catalog:read

List products with your-tier prices and availability.

Example request

curl https://kascards.com/api/v1/b2b/catalog?perPage=100 \
  -H "x-api-key: $KEY" \
  -H "x-api-secret: $SECRET"

Example response

{
  "ok": true,
  "code": "OK",
  "data": [{
    "id": "019f56a9-…", "slug": "steam-5-us",
    "name": { "en": "Steam $5 — United States" }, "denomination": "$5",
    "type": "code", "listPrice": "5.45", "yourPrice": "5.01",
    "currency": "USD", "available": true, "customFields": [], "maxPerOrder": 20
  }],
  "meta": { "page": 1, "perPage": 100, "total": 38, "hasMore": false }
}
POST/b2b/orders
Scope: purchase

Place an order (idempotent, wallet-paid).

Example request

curl -X POST https://kascards.com/api/v1/b2b/orders \
  -H "x-api-key: $KEY" \
  -H "x-api-secret: $SECRET" \
  -H "x-idempotency-key: po-2026-07-12-0001" \
  -H "content-type: application/json" \
  -d '{
    "externalRef": "po-2026-07-12-0001",
    "items": [{ "productId": "019f56a9-…", "quantity": 2 }]
  }'

Example response

{ "ok": true, "code": "OK", "data": {
  "orderId": "019f5728-…", "number": "KC-MRI0BS8W-026F",
  "status": "paid", "total": "10.02", "currency": "USD", "pointsUsed": "0"
} }
GET/b2b/orders
Scope: orders:read

List your orders, newest first.

Example request

curl https://kascards.com/api/v1/b2b/orders \
  -H "x-api-key: $KEY" \
  -H "x-api-secret: $SECRET"

Example response

{ "ok": true, "code": "OK", "data": [{
  "id": "019f5728-…", "orderId": "019f5728-…", "number": "KC-MRI0BS8W-026F",
  "status": "delivered", "total": "10.02", "currency": "USD", "placedAt": "2026-07-12T10:15:00.000Z"
}], "meta": { "page": 1, "perPage": 25, "total": 1, "hasMore": false } }
GET/b2b/orders/{orderId}
Scope: orders:read

Read one order. Its code and pin are filled only when the key also carries the purchase scope.

Example request

curl https://kascards.com/api/v1/b2b/orders/019f5728-… \
  -H "x-api-key: $KEY" \
  -H "x-api-secret: $SECRET"

Example response

{ "ok": true, "code": "OK", "data": {
  "orderId": "019f5728-…", "number": "KC-MRI0BS8W-026F", "status": "delivered",
  "externalRef": "po-2026-07-12-0001", "total": "10.02", "currency": "USD",
  "placedAt": "2026-07-12T10:15:00.000Z",
  "lines": [{
    "id": "…", "product": { "slug": "steam-5-us" }, "quantity": 2,
    "unitPrice": "5.01", "lineTotal": "10.02", "status": "delivered",
    "units": [{
      "id": "…", "unitIndex": 0, "status": "delivered", "code": "XXXX-YYYY-ZZZZ",
      "pin": null, "serial": null, "expiresAt": null, "failReason": null
    }]
  }]
} }
GET/b2b/orders/by-ref/{externalRef}
Scope: orders:read

Read an order by your own externalRef. It answers exactly as the call above does.

Example request

curl https://kascards.com/api/v1/b2b/orders/by-ref/po-2026-07-12-0001 \
  -H "x-api-key: $KEY" \
  -H "x-api-secret: $SECRET"
GET/b2b/wallet
Scope: catalog:read

Read your wallet balance.

Example request

curl https://kascards.com/api/v1/b2b/wallet \
  -H "x-api-key: $KEY" \
  -H "x-api-secret: $SECRET"

Example response

{ "ok": true, "code": "OK", "data": { "cash": "489.98", "currency": "USD" } }

Errors

Failures use the same envelope with ok:false, a stable code, a message and meta.requestId. A refusal with facts adds details, and VALIDATION_FAILED adds errors and rules. Worth handling:

{
  "ok": false,
  "code": "VALIDATION_FAILED",
  "message": "Request validation failed",
  "errors": { "items.0.quantity": "Too big: expected number to be <=500" },
  "rules": { "items.0.quantity": { "rule": "tooBig", "max": 500 } },
  "meta": { "requestId": "…" }
}

VALIDATION_FAILED

The request is wrong: errors names each field and rules says why

UNAUTHORIZED

Missing, invalid, or revoked API credentials

FORBIDDEN

Credential lacks the scope for this call

NOT_FOUND

No such order on your account, or a product in your order is no longer available

DISTRIBUTOR_API_INACTIVE

API access is not activated, or was suspended

DISTRIBUTOR_SUSPENDED

The distributor account is suspended

USER_FROZEN

The store froze this account: no new orders, but reads still answer

IP_NOT_ALLOWED

Your allowlist is on and this address is not on it

CONFLICT

This externalRef is already used, or your company holds orders for approval

IDEMPOTENCY_KEY_REQUIRED

Money-moving POST without x-idempotency-key

IDEMPOTENCY_KEY_REUSED

Same key, different body

IDEMPOTENCY_IN_PROGRESS

Your first call is still running — retry the same key, do not give up

PRICE_CHANGED

You sent expectedTotal and our total differs. No order exists. details.total has our number

INSUFFICIENT_FUNDS

Wallet balance below the order total

OUT_OF_STOCK

Not enough units available right now

LIMIT_EXCEEDED

A line asked for more than the product's per-order limit, or its per-user daily cap

RATE_LIMITED

Wait the seconds in the Retry-After header, then retry (reuse the same idempotency key)

PROVIDER_UNAVAILABLE

No supplier confirmed the current price. No order exists. Retry later

MAINTENANCE

The store is closed for maintenance. No order exists. Retry later

Base URL

https://kascards.com/api/v1

Limits

Catalog page size

Up to 200

Quantity per product

Up to 50, unless the product sets its own

Products per order

One — a second product is a second order

Request rate

120 per minute per key

Idempotency key

8–128 characters

Live credentials

One per account