{"openapi":"3.1.0","info":{"title":"onesim eSIM API","version":"1.0.0","description":"The onesim partner API lets your servers buy onesim eSIMs and data packages\nfrom your partner balance, hand the eSIMs to your customers under your own\nbrand, and follow their usage. It is a JSON API over HTTPS at\n`https://api.onesim.global/v1`.\n\n## Getting started\n\n1. Ask your onesim contact to enable the API for your partner account.\n2. Sign in to the partner platform, open **Developers** and create a key. It is\n   shown once: store it in your server's secrets.\n3. Read your catalogue: `GET /v1/packages`.\n4. Buy: `POST /v1/orders` with an `Idempotency-Key` header.\n\n```bash\ncurl https://api.onesim.global/v1/packages \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\"\n\ncurl https://api.onesim.global/v1/orders \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"type\": \"bundle\", \"package_id\": \"<package id>\", \"reference\": \"BOOKING-1042\"}'\n```\n\nThe answer carries the eSIM's `activation_code` (put it in a QR code) and\nthe package on it. Send the QR code, the `ios_install_url` or the\n`android_install_url` to your customer.\n\n## SDKs\n\nFor TypeScript and JavaScript there is the onesim SDK,\n[`@onesim.global/sdk`](https://www.npmjs.com/package/@onesim.global/sdk) (MIT, no dependencies). It runs on\nNode.js 20 or later, Deno, Bun and Cloudflare Workers.\n\n```bash\nnpm install @onesim.global/sdk\n```\n\n```ts\nimport OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\nconst { data: packages } = await onesim.packages.list();\n\nconst order = await onesim.orders.createAndPoll(\n  { type: 'bundle', package_id: packages[0].id },\n  { idempotencyKey: booking.orderKey } // a UUID kept with the booking\n);\nif (order.status === 'completed') showQrCode(order.esim.activation_code);\n```\n\n`createAndPoll` waits while the order is pending. The SDK retries safely with\nthe same `Idempotency-Key` and verifies webhooks with `verifyWebhook`. Other\nlanguages use plain HTTPS, as shown below: every operation in this reference\nhas a TypeScript and a cURL sample.\n\n## Authentication\n\nEvery request carries your key as a bearer token:\n`Authorization: Bearer osk_live_…`. Keys are secrets for your servers only:\nnever put one in an app, a browser or a URL. Create a second key before\nrevoking the first to rotate without downtime. A revoked, unknown or\nmalformed key gets `401 unauthorized`.\n\n## Testing\n\nEvery key is live: the eSIMs and packages it buys are real and paid from your\npartner balance, which starts with an onboarding credit for your first orders.\nRun the flow end to end before you sell: a `type: esim` order first (a blank\neSIM, the cheapest; install it on a phone of yours), then a `package` on that\neSIM for the top-up path, then a `bundle` for the whole flow. Retrying with\nthe same `Idempotency-Key` never buys twice, and a failed order is refunded\nat once. Whether a package nobody activated is refunded is set in your partner\nagreement.\n\n## Two ways to buy\n\n| `type` | You get | You pay |\n| --- | --- | --- |\n| `esim` | A blank eSIM with its activation code, no data. | `esim_price` |\n| `package` | A package on an eSIM you already own: the first one or a top-up. | the package's `price` |\n| `bundle` | A new eSIM with the package already on it. | the package's `bundle.amount` |\n\n`GET /v1/packages` shows which of these your agreement includes and at what\nprice, in cents of your account's currency: EUR, or USD when your agreement is\nin dollars. Every amount names it in `currency`, and your balance is kept in\nit too. A `null` price means \"not offered that way\". The\namount is debited from your partner balance when the order is placed and\nrefunded in full if it fails. Pass `expected_amount` to refuse a purchase\nwhose price is not what you showed your customer.\n\n## Orders and `202`\n\n`POST /v1/orders` answers `201` when the order is complete: the eSIM has\nits activation code and the package is on it. When the network provider has\nnot confirmed yet, it answers `202` with `status: \"pending\"` and a\n`Location` header: poll `GET /v1/orders/{id}` every few seconds (or retry\nthe same POST with the same key) until the status is `completed` or\n`failed`. A pending order is either completed or failed and refunded within\nabout ten minutes. Webhooks tell you too.\n\n## Idempotency\n\nEvery `POST /v1/orders` needs an `Idempotency-Key` header: a UUID, new for\neach purchase and the same on every retry of it. A retry with the same key and\nbody charges nothing and returns the order as it is now: `202` while it is\npending, `201` once it is completed, even if it was refunded since. The same\nkey with a different body is `409 idempotency_conflict`. When a request\ntimes out or fails with a `5xx`, retry it with the same key: you never buy\ntwice. `502 provisioning_failed` is the exception: that order failed for\ngood, the same key returns the same error, and buying again needs a new key.\nA request refused before an order existed (a `4xx` other than\n`idempotency_conflict`) did nothing and its key can be used again.\n\n## Lifecycle of an eSIM and its packages\n\n- An eSIM is installed once, on one device, from its activation code. Install\n  it before travelling, on Wi-Fi.\n- A package starts as `not_active`. It activates when the device first\n  connects in a covered country, and its validity (`validity_days`) counts\n  from then. A package must be activated within 30 days of its purchase.\n- More than one package can sit on an eSIM; a top-up is a `package` order on\n  the same eSIM. A package ends (`terminated`) when its data is used up or its\n  validity runs out.\n- `GET /v1/esims/{id}` reads the live state from the network: status,\n  `data_remaining` in bytes, activation and expiry. When the network does not\n  answer, it returns the last known values with `refreshed_at: null`.\n\n## Installing an eSIM\n\nThe `activation_code` is an LPA string, `LPA:1$<SM-DP+ address>$<matching id>`:\n\n- **QR code**: encode the whole string.\n- **iPhone**: open `ios_install_url` on the device (iOS 17.4 or later).\n- **Android**: open `android_install_url` on the device (Android 10 or later).\n  Google Play services opens the eSIM setup; without a recent version the\n  link opens an empty page, so keep the QR code or manual entry at hand.\n- **Manual entry**: `smdp_address` and `matching_id`.\n\nAn activation code works once. If your customer deletes the eSIM, buy a new one.\n\n## Errors\n\nErrors are JSON: `{\"error\": {\"code\": \"…\", \"message\": \"…\", \"request_id\": \"…\"}}`.\nAct on `code`; `message` is for people and may change. Quote `request_id`\nwhen you contact us. New codes may be added: treat an unknown code by its\nHTTP status.\n\n| Status | `code` | Meaning |\n| --- | --- | --- |\n| 400 | `invalid_request` | The body or a parameter is malformed. |\n| 400 | `idempotency_key_required` | A POST without a UUID `Idempotency-Key`. |\n| 401 | `unauthorized` | Missing, unknown or revoked key. |\n| 402 | `insufficient_balance` | Balance plus overdraft is below the amount. |\n| 403 | `not_offered` | Your agreement does not include this way of buying this package. |\n| 404 | `not_found` | No such resource for you. |\n| 405 | `method_not_allowed` | Wrong HTTP method for this path. |\n| 409 | `idempotency_conflict` | The key was used for a different request. |\n| 409 | `esim_busy` | Another order on this eSIM is still pending. |\n| 409 | `price_changed` | `expected_amount` differs; `error.amount` is the current amount. |\n| 409 | `esim_limit_reached` | `error.limit` is `blank` (too many eSIMs without a package) or `daily`. |\n| 409 | `esim_unusable` | The eSIM is terminated. |\n| 429 | `rate_limited` | Too many requests; wait `Retry-After` seconds. |\n| 500, 502 | `internal_error` | Our fault, or the API could not be reached. Retry with the same `Idempotency-Key`. |\n| 502 | `provisioning_failed` | The network refused; the order failed and was refunded (`error.order`). Final: the same key returns it again. |\n| 503 | `esims_unavailable` | No eSIM can be issued right now; try again later. |\n\n## Limits\n\nEach key may send about 120 requests a minute, and each IP address about 300;\nbeyond that, `429` with `Retry-After`. A request body may be up to 16 KB. By\ndefault you may hold 20 eSIMs without a package and buy 100 new eSIMs a day;\nask your onesim contact to change them.\n\n## Webhooks\n\nAdd an endpoint (an `https` URL) under **Developers → Webhooks** in the\npartner platform and choose its events. Each event is a POST of JSON:\n\n```json\n{ \"id\": \"…\", \"type\": \"order.completed\", \"created_at\": \"…\", \"data\": { … } }\n```\n\nThe events are listed under **Webhooks** in this reference. Answer with any\n`2xx` within 10 seconds. Anything else is retried after 1 minute, 5 minutes,\n30 minutes, 2 hours, 6 hours, 12 hours and 24 hours, then given up. Delivery is\nat least once and in no particular order: use the event `id` to ignore\nrepeats, and read the resource when order matters.\n\nVerify every delivery. The `Onesim-Signature` header is\n`t=<unix seconds>,v1=<hex>`, where `<hex>` is the HMAC-SHA256 of\n`<t>.<raw body>` with your endpoint's signing secret (`whsec_…`, shown once\nwhen you add the endpoint). Compare in constant time and reject a `t` more\nthan five minutes old.\n\nWith the TypeScript SDK, `verifyWebhook` does all of this and returns the\nevent. It throws `WebhookVerificationError` when a check fails.\n\n```ts\nimport { verifyWebhook } from '@onesim.global/sdk';\n\nconst event = await verifyWebhook({\n  payload: rawBody, // the body exactly as received, not parsed JSON\n  signature: request.headers.get('onesim-signature'),\n  secret: process.env.ONESIM_WEBHOOK_SECRET\n});\n```\n\nWithout the SDK, in Node.js:\n\n```js\nimport { createHmac, timingSafeEqual } from 'node:crypto';\n\nfunction verify(rawBody, header, secret) {\n  const { t, v1 } = Object.fromEntries(header.split(',').map((part) => part.split('=')));\n  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;\n  const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');\n  return timingSafeEqual(Buffer.from(expected), Buffer.from(v1));\n}\n```\n\n## Billing\n\nEvery order is debited from your partner balance at the price in your\ncatalogue; a failed order is refunded at once. Your balance, overdraft and\nmonthly statements are in the partner platform under **Billing**, and\n`GET /v1/balance` returns them too. Refunds of packages that were never\nactivated are handled by onesim support; the order's status then reads\n`refunded`.\n\n## Versioning\n\nThis is version 1. We add fields, endpoints, event types and error codes\nwithout notice: ignore what you do not know. Anything that could break an\nintegration comes as `/v2`, with at least six months of overlap.\n\n## Support\n\nYou support your customers; onesim supports you. Write to your onesim contact\nwith the order or eSIM id and the `request_id`.","contact":{"name":"onesim partnerships","url":"https://onesim.global/partners/inquiry?interest=technology"}},"externalDocs":{"description":"TypeScript SDK","url":"https://www.npmjs.com/package/@onesim.global/sdk"},"servers":[{"url":"https://api.onesim.global","description":"Production. Every key is live."}],"security":[{"apiKey":[]}],"tags":[{"name":"Catalogue","description":"What you can buy and what it costs you."},{"name":"Orders","description":"Buying blank eSIMs, packages and bundles."},{"name":"eSIMs","description":"The eSIMs you own, with their packages and usage."},{"name":"Balance","description":"Your partner balance."},{"name":"Contract","description":"This document."}],"paths":{"/v1/packages":{"get":{"tags":["Catalogue"],"operationId":"listPackages","summary":"List your catalogue","responses":{"200":{"description":"Your packages and eSIM price.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Catalogue"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst catalogue = await onesim.packages.list();\n// catalogue.data: your packages and their prices"},{"lang":"Shell","label":"cURL","source":"curl https://api.onesim.global/v1/packages \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/packages/{id}":{"get":{"tags":["Catalogue"],"operationId":"getPackage","summary":"Get one package","parameters":[{"name":"id","in":"path","required":true,"description":"The package id from your catalogue.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The package.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Package"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"404":{"description":"Not in your catalogue.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_found","message":"No such package in your catalogue.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst pkg = await onesim.packages.retrieve(\n  '5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03'\n);\n// pkg.price on your eSIM, pkg.bundle.amount with a new one"},{"lang":"Shell","label":"cURL","source":"curl https://api.onesim.global/v1/packages/5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03 \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/orders":{"post":{"tags":["Orders"],"operationId":"createOrder","summary":"Buy a blank eSIM, a package or a bundle","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"A UUID, new for each purchase and the same on its retries.","schema":{"type":"string","format":"uuid","examples":["6f1d2c3b-9a8e-4f7d-b6c5-a4e3d2c1b0f9"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderRequest"}}}},"responses":{"201":{"description":"Completed. A retry answers with the order as it is now, so its status may be refunded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"202":{"description":"Pending: poll the order until it is completed or failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"},"example":{"id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96","type":"bundle","status":"pending","amount":700,"currency":"EUR","esim_price":0,"package_price":700,"reference":"BOOKING-1042","created_at":"2026-10-01T09:30:12.000Z","esim":{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","activation_code":null,"smdp_address":null,"matching_id":null,"ios_install_url":null,"android_install_url":null},"package":{"id":null,"package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","status":null,"data_total":5242880000,"expires_at":null}}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"package_id is required.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"402":{"description":"Balance plus overdraft is below the amount.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"insufficient_balance","message":"Your balance and overdraft do not cover this order.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"403":{"description":"Not offered to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_offered","message":"This package is not offered with a new eSIM.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"404":{"description":"No such package or eSIM.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_found","message":"No such package in your catalogue.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"409":{"description":"Conflict: idempotency_conflict, esim_busy, price_changed, esim_limit_reached or esim_unusable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"price_changed","message":"The amount of this order is now 700.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52","amount":700}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"502":{"description":"The network refused; the order failed and was refunded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"provisioning_failed","message":"The network did not provision this order. It failed and the amount is back on your balance.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52","order":{"id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96","type":"bundle","status":"failed","amount":700,"currency":"EUR","esim_price":0,"package_price":700,"reference":"BOOKING-1042","created_at":"2026-10-01T09:30:12.000Z","esim":{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","activation_code":null,"smdp_address":null,"matching_id":null,"ios_install_url":null,"android_install_url":null},"package":{"id":null,"package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","status":null,"data_total":5242880000,"expires_at":null}}}}}}},"503":{"description":"No eSIM can be issued right now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"esims_unavailable","message":"No eSIM can be issued right now. Try again later.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\n// Creates the order, then polls it while it is pending.\n// orders.create answers at once, pending or not.\nconst order = await onesim.orders.createAndPoll(\n  {\n    type: 'bundle',\n    package_id: '5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03',\n    reference: 'BOOKING-1042'\n  },\n  // New for each purchase, the same on its retries:\n  { idempotencyKey: '6f1d2c3b-9a8e-4f7d-b6c5-a4e3d2c1b0f9' }\n);\nif (order.status === 'completed') {\n  console.log(order.esim.activation_code);\n}"},{"lang":"Shell","label":"cURL","source":"curl https://api.onesim.global/v1/orders \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\" \\\n  -H \"Idempotency-Key: 6f1d2c3b-9a8e-4f7d-b6c5-a4e3d2c1b0f9\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"type\": \"bundle\",\n    \"package_id\": \"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03\",\n    \"reference\": \"BOOKING-1042\"\n  }'"}]},"get":{"tags":["Orders"],"operationId":"listOrders","summary":"List your orders, newest first","parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"name":"esim_id","in":"query","description":"Only orders on this eSIM.","schema":{"type":"string","format":"uuid"}},{"name":"reference","in":"query","description":"Only orders with this reference.","schema":{"type":"string"}},{"name":"created_after","in":"query","description":"Only orders created after this time.","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"A page of orders.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderList"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst page = await onesim.orders.list({\n  reference: 'BOOKING-1042'\n});\n// page.data, newest first; page.next_cursor for more\n\n// Or every page in turn:\nfor await (const order of onesim.orders.listAll()) {\n  console.log(order.id, order.status);\n}"},{"lang":"Shell","label":"cURL","source":"curl \"https://api.onesim.global/v1/orders?reference=BOOKING-1042\" \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/orders/{id}":{"get":{"tags":["Orders"],"operationId":"getOrder","summary":"Get one order","description":"Reading a pending order also moves it forward.","parameters":[{"name":"id","in":"path","required":true,"description":"The order id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"404":{"description":"No such order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_found","message":"No such order.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst id = '9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96';\nconst order = await onesim.orders.retrieve(id);\n\n// Or read it until it is no longer pending:\nconst final = await onesim.orders.poll(id);"},{"lang":"Shell","label":"cURL","source":"curl https://api.onesim.global/v1/orders/9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96 \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/esims":{"get":{"tags":["eSIMs"],"operationId":"listEsims","summary":"List your eSIMs, newest first","parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"name":"iccid","in":"query","description":"Only the eSIM with this ICCID.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of eSIMs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EsimList"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst page = await onesim.esims.list({\n  iccid: '8910390000012345678'\n});\n\n// Or every eSIM, page after page:\nfor await (const esim of onesim.esims.listAll()) {\n  console.log(esim.id, esim.status);\n}"},{"lang":"Shell","label":"cURL","source":"curl \"https://api.onesim.global/v1/esims?iccid=8910390000012345678\" \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/esims/{id}":{"get":{"tags":["eSIMs"],"operationId":"getEsim","summary":"Get one eSIM with its packages and usage","parameters":[{"name":"id","in":"path","required":true,"description":"The eSIM id.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The eSIM, read live from the network.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Esim"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"404":{"description":"No such eSIM.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"not_found","message":"No such eSIM.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst esim = await onesim.esims.retrieve(\n  'c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41'\n);\n// esim.packages[].data_remaining: bytes left;\n// esim.refreshed_at: null if the network did not answer"},{"lang":"Shell","label":"cURL","source":"curl https://api.onesim.global/v1/esims/c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41 \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/balance":{"get":{"tags":["Balance"],"operationId":"getBalance","summary":"Get your balance","responses":{"200":{"description":"Your balance.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Balance"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}},"x-codeSamples":[{"lang":"TypeScript","label":"TypeScript SDK","source":"import OnesimClient from '@onesim.global/sdk';\n\nconst onesim = new OnesimClient(); // reads ONESIM_API_KEY\n\nconst balance = await onesim.balance.retrieve();\n// balance.available: what you can spend, in cents"},{"lang":"Shell","label":"cURL","source":"curl https://api.onesim.global/v1/balance \\\n  -H \"Authorization: Bearer $ONESIM_API_KEY\""}]}},"/v1/openapi.json":{"get":{"tags":["Contract"],"operationId":"getOpenApi","summary":"This document","description":"For generating a client or checking what changed. Any of your keys reads it.","responses":{"200":{"description":"The OpenAPI document.","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Malformed request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"invalid_request","message":"limit must be a whole number from 1 to 100.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"401":{"description":"Missing, unknown or revoked key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"unauthorized","message":"Send a valid API key as `Authorization: Bearer osk_…`.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"rate_limited","message":"Too many requests. Wait and retry.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}},"500":{"description":"Our fault; retry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"code":"internal_error","message":"Something failed on our side. Retrying with the same Idempotency-Key is safe.","request_id":"0c5e8a3f-2b7d-4e91-a6c4-9f1d3b8e7a52"}}}}}}}}},"webhooks":{"order.completed":{"post":{"summary":"order.completed","description":"An order completed: its eSIM has its activation code and its package is on it.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"order.failed":{"post":{"summary":"order.failed","description":"An order failed and was refunded.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"package.activated":{"post":{"summary":"package.activated","description":"A package activated on first connection; its validity runs from now.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"package.usage":{"post":{"summary":"package.usage","description":"A package passed a usage threshold (`percent_used`).","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"package.expired":{"post":{"summary":"package.expired","description":"A package ended: its data ran out or its validity did.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"balance.low":{"post":{"summary":"balance.low","description":"An order took the amount available to spend below your threshold.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"commission.created":{"post":{"summary":"commission.created","description":"An affiliate sale was credited to you, through your code or your link: what it earns, in your currency.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"commission.updated":{"post":{"summary":"commission.updated","description":"A credited sale's commission changed: a refund, fraud, a chargeback, a hold, or onesim's decision. `change` is the difference; `commission` what it earns now.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommissionEvent"}}}},"responses":{"2XX":{"description":"Received."}}}},"ping":{"post":{"summary":"ping","description":"A test event sent from the partner platform.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PingEvent"}}}},"responses":{"2XX":{"description":"Received."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Your API key, `osk_live_…`."}},"parameters":{"Limit":{"name":"limit","in":"query","description":"Page size, 1 to 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},"Cursor":{"name":"cursor","in":"query","description":"The `next_cursor` of the previous page.","schema":{"type":"string"}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["invalid_request","idempotency_key_required","unauthorized","insufficient_balance","not_offered","not_found","method_not_allowed","idempotency_conflict","esim_busy","price_changed","esim_limit_reached","esim_unusable","rate_limited","internal_error","provisioning_failed","esims_unavailable"]},"message":{"type":"string"},"request_id":{"type":"string"},"amount":{"type":"integer","minimum":0,"description":"price_changed: the current amount."},"limit":{"type":"string","enum":["blank","daily"],"description":"esim_limit_reached: which limit."},"order":{"$ref":"#/components/schemas/Order"}}}}},"Country":{"type":"object","required":["code","networks"],"properties":{"code":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2; Kosovo is XK."},"networks":{"type":"array","items":{"type":"string"},"description":"Mobile networks the package uses there."}}},"Package":{"type":"object","required":["id","name","countries","data","validity_days","currency","price","bundle"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"countries":{"type":"array","items":{"$ref":"#/components/schemas/Country"}},"data":{"type":"integer","description":"Data allowance in bytes."},"validity_days":{"type":"integer","description":"Days of validity from activation."},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."},"price":{"type":["integer","null"],"minimum":0,"description":"On an eSIM you own (`type: package`); null if not offered."},"bundle":{"oneOf":[{"$ref":"#/components/schemas/Bundle"},{"type":"null"}],"description":"With a new eSIM (`type: bundle`); null if not offered."}},"examples":[{"id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","countries":[{"code":"AL","networks":["Vodafone"]},{"code":"RS","networks":["A1","Yettel"]},{"code":"XK","networks":["IPKO"]}],"data":5242880000,"validity_days":30,"currency":"EUR","price":700,"bundle":{"esim_price":0,"package_price":700,"amount":700}}]},"Bundle":{"type":"object","required":["esim_price","package_price","amount"],"properties":{"esim_price":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"package_price":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"amount":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."}}},"Catalogue":{"type":"object","required":["esim_price","currency","data"],"properties":{"esim_price":{"type":["integer","null"],"minimum":0,"description":"A blank eSIM (`type: esim`); null if not offered."},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."},"data":{"type":"array","items":{"$ref":"#/components/schemas/Package"}}},"examples":[{"esim_price":150,"currency":"EUR","data":[{"id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","countries":[{"code":"AL","networks":["Vodafone"]},{"code":"RS","networks":["A1","Yettel"]},{"code":"XK","networks":["IPKO"]}],"data":5242880000,"validity_days":30,"currency":"EUR","price":700,"bundle":{"esim_price":0,"package_price":700,"amount":700}}]}]},"OrderRequest":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["esim","package","bundle"]},"esim_id":{"type":"string","format":"uuid","description":"For `package`: the eSIM that gets the package."},"package_id":{"type":"string","format":"uuid","description":"For `package` and `bundle`: from your catalogue."},"reference":{"type":"string","minLength":1,"maxLength":100,"description":"Your own reference, returned on the order."},"expected_amount":{"type":"integer","minimum":0,"description":"Refuse with price_changed unless the amount is exactly this."}},"examples":[{"type":"bundle","package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","reference":"BOOKING-1042","expected_amount":700}]},"Installation":{"type":"object","required":["activation_code","smdp_address","matching_id","ios_install_url","android_install_url"],"properties":{"activation_code":{"type":["string","null"],"description":"LPA string for the QR code; null until issued."},"smdp_address":{"type":["string","null"]},"matching_id":{"type":["string","null"]},"ios_install_url":{"type":["string","null"],"format":"uri"},"android_install_url":{"type":["string","null"],"format":"uri"}}},"OrderEsim":{"allOf":[{"type":"object","required":["id","iccid"],"properties":{"id":{"type":"string","format":"uuid"},"iccid":{"type":"string"}}},{"$ref":"#/components/schemas/Installation"}]},"OrderPackage":{"type":"object","required":["id","package_id","name","status","data_total","expires_at"],"properties":{"id":{"type":["string","null"],"format":"uuid","description":"The package on the eSIM; null while pending."},"package_id":{"type":["string","null"],"format":"uuid","description":"The catalogue package."},"name":{"type":"string"},"status":{"type":["string","null"],"description":"`not_active`, `active` or `terminated`; null while pending."},"data_total":{"type":"integer","description":"Bytes."},"expires_at":{"type":["string","null"],"format":"date-time"}}},"Order":{"type":"object","required":["id","type","status","amount","currency","esim_price","package_price","reference","created_at","esim","package"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["esim","package","bundle"]},"status":{"type":"string","enum":["pending","completed","failed","refunded"],"description":"`refunded`: onesim support refunded the order after it completed."},"amount":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."},"esim_price":{"type":["integer","null"],"minimum":0,"description":"The part of amount for a new eSIM; null when none was issued."},"package_price":{"type":["integer","null"],"minimum":0,"description":"The part of amount for the package; null for a blank eSIM."},"reference":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"esim":{"$ref":"#/components/schemas/OrderEsim"},"package":{"oneOf":[{"$ref":"#/components/schemas/OrderPackage"},{"type":"null"}]}},"examples":[{"id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96","type":"bundle","status":"completed","amount":700,"currency":"EUR","esim_price":0,"package_price":700,"reference":"BOOKING-1042","created_at":"2026-10-01T09:30:12.000Z","esim":{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","activation_code":"LPA:1$rsp.example.com$4F2A-9C1D-7E3B-8A60","smdp_address":"rsp.example.com","matching_id":"4F2A-9C1D-7E3B-8A60","ios_install_url":"https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%244F2A-9C1D-7E3B-8A60","android_install_url":"https://esimsetup.android.com/esim_qrcode_provisioning?carddata=LPA:1$rsp.example.com$4F2A-9C1D-7E3B-8A60"},"package":{"id":"1d8f6a3b-7e2c-4b9a-a5d4-3f1e0c7b9a28","package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","status":"not_active","data_total":5242880000,"expires_at":null}}]},"OrderList":{"type":"object","required":["data","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"next_cursor":{"type":["string","null"]}},"examples":[{"data":[{"id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96","type":"bundle","status":"completed","amount":700,"currency":"EUR","esim_price":0,"package_price":700,"reference":"BOOKING-1042","created_at":"2026-10-01T09:30:12.000Z","esim":{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","activation_code":"LPA:1$rsp.example.com$4F2A-9C1D-7E3B-8A60","smdp_address":"rsp.example.com","matching_id":"4F2A-9C1D-7E3B-8A60","ios_install_url":"https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%244F2A-9C1D-7E3B-8A60","android_install_url":"https://esimsetup.android.com/esim_qrcode_provisioning?carddata=LPA:1$rsp.example.com$4F2A-9C1D-7E3B-8A60"},"package":{"id":"1d8f6a3b-7e2c-4b9a-a5d4-3f1e0c7b9a28","package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","status":"not_active","data_total":5242880000,"expires_at":null}}],"next_cursor":null}]},"EsimSummary":{"type":"object","required":["id","iccid","status","profile_state","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"iccid":{"type":"string"},"status":{"type":["string","null"],"description":"Network status, e.g. `pre_service`, `in_service`."},"profile_state":{"type":["string","null"],"description":"eSIM profile, e.g. `released`, `enabled`, `disabled`."},"created_at":{"type":"string","format":"date-time"}},"examples":[{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","status":"in_service","profile_state":"enabled","created_at":"2026-10-01T09:30:12.000Z"}]},"EsimList":{"type":"object","required":["data","next_cursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EsimSummary"}},"next_cursor":{"type":["string","null"]}},"examples":[{"data":[{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","status":"in_service","profile_state":"enabled","created_at":"2026-10-01T09:30:12.000Z"}],"next_cursor":null}]},"EsimPackage":{"type":"object","required":["id","package_id","name","status","data_total","data_remaining","activated_at","expires_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"package_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"status":{"type":["string","null"],"description":"`not_active`, `active` or `terminated`."},"data_total":{"type":"integer","description":"Bytes."},"data_remaining":{"type":["integer","null"],"description":"Bytes; null when not known yet."},"activated_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":["string","null"],"format":"date-time"}}},"Esim":{"allOf":[{"$ref":"#/components/schemas/EsimSummary"},{"$ref":"#/components/schemas/Installation"},{"type":"object","required":["refreshed_at","packages"],"properties":{"refreshed_at":{"type":["string","null"],"format":"date-time","description":"When the network was read; null when it did not answer."},"packages":{"type":"array","items":{"$ref":"#/components/schemas/EsimPackage"}}}}],"examples":[{"id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","status":"in_service","profile_state":"enabled","created_at":"2026-10-01T09:30:12.000Z","activation_code":"LPA:1$rsp.example.com$4F2A-9C1D-7E3B-8A60","smdp_address":"rsp.example.com","matching_id":"4F2A-9C1D-7E3B-8A60","ios_install_url":"https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA%3A1%24rsp.example.com%244F2A-9C1D-7E3B-8A60","android_install_url":"https://esimsetup.android.com/esim_qrcode_provisioning?carddata=LPA:1$rsp.example.com$4F2A-9C1D-7E3B-8A60","refreshed_at":"2026-10-05T18:02:11.000Z","packages":[{"id":"1d8f6a3b-7e2c-4b9a-a5d4-3f1e0c7b9a28","package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB","status":"active","data_total":5242880000,"data_remaining":3984588800,"activated_at":"2026-10-03T07:12:40.000Z","expires_at":"2026-11-02T07:12:40.000Z","created_at":"2026-10-01T09:30:14.000Z"}]}]},"Balance":{"type":"object","required":["balance","overdraft_limit","available","currency"],"properties":{"balance":{"type":"integer","description":"Cents; negative when you owe us."},"overdraft_limit":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"available":{"type":"integer","description":"balance + overdraft_limit: what you can spend now."},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."}},"examples":[{"balance":23500,"overdraft_limit":10000,"available":33500,"currency":"EUR"}]},"Event":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","format":"uuid","description":"Unique per event: ignore an id you have seen."},"type":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object"}}},"OrderEvent":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"enum":["order.completed","order.failed"]},"data":{"type":"object","required":["id","type","status","amount","currency","esim_id","iccid","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["esim","package","bundle"]},"status":{"type":"string"},"amount":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"esim_price":{"type":["integer","null"],"minimum":0},"package_price":{"type":["integer","null"],"minimum":0},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."},"reference":{"type":["string","null"]},"esim_id":{"type":"string","format":"uuid"},"iccid":{"type":"string"},"package_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"}}}}}],"examples":[{"id":"3b7e1c9a-5d2f-4a8e-9c6b-1f0e7d4a2b85","type":"order.completed","created_at":"2026-10-01T09:30:13.000Z","data":{"id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96","type":"bundle","status":"completed","amount":700,"esim_price":0,"package_price":700,"currency":"EUR","reference":"BOOKING-1042","esim_id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","created_at":"2026-10-01T09:30:12.000Z"}}]},"PackageEvent":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"enum":["package.activated","package.usage","package.expired"]},"data":{"type":"object","required":["esim_id","iccid","package"],"properties":{"esim_id":{"type":"string","format":"uuid"},"iccid":{"type":"string"},"package":{"type":"object","required":["id","package_id","name"],"properties":{"id":{"type":["string","null"],"format":"uuid"},"package_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]}}},"percent_used":{"type":"integer","description":"package.usage: rounded down to the nearest 10."},"expires_at":{"type":["string","null"],"format":"date-time","description":"package.activated: when its validity ends."},"data_used_up":{"type":"boolean","description":"package.expired: true when the data ran out first."}}}}}],"examples":[{"id":"7a2d9e4b-1c6f-4b3a-8d5e-0f9c2b7a6e13","type":"package.usage","created_at":"2026-10-04T16:45:02.000Z","data":{"esim_id":"c2a7e9d4-6b1f-4f3a-8e5d-0a9b7c6d5e41","iccid":"8910390000012345678","package":{"id":"1d8f6a3b-7e2c-4b9a-a5d4-3f1e0c7b9a28","package_id":"5f0c1a52-8f3e-4c1e-9b7a-2d6e4f8a1c03","name":"One Kosovo 5GB"},"percent_used":80}}]},"BalanceEvent":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"enum":["balance.low"]},"data":{"type":"object","required":["balance","overdraft_limit","available","threshold","currency"],"properties":{"balance":{"type":"integer"},"overdraft_limit":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"available":{"type":"integer"},"threshold":{"type":"integer","minimum":0,"description":"Minor units (cents) of `currency`."},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."},"order_id":{"type":"string","format":"uuid"}}}}}],"examples":[{"id":"e5c8b1f4-9a3d-4e7b-a2c6-8d1f0b9e3a57","type":"balance.low","created_at":"2026-10-01T09:30:12.000Z","data":{"balance":-2500,"overdraft_limit":10000,"available":7500,"threshold":10000,"currency":"EUR","order_id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96"}}]},"CommissionEvent":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"enum":["commission.created","commission.updated"]},"data":{"type":"object","required":["commission_id","order_id","source","code","sub_id","sale_amount","sale_currency","commission","change","currency","reason","credited_at","changed_at"],"properties":{"commission_id":{"type":"string","format":"uuid"},"order_id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["code","link"],"description":"How the sale came to you: your affiliate code, or your link."},"code":{"type":"string","description":"The code, or the link's code, as it was when the sale was credited."},"sub_id":{"type":["string","null"],"description":"Your own click id, the `aff_sub` your link carried; null when it had none."},"sale_amount":{"type":"integer","minimum":0,"description":"What the customer paid, after discounts, in minor units of `sale_currency`."},"sale_currency":{"type":"string","description":"The currency the customer paid in."},"commission":{"type":"integer","minimum":0,"description":"What the sale earns you now, in minor units of `currency`."},"change":{"type":"integer","description":"What this event changed, in minor units of `currency`: positive is earned, negative taken back."},"currency":{"type":"string","enum":["EUR","USD"],"description":"Your account's currency: all your prices, orders and your balance are in it."},"reason":{"type":"string","enum":["sale","reinstated","refund","partial_refund","fraud","chargeback","held","self_referral","withheld","paid_by_admin"],"description":"Why the commission stands where it does: `sale` and `reinstated` pay; `refund` and `partial_refund` take back what your refund terms say; `fraud`, `chargeback` and `held` (an order under review) earn nothing; `self_referral` is a purchase by your own team; `withheld` and `paid_by_admin` are onesim's decision on the order."},"credited_at":{"type":"string","format":"date-time"},"changed_at":{"type":"string","format":"date-time"}}}}}],"examples":[{"id":"4f9a2c7e-1b3d-4e8a-9f6c-2d5b8e1a7c30","type":"commission.updated","created_at":"2026-10-06T14:20:05.000Z","data":{"commission_id":"8c1e5a3f-7b2d-4f9e-a6c4-3e0d9b7f1a52","order_id":"9e4b2f71-3c8a-4d6e-b1f0-7a5c2e8d4b96","source":"link","code":"esimdb","sub_id":"clk_8f2a91bc","sale_amount":2000,"sale_currency":"EUR","commission":0,"change":-330,"currency":"USD","reason":"refund","credited_at":"2026-10-01T09:30:12.000Z","changed_at":"2026-10-06T14:20:05.000Z"}}]},"PingEvent":{"allOf":[{"$ref":"#/components/schemas/Event"},{"type":"object","properties":{"type":{"enum":["ping"]}}}]}}}}