Selling through the API

The Kili API

Sell Kili eSIMs inside your own website, app or booking flow.

The Kili API lets a wholesale agent sell eSIMs from its own platform. You find a plan, buy it from your wallet, and hand the activation code to your customer however you like: on your confirmation page, in your app, in your own email.

You are the seller. You set the price, you take your customer's payment, and you answer their questions. Kili never emails, texts or shows its name to your customer, and an API order carries no customer details at all, only your own reference. See API terms.

The machine-readable description is at https://www.usekili.com/api/v1/openapi.json, and a Postman collection is at https://www.usekili.com/api/v1/postman.json.

Getting a key

Open Developers → API keys in your dashboard. Owners and managers can make keys; a team member with the Developer role can make test keys.

  • Test keys start kili_test_. They reach the sandbox: fake eSIMs, a test balance of 1,000.00 in your currency, and nothing real is ever bought. Any wholesale agent can make one.
  • Live keys start kili_live_. They spend your wallet's credit. Your first live key needs your first top-up, and asks you to accept the API terms.

A key is shown once, when it is made. Kili keeps only a fingerprint of it, so a lost key cannot be shown again: revoke it and make another. A key can be full access (buys eSIMs, manages webhooks) or read only (catalogue, balance, orders and eSIMs).

Send it on every request:

curl https://www.usekili.com/api/v1/balance \
  -H "Authorization: Bearer $KILI_KEY"

Keep keys on your server. A key in a web page or a mobile app can be read by anyone who has it.

Quickstart

Find a plan, then buy it.

curl "https://www.usekili.com/api/v1/catalogue?country=SA" \
  -H "Authorization: Bearer $KILI_KEY"
curl https://www.usekili.com/api/v1/orders \
  -H "Authorization: Bearer $KILI_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "plan": "sa-3gb-30d", "quantity": 1,
        "reference": "BK-2231", "max_cost_minor": 1200 }'

The answer holds each eSIM's lpa (the activation code), its ICCID and a qr_url. Show your customer the QR, or the code for manual entry. Treat the activation code like a password: whoever has it can install the eSIM.

Developers → Overview has this quickstart in cURL, Node, Python and PHP, with your own currency's amounts filled in.

Money

Every amount is an integer in minor units with its currency beside it: "cost_minor": 1200, "currency": "USD" is $12.00. Ethiopian agents work in birr: "cost_minor": 300000, "currency": "ETB" is 3,000.00 birr.

The catalogue shows your cost: what your wallet pays. What you charge your customer is up to you. An order is charged at the cost of the moment, and your wallet never goes below zero.

Catalogue

GET /catalogue lists the plans on sale to you. Filter with country (two letters, like SA; regional plans that cover it are included), region, direction (inbound for visitors to Ethiopia, outbound for people travelling abroad) and unlimited. GET /catalogue/{code} returns one plan.

A plan's code never changes, so you can store it. Plans can come off sale; an order for one answers 404 not_found.

Ordering

POST /orders buys eSIMs.

Field
planThe plan's code. Required.
quantity1 to 50. One by default.
referenceYour own id for the sale, up to 120 characters. Shown in your dashboard and searchable.
max_cost_minorThe most you will pay per eSIM. If the price is higher, the order is refused with 409 price_changed and nothing is charged.

Every order needs an Idempotency-Key header: a unique value per booking, stored with it. If your request times out, send it again with the same key and the same body: you get the same order back, and Kili never buys twice. A different body with a used key answers 409 idempotency_mismatch.

How an order answers

  • 201, completed: every eSIM is ready, and the answer holds them.
  • 201, failed: no eSIM could be made. Nothing was charged; failure_reason says why.
  • 202, processing: the network took longer than 20 seconds. The order is still being made and you have been charged. Do not sell it again. Wait for the order.completed or order.failed webhook, or poll GET /orders/{id}. If it fails, the charge comes back by itself.

An order can later become refunded if Kili support approves a refund (see "Refunds").

Reading orders and eSIMs

  • GET /orders lists your API orders, newest first. Filter with status, reference and created_after. Lists leave out activation codes.
  • GET /orders/{id} returns one order with its eSIMs and their activation codes.
  • GET /esims/{iccid} returns an eSIM's status (ready, installed, active, depleted, expired, cancelled), whether it is installed, its expiry, and the data used. The usage is as the network last reported it; usage_updated_at says when.
  • GET /esims/{iccid}/qr.png returns the QR code as a 512 × 512 PNG. It needs your key, so fetch it on your server and pass the image on.

Lists are paged: up to 100 per page with limit, and next_cursor goes in cursor for the next page.

Webhooks

Kili tells your server when things happen. Add endpoints on Developers → Webhooks or with POST /webhook-endpoints. Each endpoint gets a signing secret, shown once.

EventWhen
order.completedEvery eSIM in an order is ready
order.failedAn order ended without an eSIM (nothing charged)
esim.status_changedInstalled, activated or expired
esim.usage_threshold80% and 100% of the data used
balance.lowYour wallet dropped below your low-credit threshold

Every event has an id, a type, livemode, api_version, created and data.

Checking the signature

Each delivery carries Kili-Signature: t=1760870400,v1=5f2b…. v1 is the HMAC-SHA256, in hex, of the timestamp, a full stop and the raw body, keyed with your endpoint's secret. For 24 hours after you roll a secret, deliveries carry two v1 values: one for each secret.

import crypto from "node:crypto";

// rawBody: the request body exactly as received, not parsed JSON
export function verifyKili(rawBody, header, secret) {
  const parts = header.split(",").map((p) => p.split("="));
  const t = Number(parts.find(([k]) => k === "t")?.[1]);
  const sigs = parts.filter(([k]) => k === "v1").map(([, v]) => v);
  if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false;
  const mac = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return sigs.some((v) => v.length === mac.length &&
    crypto.timingSafeEqual(Buffer.from(mac), Buffer.from(v)));
}

Reject anything older than five minutes, and skip event ids you have already handled.

Retries

Answer with any 2xx within 10 seconds. Otherwise Kili retries after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours. An endpoint that has failed for 24 hours is switched off and your owner is emailed; switch it back on from Developers → Webhooks, where you can also resend any event.

The sandbox

Test keys never touch the real network or your wallet. Test orders make fake eSIMs that you can move through their life on Developers → Sandbox (install, activate, use data, expire), each step sending the webhook it would in real life.

Three plan codes force an outcome:

PlanWhat happens
kili-test-failAnswers 201 with status failed, nothing charged, then order.failed.
kili-test-202Answers 202; the order completes 30 seconds later with order.completed.
kili-test-slowTakes 25 seconds, longer than the 20-second wait. Test your timeouts and retries.

The test balance starts at 1,000.00 in your currency and can be reset from the Sandbox page.

Limits

Reads600 a minute per key
Orders60 a minute per key, 300 a minute per account
eSIMs per order50
eSIMs a day50 a day for the first 30 days after your first live key, then 500. Resets at midnight Addis Ababa time.

Over a rate limit you get 429 rate_limited with a Retry-After header. Over a daily limit you get 422 limit_reached. Your Kili manager can raise them.

Refunds

When an order fails, the charge comes back by itself. For anything else, open the order in Orders, press Request a refund and say why. Kili support decides, and you see the answer on the order. An approved refund goes back to your wallet, never to your customer: what you do for your customer is up to you.

Every response

Every response carries Kili-Version (today 2026-10-19) and Kili-Request-Id. Errors look the same everywhere:

{
  "error": {
    "code": "insufficient_balance",
    "message": "Your wallet had $8.00 and the order cost $12.00. Nothing was charged.",
    "request_id": "req_6Yc2m1Lx8Rz0"
  }
}

Every code, and what to do about it, is in API errors. Every request is in Developers → Request logs for 30 days, with activation codes masked.