Developers

RoamSIM Reseller API

Sell travel eSIMs from your own website or app. Browse the catalogue at your reseller price, place an order from your prepaid wallet, and receive the eSIM's activation code to deliver under your own brand.

Base URL: https://roam-sim.com/api/v1

Become a reseller

Travel agencies, telecom shops, apps and websites can sell RoamSIM eSIMs under their own brand. You get a prepaid wallet, a dashboard to sell by hand, and this API to sell automatically.

  1. Create a free RoamSIM account, or sign in.
  2. Send the short application form. Add €10 to your wallet and your reseller account is activated instantly (the deposit is your balance, not a fee); otherwise we review it by hand within a business day.
  3. Top up your wallet, create your API key in the dashboard, and start selling.

Quick start

  1. Apply for a reseller account at roam-sim.com/become-a-reseller. A €10 wallet deposit activates it instantly; without one we approve it by hand.
  2. Top up your wallet from the reseller dashboard. Every order is paid from this balance, in EUR.
  3. Open Dashboard → API and create your API key. It is shown once — store it somewhere safe.
  4. List packages with GET /catalog/packages?country=TH and pick a package `id`.
  5. Develop against test mode first: create a test key (`rsk_test_…`) on the same page. It uses the real catalogue but charges nothing and returns a fake eSIM. See Test mode below.
  6. Place the order with POST /orders, sending a unique Idempotency-Key header.
  7. If the order's status is `processing`, poll GET /orders/{orderId} every 5–10 seconds until it is `completed`, then deliver `esim.activationCode` to your customer. Or skip the polling and let us call you: set a webhook (see Webhooks) and wait for `order.completed`.

Already a reseller? Create your API key. Not yet? Apply here.

Authentication

Send your key on every request, in either header:

X-Api-Key: rsk_live_your_key
# or
Authorization: Bearer rsk_live_your_key

# test mode: the same, with your rsk_test_… key
  • Treat the key like a password: anyone who has it can spend your wallet balance. Call the API from your server, never from a browser or a mobile app.
  • You have one live key (`rsk_live_…`) and one test key (`rsk_test_…`). Creating a new key of one kind revokes the old key of that kind immediately and leaves the other alone.
  • A live key spends your wallet and buys real eSIMs. A test key never does — see Test mode.
  • All requests must use HTTPS. All request and response bodies are JSON.

Responses, errors and limits

Every response is JSON in one of two shapes.

{
  "status": "success",
  "data": { ... }
}
{
  "status": "error",
  "code": "insufficient_balance",
  "message": "Your wallet balance does not cover this order. Top up and retry.",
  "data": { "required": 8.14, "balance": 2.5, "currency": "EUR" }
}
  • Branch on the HTTP status and the `code` field. `message` is for humans and may change.
  • Prices are in EUR, with two decimals. `price` is what your wallet is charged; `retailPrice` is our public price, for reference.
  • Your prices already include your discount: the higher of the discount agreed with us and the volume tier you have reached (see GET /account). The dashboard sell page and catalogue show the same prices. A price never goes below our minimum.
  • Rate limits per API key: 120 requests per minute for reads, 30 orders per minute. POST /orders/bulk counts one order per eSIM: it is accepted while that minute's order budget is not yet spent, and then uses the rest of it up. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds). Over the limit you get HTTP 429 with a Retry-After header.
  • Timestamps are ISO 8601 in UTC.

Wallet balance

GET/balance

Your prepaid wallet balance. Check it before ordering, or after an `insufficient_balance` error.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/balance

Response

{
  "status": "success",
  "data": { "balance": 142.5, "currency": "EUR", "testMode": false }
}
  • With a test key this returns a fixed pretend balance of 1000.00 and `testMode: true`. Test orders never change it.

Account and discount

GET/account

Who you are and where you stand on volume pricing: your wallet, the discount applied to every price, what you spent in the last 30 days, and the next tier.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/account

Response

{
  "status": "success",
  "data": {
    "company": "Acme Travel",
    "balance": 142.5,
    "currency": "EUR",
    "discountPct": 5,
    "monthlySpend": 312.4,
    "nextTier": { "minMonthlySpend": 500, "discountPct": 8 },
    "testMode": false
  }
}
  • `discountPct` is your effective discount: the higher of the discount we agreed with you and the highest volume tier you qualify for. `price` in /catalog/packages and every order already uses it.
  • Volume tiers: we publish a ladder of monthly spend levels, each with a discount off retail. `monthlySpend` is what your orders cost you over the trailing 30 days (EUR). Test-mode and refunded orders do not count. It is refreshed every few minutes, so a new tier can take a few minutes to apply after the order that earns it.
  • `nextTier` is the nearest higher spend level that would give you a bigger discount, or null if there is none. Spend `nextTier.minMonthlySpend - monthlySpend` more within 30 days to reach it.
  • With a test key `discountPct`, `monthlySpend` and `nextTier` are your real ones (test prices match live prices), but `balance` is the fixed pretend 1000.00 and `testMode` is true.

List countries

GET/catalog/countries

Every country that has at least one plan on sale.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/catalog/countries

Response

{
  "status": "success",
  "data": {
    "countries": [
      { "code": "TH", "name": "Thailand", "packageCount": 31 },
      { "code": "TR", "name": "Turkey", "packageCount": 30 }
    ]
  }
}

List packages

GET/catalog/packages

Plans on sale, priced for your account. Filter by country, or ask for multi-country (`region`) and worldwide (`global`) plans.

Query parameters

countrystringTwo-letter ISO country code, e.g. TH. Returns that country's own plans.
scopestring`country`, `region` or `global`. Omit for all.
pageintegerPage number, from 1. Default 1.
limitintegerResults per page, 1–200. Default 20.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  "https://roam-sim.com/api/v1/catalog/packages?country=TH&limit=50"

Response

{
  "status": "success",
  "data": {
    "packages": [
      {
        "id": "sb-th-1761903227118737-30",
        "name": "10GB eSIM Data for 30 Days for Thailand",
        "type": "DATA-ONLY",
        "scope": "country",
        "country": "Thailand",
        "countryCode": "TH",
        "region": null,
        "data": { "unlimited": false, "amountMb": 10240, "label": "10 GB", "fairUse": null },
        "voiceMinutes": 0,
        "sms": 0,
        "validityDays": 30,
        "price": 9.97,
        "retailPrice": 11.08,
        "currency": "EUR",
        "network": "4G,5G",
        "fiveG": true,
        "hotspot": true,
        "topUp": false,
        "activationNote": null,
        "notes": "After 10 GB the connection continues at 384kbps.",
        "coverageCount": 6
      }
    ],
    "pagination": { "page": 1, "limit": 50, "total": 31, "totalPages": 1 }
  }
}
  • Package ids are stable strings but a plan can be withdrawn or repriced when our catalogue refreshes (daily). Refresh your copy at least once a day and always handle `package_not_found`.
  • `data.fairUse` is set on "unlimited" plans that slow down after a daily allowance: `fullSpeedPerDay` (e.g. "1GB") and `thenSpeed` (e.g. "384kbps"). Show this to your customer.
  • `topUp: false` means the eSIM cannot take a second plan later; the customer buys a new eSIM instead.
  • The price you are charged is the `price` at the moment you place the order.

Get one package

GET/catalog/packages/{id}

One plan with its full coverage list: every country it works in and the networks it uses there.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/catalog/packages/sb-th-1761903227118737-30

Response

{
  "status": "success",
  "data": {
    "package": {
      "id": "sb-th-1761903227118737-30",
      "name": "10GB eSIM Data for 30 Days for Thailand",
      "price": 9.97,
      "currency": "EUR",
      "validityDays": 30,
      "coverageCount": 6,
      "coverage": [
        { "code": "id", "name": "Indonesia", "networks": [], "maxGen": "5G" },
        { "code": "th", "name": "Thailand", "networks": [], "maxGen": "5G" }
      ]
    }
  }
}
  • The response has every field of the list endpoint plus `coverage`; the example is shortened.

Place an order

POST/orders

Buy one eSIM for one package. The price is taken from your wallet immediately. You get the eSIM's activation code in the response, or a moment later by polling.

Headers

Idempotency-Keyrequiredstring8–128 characters, unique per order (a UUID is ideal). Sending the same key again returns the original order instead of buying a second eSIM — so it is always safe to retry a request that timed out.

JSON body

packageIdrequiredstringThe `id` of a package from the catalogue.
customerEmailstringYour customer's email. Stored with the order for your records and returned in order responses.
customerNamestringYour customer's name (up to 120 characters).
referencestringYour own order number or reference (up to 120 characters). Returned in order responses.
sendEmailbooleanDefault false: we send nothing to your customer and you deliver the eSIM yourself. Set true to have us email the QR code to `customerEmail`. The email is RoamSIM-branded unless you set up white-label emails in Dashboard → Settings: then it goes out under your brand name, logo and colour, with your support address as Reply-To and no RoamSIM links or promotion (it is still sent from our address).

Request

curl -X POST https://roam-sim.com/api/v1/orders \
  -H "X-Api-Key: rsk_live_your_key" \
  -H "Idempotency-Key: 8f14e45f-ceea-467d-9f3b-2c1b5a9e7d10" \
  -H "Content-Type: application/json" \
  -d '{
    "packageId": "sb-th-1761903227118737-30",
    "customerEmail": "traveler@example.com",
    "customerName": "Ada Lovelace",
    "reference": "INV-10293"
  }'

Response

HTTP/1.1 201 Created

{
  "status": "success",
  "data": {
    "order": {
      "orderId": "cmb1x2y3z0001abcd1234efgh",
      "status": "processing",
      "packageId": "sb-th-1761903227118737-30",
      "packageName": "10GB eSIM Data for 30 Days for Thailand",
      "price": 9.97,
      "currency": "EUR",
      "reference": "INV-10293",
      "customerEmail": "traveler@example.com",
      "batchId": null,
      "testMode": false,
      "createdAt": "2026-11-25T18:22:16.732Z",
      "esim": null,
      "error": null
    }
  }
}
  • HTTP 201 means a new order was created and charged. HTTP 200 means the Idempotency-Key was seen before and this is the original order — nothing was charged again.
  • Every order carries `testMode` (true for orders placed with a test key) and `batchId` (set on orders placed through POST /orders/bulk, otherwise null). `status` is `completed` when `esim` is filled in. Many plans complete in the same response; others return `processing` and complete within about a minute — poll GET /orders/{orderId}.
  • If the eSIM cannot be issued you get HTTP 502 `provisioning_failed` and your wallet is refunded in full. That order stays `failed`; retry with a new Idempotency-Key.
  • One order is one eSIM. To buy several at once use POST /orders/bulk.
  • With a test key nothing is charged and no real eSIM is made; `testMode` is `true`. Set `reference` to `test:fail`, `test:instant`, `test:slow` or `test:insufficient_balance` to force an outcome — see Test mode.

Place orders in bulk

POST/orders/bulk

Buy up to 50 eSIMs in one request. Every eSIM becomes its own order, and all of them share one `batchId`. The whole batch is checked and priced first: if anything is invalid or your wallet cannot cover all of it, nothing is ordered and nothing is charged. After that each eSIM succeeds or fails on its own.

Headers

Idempotency-Keyrequiredstring8–128 characters, unique per bulk request. Sending the same request again with the same key returns the orders it already made and orders only what is still missing — it can never buy an eSIM twice.

JSON body

itemsrequiredarrayOne or more items (see below). At most 50 eSIMs in total, counting each item's `quantity`.
items[].packageIdrequiredstringThe `id` of a package from the catalogue.
items[].quantityintegerHow many eSIMs of this package, 1–50. Default 1. Each one is a separate order.
items[].customerEmailstringYour customer's email, as in POST /orders.
items[].customerNamestringYour customer's name, as in POST /orders.
items[].referencestringYour own reference (up to 120 characters). Every eSIM of the item carries it.
items[].sendEmailbooleanEmail the QR code to `customerEmail`, as in POST /orders. Default false.

Request

curl -X POST https://roam-sim.com/api/v1/orders/bulk \
  -H "X-Api-Key: rsk_live_your_key" \
  -H "Idempotency-Key: 3b241101-e2bb-4255-8caf-4136c566a962" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "packageId": "sb-th-1761903227118737-30", "quantity": 2, "reference": "GROUP-77" },
      { "packageId": "sb-tr-1761903227118999-15", "customerEmail": "guide@example.com" }
    ]
  }'

Response

HTTP/1.1 201 Created

{
  "status": "success",
  "data": {
    "batchId": "batch_5d41402abc4b2a76b9719d91",
    "orders": [
      {
        "index": 0,
        "orderId": "cmb1x2y3z0001abcd1234efgh",
        "status": "completed",
        "packageId": "sb-th-1761903227118737-30",
        "packageName": "10GB eSIM Data for 30 Days for Thailand",
        "price": 9.97,
        "currency": "EUR",
        "reference": "GROUP-77",
        "customerEmail": null,
        "batchId": "batch_5d41402abc4b2a76b9719d91",
        "testMode": false,
        "createdAt": "2026-11-25T18:22:16.732Z",
        "esim": { "iccid": "89812003919135509294", "activationCode": "LPA:1$rsp.example.com$A1ED98D7690B4883A1272395C8320C66", "...": "same fields as GET /orders/{orderId}" },
        "error": null,
        "errorCode": null
      },
      {
        "index": 1,
        "orderId": "cmb1x2y3z0002abcd1234efgh",
        "status": "processing",
        "esim": null,
        "error": null,
        "errorCode": null,
        "...": "same fields as above"
      },
      {
        "index": 2,
        "orderId": "cmb1x2y3z0003abcd1234efgh",
        "status": "failed",
        "price": 0,
        "esim": null,
        "error": "The supplier could not issue this eSIM. You have been refunded.",
        "errorCode": "provisioning_failed",
        "...": "same fields as above"
      }
    ],
    "summary": { "total": 3, "completed": 1, "processing": 1, "failed": 1 }
  }
}
  • `orders` has one entry per eSIM, in request order, numbered by `index` (an item with `quantity: 3` takes three consecutive indexes). Each entry has the fields of a GET /orders/{orderId} order, plus `index` and `errorCode`.
  • A `failed` entry was refunded in full and its `price` is 0. `errorCode` says why: `provisioning_failed` (the eSIM could not be issued) or the code of the error the single-order endpoint would have returned (for example `insufficient_balance` if your wallet was spent by something else while the batch ran). A failed entry that was never created has `orderId: null`.
  • Validation happens before any money moves, and rejects the whole request: bad JSON, a missing `packageId`, an invalid email, an unknown or withdrawn package (`package_not_found`, with `data.itemIndex`), more than 50 eSIMs (`batch_too_large`), or a wallet that does not cover every eSIM still to be bought (`insufficient_balance`, with `required` and `balance`).
  • Retrying is safe. Send the identical request with the same Idempotency-Key and you get the same `batchId` and the orders that already exist; only eSIMs that were never ordered (for example one that hit `insufficient_balance`) are ordered now. An eSIM that failed with `provisioning_failed` stays failed on a retry: order it again in a new request with a new key. Reusing a key for a different request returns `idempotency_key_reused`.
  • HTTP 201 if at least one eSIM was newly ordered, 200 if every order already existed.
  • Rate limit: the request counts as one order per eSIM against the 30 orders per minute budget. It is accepted while that budget is not yet spent, and then uses up the rest of the minute, so send bulk requests at most about once a minute.
  • Orders are issued a few at a time, so a batch of 50 can take a while. Orders that come back `processing` finish on their own: poll GET /orders?batchId=… (or GET /orders/{orderId}), or use webhooks.
  • Works with a test key, exactly like POST /orders: no charge, fake eSIMs, and the `test:` references below apply to each item.

Get an order

GET/orders/{orderId}

The current state of an order. While an order is `processing`, calling this is also what moves it forward — poll every 5–10 seconds until the status changes.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/orders/cmb1x2y3z0001abcd1234efgh

Response

{
  "status": "success",
  "data": {
    "order": {
      "orderId": "cmb1x2y3z0001abcd1234efgh",
      "status": "completed",
      "packageId": "sb-th-1761903227118737-30",
      "packageName": "10GB eSIM Data for 30 Days for Thailand",
      "price": 9.97,
      "currency": "EUR",
      "reference": "INV-10293",
      "customerEmail": "traveler@example.com",
      "batchId": null,
      "testMode": false,
      "createdAt": "2026-11-25T18:22:16.732Z",
      "esim": {
        "iccid": "89812003919135509294",
        "activationCode": "LPA:1$rsp.example.com$A1ED98D7690B4883A1272395C8320C66",
        "smdpAddress": "rsp.example.com",
        "matchingId": "A1ED98D7690B4883A1272395C8320C66",
        "installUrlIos": "https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%24A1ED98D7690B4883A1272395C8320C66",
        "installUrlAndroid": "https://esimsetup.android.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%24A1ED98D7690B4883A1272395C8320C66",
        "apn": null,
        "validityDays": 30
      },
      "error": null
    }
  }
}
  • `processing` — paid, the eSIM is being issued. `esim` is null. Keep polling.
  • `completed` — `esim.activationCode` is the full code. Encode it as a QR code for your customer to scan, or give them `installUrlIos` / `installUrlAndroid` for one-tap install on the phone itself.
  • `failed` — nothing was delivered and the price was refunded to your wallet. `error` says why, and `price` shows 0.
  • An activation code installs on one device only. Tell your customer not to delete the eSIM after installing it.
  • If an order is still `processing` after 10 minutes, contact support with the `orderId`. You are not charged for an order that ends up `failed`.
  • Polling is optional if you use webhooks: `order.completed` and `order.failed` are sent when the order reaches its final state.
  • A test key only sees test orders; a live key only live orders. Asking for the other kind returns `order_not_found`.

List orders

GET/orders

Your API orders, newest first. A live key lists live orders; a test key lists test orders.

Query parameters

pageintegerPage number, from 1. Default 1.
limitintegerResults per page, 1–100. Default 20.
batchIdstringOnly the orders of one bulk request (the `batchId` it returned).

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  "https://roam-sim.com/api/v1/orders?page=1&limit=20"

Response

{
  "status": "success",
  "data": {
    "orders": [ { "orderId": "cmb1x2y3z0001abcd1234efgh", "status": "completed", "...": "same fields as GET /orders/{orderId}" } ],
    "pagination": { "page": 1, "limit": 20, "total": 1, "totalPages": 1 }
  }
}
  • The list does not advance `processing` orders; use GET /orders/{orderId} for that.

eSIM data usage

GET/orders/{orderId}/usage

How much data the order's eSIM has used and has left. Available once the order is completed.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/orders/cmb1x2y3z0001abcd1234efgh/usage

Response

{
  "status": "success",
  "data": {
    "usage": {
      "available": true,
      "unlimited": false,
      "dataTotalMb": 10240,
      "dataUsedMb": 1536,
      "dataRemainingMb": 8704,
      "status": "active",
      "expiresAt": "2026-12-25T18:22:16.000Z"
    }
  }
}
  • `available: false` means live usage is not reported for this plan. `dataTotalMb` is still the plan's allowance; `dataUsedMb` and `dataRemainingMb` are null. Do not show a usage meter for these.
  • `status` is one of `active`, `expiringSoon`, `expired`, `paused`, `revoked`.
  • Most plans start their validity when the eSIM first connects in the destination country, so `expiresAt` is an estimate until then.
  • Usage is read live from the network operator and can lag real use by up to an hour. Do not poll it more than once every few minutes per eSIM.

Get your webhook

GET/webhook

The webhook URL events are sent to, and how the last deliveries went. The signing secret is never returned here.

Request

curl -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/webhook

Response

{
  "status": "success",
  "data": {
    "webhook": {
      "url": "https://example.com/roam-webhook",
      "active": true,
      "createdAt": "2026-11-25T18:00:00.000Z",
      "lastStatus": 200,
      "lastDeliveredAt": "2026-11-25T18:22:17.101Z",
      "consecutiveFailures": 0,
      "recent": [
        { "id": "whd_9f2a…", "event": "order.completed", "status": "delivered", "attempts": 1, "responseCode": 200, "createdAt": "2026-11-25T18:22:16.900Z" }
      ]
    }
  }
}
  • `webhook` is null if none is set. `lastStatus` is your endpoint's last HTTP status, or 0 if it did not answer at all.
  • `active: false` means we switched the endpoint off after repeated failures. Save the URL again (PUT /webhook) to switch it back on.
  • Dashboard → API shows the same and has a "Send test event" button. The webhook is shared by your live and your test key.

Set your webhook

PUT/webhook

Create the webhook or change its URL. The URL must be https on port 443 with a public hostname.

JSON body

urlrequiredstring`https://` URL on a public host. IP addresses, `localhost`, internal names, custom ports and URLs with credentials are rejected with `invalid_webhook_url`.
rotateSecretbooleanSet true to issue a new signing secret. The old one stops working immediately.

Request

curl -X PUT https://roam-sim.com/api/v1/webhook \
  -H "X-Api-Key: rsk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/roam-webhook" }'

Response

{
  "status": "success",
  "data": {
    "webhook": { "url": "https://example.com/roam-webhook", "active": true, "...": "as in GET /webhook" },
    "secret": "whsec_4f1c0b7e2d9a…"
  }
}
  • `secret` is in the response only when the webhook was just created or `rotateSecret` was true — otherwise it is null. It is shown once; store it. You use it to verify signatures.
  • Saving always switches the webhook on and clears its failure count.
  • We resolve the hostname when you save and again before every delivery, and never deliver to a private, loopback or link-local address.

Remove your webhook

DELETE/webhook

Stop sending events. Queued deliveries are dropped.

Request

curl -X DELETE -H "X-Api-Key: rsk_live_your_key" \
  https://roam-sim.com/api/v1/webhook

Response

{
  "status": "success",
  "data": { "removed": 1 }
}

Test mode

Build and test your integration without spending money. Create a test key (`rsk_test_…`) in Dashboard → API and use it exactly like your live key. The catalogue and prices are the real ones. Everything else is pretend: your wallet is never charged, no supplier is contacted, no email is sent, and the eSIM is fake.

Test orders are completely separate from live ones: they never appear in your dashboard sales, totals, invoices or wallet history, and a test key cannot see live orders (nor a live key test orders). Every order carries `"testMode": true`, and so does every webhook for it.

How it behaves

  • GET /balance returns a fixed pretend balance of 1000.00 EUR with `testMode: true`. Test orders do not change it.
  • POST /orders and POST /orders/bulk validate, price and de-duplicate exactly as in live mode: the same Idempotency-Key rules, the same error codes, the same `package_not_found` for a withdrawn plan.
  • An order starts as `processing`. About 5 seconds later it is `completed` (the next poll of GET /orders/{orderId} shows it, and the `order.completed` webhook is sent). Build your polling loop against this.
  • The completed order has an obviously fake eSIM: an ICCID starting `8900000`, and an activation code `LPA:1$test.roam-sim.com$TEST-<orderId>` that no phone can install. Install links are generated but lead nowhere useful.
  • `customerEmail` and `customerName` are validated but not stored in test mode, so `customerEmail` comes back null. `sendEmail` is accepted and ignored: nothing is ever emailed.
  • GET /orders/{orderId}/usage returns a made-up meter (25% of the plan used) for completed test orders.

Forcing an outcome

Set the order's `reference` to one of these to make a test order behave a particular way. Anything after a second colon is ignored, so each order can still carry a unique reference, e.g. `test:fail:case-12`. Matching is case-insensitive. Any other reference gives the normal behaviour.

Magic references

test:instantcompleted at onceThe response to POST /orders is already `completed` with its fake eSIM. The `order.completed` webhook is sent immediately.
test:failprocessing, then failedAfter about 5 seconds the order becomes `failed` with `error` set and `price` 0, as after a supplier failure. The `order.failed` webhook is sent. (A live supplier failure at creation answers 502 `provisioning_failed` instead; this lets you test the asynchronous path.)
test:slowprocessing for 60 sStays `processing` for a minute, then completes. Use it to test your polling loop and its timeouts.
test:insufficient_balanceHTTP 402POST /orders answers 402 `insufficient_balance` with `data.balance` 0 and creates no order — exactly like an empty wallet. In a bulk request only that item fails.

Example

curl -X POST https://roam-sim.com/api/v1/orders \
  -H "X-Api-Key: rsk_test_your_key" \
  -H "Idempotency-Key: 6a4b2c10-91d3-4e0e-8f7b-0c3d2e1f4a5b" \
  -H "Content-Type: application/json" \
  -d '{ "packageId": "sb-th-1761903227118737-30", "reference": "test:fail:case-12" }'
  • Switching to live is changing the key: nothing else in your code changes. Never ship a test key to production, and never test with a live key.
  • Test orders are never billed. Test and live Idempotency-Keys are separate: the same key used with each key creates one order in each mode.

Webhooks

Instead of polling, let us call you. Set one HTTPS URL in Dashboard → API (or with PUT /webhook) and we POST a JSON event to it whenever an API order reaches its final state, and when your wallet runs low. One webhook serves your live and your test key; test-mode events say `"testMode": true`.

Deliveries are at least once. Each has a unique `id` — use it to ignore a repeat. Events are not guaranteed to arrive in order.

Events

Events

order.completedorderAn order is `completed` and `data.order.esim` holds the activation code. Sent once per order.
order.failedorderAn order is `failed` and has been refunded; `data.order.error` says why. Sent once per order.
balance.lowbalanceYour wallet balance fell below the low-balance threshold you set in Dashboard → Settings. `data` is `{ balance, currency, threshold }`. Sent once per dip, right after the order that caused it; you are alerted again only after the balance has been back at or above the threshold. We also email you at that moment. Test-mode orders never trigger it.
webhook.testorderA sample event, sent only when you press "Send test event" in the dashboard. Its order is made up. Sent once, never retried.

Payload

The body is JSON. For order events `data.order` is exactly the order object the API returns (see GET /orders/{orderId}), so one parser serves both. `id` is the delivery id.

{
  "id": "whd_4c1f0a9e3b2d7a6c5e8f9012",
  "event": "order.completed",
  "createdAt": "2026-11-25T18:22:17.100Z",
  "testMode": false,
  "data": {
    "order": {
      "orderId": "cmb1x2y3z0001abcd1234efgh",
      "status": "completed",
      "packageId": "sb-th-1761903227118737-30",
      "packageName": "10GB eSIM Data for 30 Days for Thailand",
      "price": 9.97,
      "currency": "EUR",
      "reference": "INV-10293",
      "customerEmail": "traveler@example.com",
      "batchId": null,
      "testMode": false,
      "createdAt": "2026-11-25T18:22:16.732Z",
      "esim": {
        "iccid": "89812003919135509294",
        "activationCode": "LPA:1$rsp.example.com$A1ED98D7690B4883A1272395C8320C66",
        "smdpAddress": "rsp.example.com",
        "matchingId": "A1ED98D7690B4883A1272395C8320C66",
        "installUrlIos": "https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%24A1ED98D7690B4883A1272395C8320C66",
        "installUrlAndroid": "https://esimsetup.android.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%24A1ED98D7690B4883A1272395C8320C66",
        "apn": null,
        "validityDays": 30
      },
      "error": null
    }
  }
}

Request headers

X-Roam-EventstringThe event name, e.g. `order.completed`.
X-Roam-DeliverystringThe delivery id; the same as `id` in the body and the same on every retry.
X-Roam-Signaturestring`t=<unix seconds>,v1=<hex>` — see Verifying signatures.
Content-Typestring`application/json`.

Verifying signatures

Always verify the signature: anyone can POST to your URL, only we know your signing secret (`whsec_…`, shown when you create the webhook or rotate its secret).

`X-Roam-Signature` is `t=<unix seconds>,v1=<hex>`. `v1` is the hex HMAC-SHA256, keyed with your secret, of the string `<t>.<raw request body>` — the timestamp, a dot, and the body exactly as received.

Compute it yourself over the raw bytes (not a re-serialised copy of the JSON), compare in constant time, and reject a `t` more than 5 minutes from your clock. Every retry is signed afresh, so a retry carries a new `t`.

Node.js (Express)

import crypto from "node:crypto";
import express from "express";

const app = express();
const SECRET = process.env.ROAM_WEBHOOK_SECRET; // whsec_…

// Use the RAW body: the signature is computed over the exact bytes we sent.
app.post("/roam-webhook", express.raw({ type: "application/json" }), (req, res) => {
  const header = req.get("X-Roam-Signature") || "";
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const t = Number(parts.t);
  const raw = req.body.toString("utf8");

  const expected = crypto.createHmac("sha256", SECRET).update(t + "." + raw).digest("hex");
  const given = String(parts.v1 || "");
  const valid =
    given.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
  const fresh = Math.abs(Date.now() / 1000 - t) <= 300; // reject replays older than 5 minutes
  if (!valid || !fresh) return res.status(400).send("bad signature");

  const event = JSON.parse(raw);
  // De-duplicate on event.id: a delivery can arrive more than once.
  // Answer fast with a 2xx, then do the work.
  res.sendStatus(200);

  if (event.event === "order.completed") {
    // event.data.order.esim.activationCode …
  }
});

app.listen(3000);

PHP

<?php
$secret = getenv('ROAM_WEBHOOK_SECRET'); // whsec_…

// Use the RAW body: the signature is computed over the exact bytes we sent.
$raw = file_get_contents('php://input');
$header = $_SERVER['HTTP_X_ROAM_SIGNATURE'] ?? '';

if (!preg_match('/^t=(\d+),v1=([a-f0-9]{64})$/', $header, $m)) {
    http_response_code(400);
    exit('bad signature');
}
[$all, $t, $given] = $m;

$expected = hash_hmac('sha256', $t . '.' . $raw, $secret);
$valid = hash_equals($expected, $given);
$fresh = abs(time() - (int) $t) <= 300; // reject replays older than 5 minutes
if (!$valid || !$fresh) {
    http_response_code(400);
    exit('bad signature');
}

$event = json_decode($raw, true);
// De-duplicate on $event['id']: a delivery can arrive more than once.
// Answer fast with a 2xx, then do the work.
http_response_code(200);

if ($event['event'] === 'order.completed') {
    // $event['data']['order']['esim']['activationCode'] …
}

Delivery and retries

We POST the event, wait up to 10 seconds, and ignore the response body. Any 2xx status is success; anything else (other status, timeout, connection error) is a failure. We do not follow redirects, so give the final URL. A failed delivery is retried on this schedule, measured from the previous attempt:

Retry schedule

Attempt 1immediatelyWhen the event happens.
Attempt 2after 1 minute
Attempt 3after 5 minutes
Attempt 4after 30 minutes
Attempt 5after 2 hours
Attempt 6after 6 hours
Attempt 7after 24 hoursThe last one. If it fails the delivery is marked failed and dropped.
  • Retries run from a once-a-minute job, so a retry can be up to a minute late.
  • If 20 events in a row use up all their attempts without a single success, we switch the endpoint off and stop queueing events for it. Fix your endpoint, then save the URL again (dashboard, or PUT /webhook) to switch it back on. Events that happened while it was off are not sent afterwards: reconcile with GET /orders.
  • We only deliver to public HTTPS endpoints: port 443, a hostname (not an IP address). We resolve the hostname before every delivery and refuse any that points at a private, loopback or link-local address.
  • Webhooks complement polling, they do not replace the safety net: if you must not miss an order, also reconcile with GET /orders now and then.
  • Delivery history is kept for 30 days.

Error codes

HTTPcodeMeaning and what to do
400invalid_jsonThe request body is not a JSON object.
400idempotency_key_requiredPOST /orders or POST /orders/bulk was sent without a valid Idempotency-Key header (8–128 characters).
400package_id_required`packageId` is missing.
400invalid_customer_email`customerEmail` is not a valid email address.
400customer_email_required`sendEmail` is true but no `customerEmail` was given.
400items_requiredPOST /orders/bulk was sent without a non-empty `items` array.
400invalid_itemAn entry of `items` is not an object. `data.itemIndex` says which.
400invalid_quantityAn item's `quantity` is not a whole number from 1 to 50. `data.itemIndex` says which.
400batch_too_largeA bulk request can order at most 50 eSIMs in total, counting each item's `quantity`.
400invalid_webhook_urlThe webhook URL is not https on port 443, is not a public hostname, or does not resolve to a public address.
400invalid_country`country` is not a two-letter ISO code.
400invalid_scope`scope` is not one of country, region, global.
401invalid_api_keyThe key is missing, malformed, revoked, or does not belong to a reseller account.
402insufficient_balanceThe wallet does not cover the order. Nothing was charged; top up and retry with the same Idempotency-Key. `data` has `required` and `balance`. For POST /orders/bulk the check covers every eSIM of the batch that still has to be bought, and nothing is ordered if it fails.
403account_suspendedThe reseller account is suspended. Contact support.
403order_refusedThe order could not be accepted. Contact support.
404package_not_foundThe package does not exist or is no longer on sale. Refresh your catalogue. In a bulk request nothing is ordered, and `data.itemIndex` and `data.packageId` name the culprit.
404order_not_foundNo order with that id belongs to your account. A test key cannot see live orders and a live key cannot see test orders.
409idempotency_key_reusedThe Idempotency-Key was already used for a different package (or, for a bulk request, for a different request). Use a new key for a new order.
409order_not_readyUsage was requested for an order that is not completed yet.
429rate_limitedToo many requests. Wait `Retry-After` seconds.
502provisioning_failedThe eSIM could not be issued. Your wallet was refunded. Retry with a NEW Idempotency-Key.
503package_unavailableThe package cannot be ordered at the moment. Try again later.
500internal_errorSomething failed on our side. Safe to retry with the same Idempotency-Key.

Integration checklist

  • Keep the API key on your server. Never ship it in a web page or mobile app.
  • Generate a fresh Idempotency-Key (UUID) per customer order and store it with your order before calling us. On a timeout or 5xx, retry with the SAME key.
  • Take payment from your customer first, then place the order with us.
  • Handle `processing`: poll GET /orders/{orderId} every 5–10 seconds for up to 10 minutes before telling the customer there is a delay.
  • Handle `insufficient_balance`: alert yourself to top up. Watch GET /balance and keep a buffer.
  • Deliver the eSIM as a QR code made from `esim.activationCode`, plus the one-tap install links.
  • Show the plan's fair-use policy (`data.fairUse`, `notes`) before the customer pays.
  • Refresh your copy of the catalogue daily; prices and availability change.
  • Build against a test key first (see Test mode); force the failure paths with `test:fail` and `test:insufficient_balance` before you go live.
  • If you use webhooks: verify `X-Roam-Signature` on the raw body, answer 2xx quickly, and ignore a repeated delivery `id`.
  • For several eSIMs at once use POST /orders/bulk with one Idempotency-Key, and retry the same request on a timeout.

Questions or a stuck order: support@roam-sim.com — include the orderId.