Developer reference · v1
Reseller eSIM API
Issue prepaid travel eSIMs, deliver private installation links, and refill an existing profile from your own service.
Make your first request
Generate a key in the partner workspace and store it as RESELLER_KEY on your server. Check your balance first: this call does not buy a plan or change your wallet.
curl --fail-with-body \
'https://www.esimrefill.com/api/v1/balance' \
-H "Authorization: Bearer $RESELLER_KEY"Example response · HTTP 200
{
"data": {
"currency": "USD",
"balance_cents": 1000,
"discount_bps": 1500
}
}The example wallet has $10.00 available and a 15% discount. Your account returns its own values.
From offer to installation
GET /packages— choose an available offer and keep its ID.POST /orders— buy one plan using that ID and a saved retry key. This spends wallet funds.GET /orders/{orderId}— after a completion event or a polling delay, check fulfillment and deliver the private installation link.
Authentication and pricing
An administrator must approve your verified business account. Generate a key in the partner workspace. Send it as an Authorization: Bearer header from your backend only. Rotation immediately invalidates the previous key.
Fund your existing wallet before buying. Adding $10 credits $10. At 15% off, a $10 new plan or eligible $10 refill costs $8.50. There is no issuance fee. A plan below supplier cost is unavailable unless expressly permitted by an administrator. Prices are set at reservation, in USD cents, rounded half up after the discount. A quote is not a reservation.
Purchase to installation
// Server-side JavaScript. Store the key in your own secret manager.
const base = 'https://www.esimrefill.com/api/v1';
const headers = { Authorization: 'Bearer ' + process.env.RESELLER_KEY };
async function call(path, options = {}) {
const res = await fetch(base + path, { ...options,
headers: { ...headers, ...options.headers }, cache: 'no-store' });
const body = await res.json();
if (!res.ok) throw new Error(body.error.code);
return body.data;
}
const wallet = await call('/balance');
const offers = await call('/packages?destination=US&limit=100');
const plan = offers.find(p => p.available &&
p.pricing.reseller_cents <= wallet.balance_cents);
if (!plan) throw new Error('No eligible, funded offer');
// Your app supplies sale.retryKey: a UUID generated once and saved
// with this sale before the first attempt. Reuse it on every retry.
const retryKey = sale.retryKey;
let order = await call('/orders', { method: 'POST',
headers: { 'Content-Type': 'application/json', 'Idempotency-Key': retryKey },
body: JSON.stringify({ package_id: plan.id }) });
// Keep order.id. On order.completed (or a bounded polling schedule):
order = await call('/orders/' + order.id);
if (order.status === 'fulfilled') {
const privateLink = order.esim?.installation?.anonymous_url;
if (typeof privateLink === 'string' && privateLink.length > 0) {
// Deliver privately to the intended customer; never log the URL.
} else {
// No usable link: hold delivery and check the existing profile.
// Do not purchase a replacement or rotate a revoked link automatically.
}
}
// For a later refill, GET /esims/{esimId}/topups. Select an available
// offer and POST { package_id: offer.id } to the same path with a NEW
// persisted Idempotency-Key for that refill.A successful reservation returns 202 while paid or provisioning. Use the same UUID and identical package and target after a network error. A replay returns the original order and price; changed inputs return 409. An unknown supplier outcome remains pending, not refunded or reissued automatically.
Endpoints
Base path: /api/v1. Lists accept page (from 1) and limit (1–100, default 25); responses contain data, page, limit and total.
/destinationsList countries and regions/packagesBrowse available package offers/packages/{packageId}Read a current offer with network coverage/balanceRead available prepaid balance/ordersList reseller orders/ordersPurchase one eSIM/esimsList issued eSIM references/orders/{orderId}Read order, price snapshot and installation details/esims/{esimId}Read owned profile and installation credentials/esims/{esimId}/usageRead the latest available usage measurement/esims/{esimId}/topupsList eligible refill offers/esims/{esimId}/topupsPurchase one eligible refill/esims/{esimId}/installationRotate private installation link/esims/{esimId}/installationRevoke private installation link/webhookRead endpoint configuration/webhookSet endpoint and rotate signing secret/webhookDisable webhook endpoint/webhook/testQueue a signed test event/webhook/deliveriesList delivery outcomes/webhook/deliveries/{eventId}/attemptsList individual attempts/webhook/deliveries/{eventId}/retryRetry a failed deliveryWebhook delivery
Configure a publicly resolvable IPv4 HTTPS hostname, port 443, without redirects, credentials, fragments or a query string. Saving it rotates the signing secret; save the new secret immediately. Undelivered events for the previous endpoint are cancelled. Deliveries are at least once and may arrive out of order. Fetch the current order or eSIM rather than inferring it from arrival order.
Verify X-Webhook-Signature against X-Webhook-Timestamp and the exact body. The UTF-8 signing key is the secret as issued, not a base64-decoded value.
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(rawBytes, timestamp, signature, secret) {
if (!/^\d{10}$/.test(timestamp) ||
Math.abs(Date.now()/1000 - Number(timestamp)) > 300 ||
!/^v1=[0-9a-f]{64}$/.test(signature)) return false;
const expected = createHmac('sha256', secret)
.update(timestamp + '.').update(rawBytes).digest();
return timingSafeEqual(expected, Buffer.from(signature.slice(3), 'hex'));
}
// Verify the raw bytes BEFORE parsing JSON. Store event.id under a unique
// constraint with your work item, then return 2xx. Ignore duplicate IDs.Events include webhook.test, order.completed, order.failed, esim.issued, esim.status_changed, esim.activated, esim.expired, esim.low_data (25% remaining), esim.exhausted, topup.completed and topup.failed. Availability depends on verified provider observations. Payloads contain IDs, event time and relevant state, never installation credentials.
Return 2xx after durable acceptance. Failed attempts retry after 30 seconds with exponential backoff capped at one hour, up to eight attempts, on worker ticks. Failed deliveries can be retried manually using the same event ID.
Limits and errors
Default 60 requests per minute per account; administrators can set 1–100. A maximum of three new wallet orders per rolling minute applies across store and API. Refill discovery and usage refresh each allow 12 calls per minute. Usage can lag and missing measurements are null, never assumed zero.
- 400 / 413 / 415
- Invalid JSON, unknown purchase fields, invalid UUID, oversized body, or wrong content type.
- 401 / 403
- Invalid, revoked or disabled key; access denied.
- 402 insufficient_balance
- Fund the wallet; no order was placed.
- 404 not_found
- Resource not available to this partner.
- 409
- Idempotency conflict, ineligible plan, pending refill, or non-retryable event.
- 422 invalid_destination
- Webhook URL cannot be used.
- 429 rate_limited
- Respect Retry-After and back off.
- 503 service_unavailable
- Temporary failure. Check the order and reuse the same key.
Private installation URLs use a fragment so the token does not enter HTTP access logs. Share privately and revoke as needed. Revoking a link does not uninstall a profile or invalidate credentials already copied. Device support for one-tap install varies; QR and manual setup remain available.
