首頁 / API

開發人員

HTTP API

基礎網址 https://osim.live/api/v1 — 旅行 eSIM。在控制台建立金鑰,再用 Bearer 呼叫。

API 價格

oSim API 3.0.3

Travel eSIM and SMS verification API for oSim. Create a key in the dashboard, then send it as `Authorization: Bearer osim_…`. Successful responses use `{ success: true, data }`. Errors use `{ success: false, error }`. Money fields named `*Cents` are USD cents. Catalog `priceUsd` is US dollars. Rate limits: 120 requests/min per key, 15 purchases/rents/top-ups per minute per account, 60 public catalog calls/min per IP. Over the limit you get `429` with a `Retry-After` header.

基礎 URL: https://osim.live/api/v1

Authorization: Bearer osim_…

openapi.json開啟控制台金鑰

GET/api/v1

API index

Public list of the current endpoints. No key required.

Public

200 Index

{
  "success": true,
  "data": {
    "name": "oSim API",
    "version": "1",
    "openapi": "https://osim.live/api/v1/openapi.json"
  }
}
GET/api/v1/me

Account and balance

Bearer osim_…

200 Key owner

{
  "success": true,
  "data": {
    "id": "cm…",
    "email": "[email protected]",
    "name": "Ada",
    "balanceCents": 2500,
    "balance": "$25.00"
  }
}

401 Missing or invalid key

{
  "success": false,
  "error": "Unauthorized"
}
GET/api/v1/esim

Catalog or your eSIM orders

`catalog=1` is public and returns enabled travel eSIM plans. Without it, the call lists the key owner's orders (newest 50). `id` refreshes and returns one order.

Catalog is public · orders need a key

FieldInTypeRequiredDescription
catalogquery1noPublic catalog. No key required.
idquerystringnoOne order id. Requires a key. Refreshes the profile from the provider.

200 Catalog array, order array, or one order inside `data`

{
  "success": true,
  "data": [
    {
      "slug": "eu-35-pv0q6pz7g",
      "packageCode": "eu-35-pv0q6pz7g",
      "name": "Europe (35 areas) 5GB 30Days",
      "country": "Europe",
      "dataGb": 5,
      "validityDays": 30,
      "priceUsd": 5.46,
      "planType": "fixed"
    }
  ]
}
{
  "success": true,
  "data": [
    {
      "id": "cm…",
      "status": "READY",
      "sellCents": 546
    }
  ]
}

401 Order list or single order without a key

{
  "success": false,
  "error": "Unauthorized"
}
POST/api/v1/esim

Purchase, refresh, rename or top up

Purchase debits `priceUsd` converted to cents from the key owner's balance and returns the eSIM order. Top-up debits `sellCents` of the chosen option.

Bearer osim_…

Request

// Buy a plan
{
  "action": "purchase",
  "packageCode": "eu-35-pv0q6pz7g"
}
// Refresh profile and usage
{
  "action": "refresh",
  "id": "cm…"
}
// Set a label
{
  "action": "rename",
  "id": "cm…",
  "label": "Europe trip"
}
// List top-ups for an active line
{
  "action": "topup-options",
  "id": "cm…"
}
// Apply a top-up
{
  "action": "topup",
  "id": "cm…",
  "packageCode": "TOPUP_…"
}

200 Order, or an array of top-up options when action is topup-options

{
  "success": true,
  "data": {
    "id": "cm…",
    "status": "READY",
    "sellCents": 546,
    "supportTopUp": true
  }
}
{
  "success": true,
  "data": [
    {
      "packageCode": "TOPUP_…",
      "name": "1 GB",
      "dataBytes": 1073741824,
      "durationDays": 7,
      "sellCents": 160
    }
  ]
}

400 Unknown action, missing package, or provider error

{
  "success": false,
  "error": "Package not found"
}

401 Missing or invalid key

{
  "success": false,
  "error": "Unauthorized"
}
GET/api/v1/sms

SMS catalog or your SMS orders

`catalog=1` is public and returns services with per-country offers (`offers[].id` is the `priceId`) and the allowed rent hours. Without it, the call lists the key owner's SMS activations and rents (newest 50).

Catalog is public · orders need a key

FieldInTypeRequiredDescription
catalogquery1noPublic catalog. No key required.

200 Catalog object or an array of SMS orders inside `data`

{
  "success": true,
  "data": {
    "services": [
      {
        "slug": "whatsapp",
        "service": "WhatsApp",
        "code": "wa",
        "countries": [
          {
            "code": "ID",
            "name": "Indonesia",
            "countryId": 6,
            "priceUsd": 0.45,
            "successRate": 92,
            "offers": [
              {
                "id": "cm…",
                "server": 1,
                "priceUsd": 0.45,
                "stockCount": 1200,
                "successRate": 92
              }
            ]
          }
        ]
      }
    ],
    "rentHours": [
      24,
      72,
      168,
      336
    ]
  }
}
{
  "success": true,
  "data": [
    {
      "id": "cm…",
      "kind": "ACTIVATION",
      "status": "CODE_RECEIVED",
      "phoneNumber": "6281…",
      "smsCode": "123456",
      "sellCents": 45
    }
  ]
}

401 Order list without a key

{
  "success": false,
  "error": "Unauthorized"
}
POST/api/v1/sms

Buy a number, rent, extend, poll, cancel or complete

`purchase` debits the offer price from the balance and returns a number; poll with `status` every few seconds until `smsCode` is set. Without a code you can `cancel` after 5 minutes for a full refund; unanswered activations are refunded automatically after 20 minutes. Once a code arrives the order cannot be refunded; call `complete` when done. `rent` keeps the number for `hours` (not every country offers every duration) and collects every SMS in `smsCodes`; a rent can be cancelled after 2 minutes, and cancelling within 20 minutes with no SMS (and no extension) refunds it. `extendOptions` lists the extra hours and prices (cents) for a live rent; `extend` adds `hours` and debits that price (send the price you showed as `expectedCents`; a higher price is refused with `priceCents`).

Bearer osim_…

Request

// Buy a number
{
  "action": "purchase",
  "service": "whatsapp",
  "countryId": 6,
  "priceId": "cm…"
}
// Rent a number for 24 hours
{
  "action": "rent",
  "service": "telegram",
  "countryId": 6,
  "hours": 24
}
// Extend a rent by one day
{
  "action": "extend",
  "id": "cm…",
  "hours": 24,
  "expectedCents": 860
}
// Poll for the code
{
  "action": "status",
  "id": "cm…"
}
// Cancel and refund (no code, after 5 minutes)
{
  "action": "cancel",
  "id": "cm…"
}

200 The SMS order

{
  "success": true,
  "data": {
    "id": "cm…",
    "kind": "ACTIVATION",
    "serviceName": "WhatsApp",
    "countryName": "Indonesia",
    "phoneNumber": "6281…",
    "smsCode": null,
    "smsCodes": [],
    "status": "WAIT_CODE",
    "sellCents": 45,
    "expiresAt": "2026-10-29T13:20:00.000Z"
  }
}

400 Unknown action, no stock, insufficient balance or a cancel that is not allowed yet

{
  "success": false,
  "error": "Insufficient balance"
}

401 Missing or invalid key

{
  "success": false,
  "error": "Unauthorized"
}