# onesim eSIM API > onesim's eSIM API: a REST API and a TypeScript SDK with which businesses buy onesim eSIMs and data packages and sell them to their customers under their own brand. onesim is an eSIM provider. The partner API lets a business's servers buy blank eSIMs, data packages and bundles from its partner balance, at the prices in its partner agreement, hand each eSIM's activation code to its customer, follow the eSIM's usage and receive signed webhooks. It is for businesses with a onesim partner account and the API enabled. There is no sandbox: every key is live and buys real eSIMs. - Base URL: `https://api.onesim.global/v1`, JSON over HTTPS. - Authentication: `Authorization: Bearer osk_live_…`. Keys are created in the partner platform under Developers, shown once, and belong on servers only. - `POST /v1/orders` answers `201` when the order is complete, or `202` with `status: "pending"`: poll `GET /v1/orders/{id}` until it is `completed` or `failed` (a failed order is refunded). - Every `POST /v1/orders` sends an `Idempotency-Key` header, a new UUID per purchase and the same on every retry of it, so a retry never buys twice. The TypeScript SDK is `@onesim.global/sdk` (MIT, no dependencies; Node.js 20 or later, Deno, Bun, Cloudflare Workers): `npm install @onesim.global/sdk`. ```ts import OnesimClient from '@onesim.global/sdk'; const onesim = new OnesimClient(); // reads ONESIM_API_KEY const { data: packages } = await onesim.packages.list(); const order = await onesim.orders.createAndPoll({ type: 'bundle', package_id: packages[0].id }, { idempotencyKey: booking.orderKey }); if (order.status === 'completed') showQrCode(order.esim.activation_code); ``` Other languages call the API over HTTPS; the reference shows a cURL sample for every endpoint. ## Docs - [API reference](https://api.onesim.global/docs/): the guide (getting started, orders and `202`, idempotency, installing eSIMs, errors, limits, webhooks) and every endpoint with TypeScript and cURL samples - [OpenAPI contract](https://api.onesim.global/v1/openapi.json): the same as OpenAPI 3.1 JSON, readable without a key - [TypeScript SDK](https://www.npmjs.com/package/@onesim.global/sdk): `@onesim.global/sdk` on npm, with its README - [Agent skill: onesim-partner-api](https://onesim.global/.well-known/agent-skills/onesim-partner-api/SKILL.md): instructions for coding agents that write server code against this API - [Technology partners](https://onesim.global/partners/technology): how a business gets API access ## Optional - [onesim.global llms.txt](https://onesim.global/llms.txt): onesim for travellers, the plan feed, the roaming index and the partner program - [API catalog](https://onesim.global/.well-known/api-catalog): every API onesim offers machines (RFC 9727)