{
  "info": {
    "_postman_id": "5b0f6c1e-3d7a-4c8e-9a21-7e1d5c3b9a40",
    "name": "eSIMCenter Partner API v3",
    "description": "Partner API v3 for eSIMCenter. Import this collection together with one environment file: `esimcenter-sandbox.postman_environment.json` (https://sandbox-api.esimcenter.com/v3, esk_test_ keys) or `esimcenter-live.postman_environment.json` (https://api.esimcenter.com/v3, esk_ keys). Set the `apiKey` variable of the environment and send. The key travels in the `X-API-Key` header (collection-level authorization). A live key on the sandbox host answers 401 live_key_on_sandbox_host; a sandbox key on the live host answers 401 sandbox_key_on_live_host.\n\nBranch on the `error` machine code, never on `title`. Full guide: https://esimcenter.com/pages/api",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-API-Key", "type": "string" },
      { "key": "value", "value": "{{apiKey}}", "type": "string" },
      { "key": "in", "value": "header", "type": "string" }
    ]
  },
  "variable": [
    { "key": "productId", "value": "esc_0dde4d49725f9e60", "description": "Product alias from /catalog/products." },
    { "key": "orderId", "value": "", "description": "Filled by the Buy an eSIM request." },
    { "key": "iccid", "value": "", "description": "ICCID from the esim block of /order/detail/{id}." }
  ],
  "item": [
    {
      "name": "Catalog",
      "item": [
        {
          "name": "List countries",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/catalog/countries", "host": ["{{baseUrl}}"], "path": ["catalog", "countries"] },
            "description": "Every destination we sell, one row per country code."
          }
        },
        {
          "name": "List products of a country",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/catalog/products?country=tr&sort=price&order=asc&limit=20",
              "host": ["{{baseUrl}}"],
              "path": ["catalog", "products"],
              "query": [
                { "key": "country", "value": "tr", "description": "Required. ISO code or region slug." },
                { "key": "sort", "value": "price", "description": "price | price_per_gb | data | day | title" },
                { "key": "order", "value": "asc" },
                { "key": "limit", "value": "20", "description": "1 to 500." },
                { "key": "offset", "value": "0", "disabled": true },
                { "key": "unlimited", "value": "0", "disabled": true },
                { "key": "network_type", "value": "5G", "disabled": true },
                { "key": "min_data_mb", "value": "3072", "disabled": true },
                { "key": "max_data_mb", "value": "20480", "disabled": true },
                { "key": "min_day", "value": "7", "disabled": true },
                { "key": "max_day", "value": "30", "disabled": true },
                { "key": "min_price", "value": "1", "disabled": true },
                { "key": "max_price", "value": "15", "disabled": true },
                { "key": "include_small", "value": "1", "disabled": true },
                { "key": "all_variants", "value": "1", "disabled": true },
                { "key": "usage_metered", "value": "1", "disabled": true }
              ]
            },
            "description": "The plans of one destination, same set and order as the website country page. Enable the disabled query rows to filter."
          }
        },
        {
          "name": "Get one product",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/catalog/product/{{productId}}", "host": ["{{baseUrl}}"], "path": ["catalog", "product", "{{productId}}"] },
            "description": "One plan by its opaque alias (esc_ + 16 hex)."
          }
        }
      ]
    },
    {
      "name": "Purchase",
      "item": [
        {
          "name": "Buy an eSIM",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "var body = pm.response.json();",
                  "if (body && body.order_id) { pm.collectionVariables.set('orderId', String(body.order_id)); }"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/x-www-form-urlencoded" }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "product_id", "value": "{{productId}}", "description": "Required." },
                { "key": "idempotency_key", "value": "{{$guid}}", "description": "Your own unique string per intended purchase. Reuse the same value only to replay the same purchase." },
                { "key": "sandbox_scenario", "value": "success", "description": "Sandbox keys only: success | deferred | failed. Live keys ignore it." },
                { "key": "sandbox_usage", "value": "not_active", "description": "Sandbox keys only: not_active | active | depleted | expired. Shapes what /order/usage/{iccid} reports." }
              ]
            },
            "url": { "raw": "{{baseUrl}}/purchase/buy", "host": ["{{baseUrl}}"], "path": ["purchase", "buy"] },
            "description": "Live key: spends money. Sandbox key: creates a fake order and moves no money. 200 delivered, 202 deferred (paid, do not buy again), 200 failed. The activation payload is read from /order/detail/{id}, never from this response."
          }
        }
      ]
    },
    {
      "name": "Orders",
      "item": [
        {
          "name": "List orders",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/order/get?limit=10&start=1",
              "host": ["{{baseUrl}}"],
              "path": ["order", "get"],
              "query": [
                { "key": "limit", "value": "10" },
                { "key": "start", "value": "1", "description": "1-based page." }
              ]
            },
            "description": "Your orders, newest first, under the singular key `order`."
          }
        },
        {
          "name": "Get order detail",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/order/detail/{{orderId}}", "host": ["{{baseUrl}}"], "path": ["order", "detail", "{{orderId}}"] },
            "description": "One order with the esim activation block (lpa, smdpAddress, activationCode). Treat it as a secret."
          }
        },
        {
          "name": "Get usage by ICCID",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/order/usage/{{iccid}}", "host": ["{{baseUrl}}"], "path": ["order", "usage", "{{iccid}}"] },
            "description": "Remaining data of an eSIM. 404 usage_not_available is normal before the eSIM is installed."
          }
        }
      ]
    },
    {
      "name": "Account",
      "item": [
        {
          "name": "Get balance",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/account/balance", "host": ["{{baseUrl}}"], "path": ["account", "balance"] },
            "description": "Spendable balance in USD. Sandbox keys always see 1000.00."
          }
        },
        {
          "name": "List wallet history",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/account/history?limit=50&start=1",
              "host": ["{{baseUrl}}"],
              "path": ["account", "history"],
              "query": [
                { "key": "limit", "value": "50", "description": "Up to 500." },
                { "key": "start", "value": "1" }
              ]
            },
            "description": "Wallet movements, newest first."
          }
        },
        {
          "name": "Get statement",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/account/statement?limit=50&start=1",
              "host": ["{{baseUrl}}"],
              "path": ["account", "statement"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "start", "value": "1" },
                { "key": "type", "value": "", "disabled": true }
              ]
            },
            "description": "Billing mode, credit limit, outstanding and available credit."
          }
        },
        {
          "name": "List revenue share",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/account/profitshare?limit=50&start=1",
              "host": ["{{baseUrl}}"],
              "path": ["account", "profitshare"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "start", "value": "1" },
                { "key": "status", "value": "", "disabled": true }
              ]
            },
            "description": "Revenue share on unused data, with totals."
          }
        },
        {
          "name": "Get pricing summary",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/account/pricing", "host": ["{{baseUrl}}"], "path": ["account", "pricing"] },
            "description": "Your margin share, cap, active rule count and measured average discount."
          }
        },
        {
          "name": "Start top-up",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/x-www-form-urlencoded" }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "amount", "value": "250", "description": "USD credited to the wallet." }
              ]
            },
            "url": { "raw": "{{baseUrl}}/account/topup", "host": ["{{baseUrl}}"], "path": ["account", "topup"] },
            "description": "Live key: Stripe payment intent (client_secret, payment_key). Sandbox key: fake intent (sbx_topup_..., sbx_secret_..., requires_confirmation)."
          }
        },
        {
          "name": "Confirm top-up",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/x-www-form-urlencoded" }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "payment_key", "value": "", "description": "The payment_key returned by Start top-up." }
              ]
            },
            "url": { "raw": "{{baseUrl}}/account/topupConfirm", "host": ["{{baseUrl}}"], "path": ["account", "topupConfirm"] },
            "description": "Idempotent: confirming twice credits once. Sandbox key: succeeded, no wallet touched."
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "List subscriptions",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/webhook/list", "host": ["{{baseUrl}}"], "path": ["webhook", "list"] },
            "description": "Your subscriptions of the key's own mode. The secret is never returned."
          }
        },
        {
          "name": "List deliveries",
          "request": {
            "method": "GET",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": {
              "raw": "{{baseUrl}}/webhook/deliveries?limit=50",
              "host": ["{{baseUrl}}"],
              "path": ["webhook", "deliveries"],
              "query": [
                { "key": "limit", "value": "50", "description": "1 to 200." },
                { "key": "id", "value": "", "description": "Single delivery with the exact body sent.", "disabled": true },
                { "key": "status", "value": "", "disabled": true },
                { "key": "event", "value": "", "disabled": true },
                { "key": "subscription_id", "value": "", "disabled": true }
              ]
            },
            "description": "Delivery log. Set `id` for one delivery with its payload and signature rule."
          }
        },
        {
          "name": "Send test event",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/x-www-form-urlencoded" }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "subscription_id", "value": "", "description": "Optional. Omit to target all active subscriptions.", "disabled": true }
              ]
            },
            "url": { "raw": "{{baseUrl}}/webhook/test", "host": ["{{baseUrl}}"], "path": ["webhook", "test"] },
            "description": "Queues a signed order.test event; read the result from List deliveries."
          }
        },
        {
          "name": "Probe an address",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/x-www-form-urlencoded" }
            ],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                { "key": "url", "value": "https://example.com/webhooks/esimcenter", "description": "Required. https address to test." },
                { "key": "event", "value": "order.test", "description": "Event to simulate." }
              ]
            },
            "url": { "raw": "{{baseUrl}}/webhook/probe", "host": ["{{baseUrl}}"], "path": ["webhook", "probe"] },
            "description": "One signed request right now, nothing saved. The response returns a single-use probe_secret so you can test your signature check."
          }
        }
      ]
    },
    {
      "name": "Sandbox",
      "item": [
        {
          "name": "Reset sandbox orders",
          "request": {
            "method": "POST",
            "header": [{ "key": "Accept", "value": "application/json" }],
            "url": { "raw": "{{baseUrl}}/account/sandboxReset", "host": ["{{baseUrl}}"], "path": ["account", "sandboxReset"] },
            "description": "Sandbox keys only: deletes your sandbox orders and delivery records. A live key answers 400 sandbox_only_action and nothing is touched."
          }
        }
      ]
    }
  ]
}
