Partner API reference
All endpoints return JSON. You never send a price - you only say what you want to buy, and the server always calculates the price itself, so it can't be faked or tampered with.
Base URL:
https://buyukesim.com/api/v1Authentication
Send your API key as a Bearer token on every request below.
Note: adding balance is a website-only action (via your dashboard Magic Code), not part of this API - your API key cannot create or fund top-ups.
Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxxAccount
/api/v1/balanceAccount Balance
What is left on your prepaid account. Every order already returns the same figure in its own balance block, so you never have to call this just to see what a purchase cost - this endpoint is for the checks that happen away from a purchase: a top-up alarm, a dashboard tile, a batch job that refuses to start what it cannot pay for.
curl "https://buyukesim.com/api/v1/balance" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"balance_usd": 477.5,
"currency": "USD",
"discount_pct": 10,
"discounts": { "uk_number": 10, "travel_data": 10, "vpn": 10 },
"account": {
"name": "Acme Telecom",
"status": "active",
"api_key_prefix": "buk_live_9f2a"
}
}
}/api/v1/reports?from=2026-08-01&to=2026-08-31Sales Report
What you bought over a date range and what it cost, broken down by product. Dates are UTC calendar days on the order date and inclusive at both ends; leaving them out reports the last 30 days. Paid orders only - an order that fails fulfilment is cancelled and refunded to your balance, so it never cost anything. The itemised orders array is capped at 100 rows by default (limit, max 500); narrow the dates to page through more.
curl "https://buyukesim.com/api/v1/reports?from=2026-08-01&to=2026-08-31" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"period": { "from": "2026-08-01", "to": "2026-08-31", "timezone": "UTC" },
"totals": {
"orders": 4,
"units": 4,
"spend_usd": 25.16,
"currency": "USD"
},
"products": [
{ "type": "travel_data", "orders": 3, "units": 3, "spend_usd": 16.17 },
{ "type": "vpn", "orders": 1, "units": 1, "spend_usd": 8.99 }
],
"balance": { "remaining_usd": 477.5, "currency": "USD" },
"orders": [
{
"order_id": 98423,
"type": "vpn",
"reference": "order-1236",
"lookup_code": "K7M9-2XP4",
"units": 1,
"spend_usd": 8.99,
"created_at": "2026-08-29 20:00:00",
"plan": "30d"
}
],
"orders_truncated": false
}
}Products
/api/v1/productsList Products
Fetch all active Travel eSIM packages (with current package_code and price_usd) and the VPN access plans and servers, so you always know what's purchasable before calling Create Order. The travel_data array is the whole live catalogue (about 198 destinations - one entry is shown here); ?location_code=GB narrows it. Every price_usd is YOUR price: discount_pct is your own rate, not a fixed one, and the sample below just uses 10%. Each product line can carry its own rate: discounts gives the rate for uk_number, travel_data and vpn (a top-up is priced as travel_data, a renewal as uk_number), and discount_pct is the account rate any line without its own falls back to.
curl "https://buyukesim.com/api/v1/products" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"discount_pct": 10,
"discounts": { "uk_number": 10, "travel_data": 10, "vpn": 10 },
"travel_data": [
{
"package_code": "GB_1GB_7D",
"name": "United Kingdom 1GB / 7 Days",
"location_code": "GB",
"retail_price_usd": 5.99,
"price_usd": 5.39,
"volume_label": "1 GB",
"duration": 7,
"duration_unit": "DAY"
}
],
"vpn": {
"type": "vpn",
"available": true,
"currency": "USD",
"plans": [
{ "plan": "30d", "days": 30, "label": "30 days", "retail_price_usd": 9.99, "price_usd": 8.99, "currency": "USD" }
],
"protocols": ["wireguard", "openvpn", "vless"],
"servers": [
{ "id": 42, "country_code": "NL", "city": "Amsterdam", "protocol": "wireguard" }
]
}
}
}Orders
/api/v1/ordersCreate Order - Travel eSIM
Creates and instantly fulfills a Travel eSIM order for the given package_code.
curl -X POST "https://buyukesim.com/api/v1/orders" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"product_type": "travel_data",
"package_code": "GB_1GB_7D",
"reference": "order-1235"
}'{
"success": true,
"data": {
"order_id": 98422,
"reference": "order-1235",
"status": "paid",
"product": {
"type": "travel_data",
"package_code": "GB_1GB_7D",
"package_name": "United Kingdom 1GB / 7 Days",
"location_code": "GB",
"retail_price_usd": 5.99,
"discount_pct": 10,
"price_usd": 5.39
},
"lookup_code": null,
"created_at": "2026-07-06T20:00:00+00:00",
"balance": { "charged_usd": 5.39, "remaining_usd": 472.11, "currency": "USD" }
}
}/api/v1/ordersCreate Order - VPN access
Creates and instantly provisions a VPN access order for the given vpn_plan, deducted from your prepaid balance. The response carries the username, password and expiry. If the VPN provider is unreachable the order is still paid and kept: you get HTTP 202 with status "provisioning_pending" and the order id, our team is alerted, and the credentials appear on GET /v1/orders/{id} once the account is created.
curl -X POST "https://buyukesim.com/api/v1/orders" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"product_type": "vpn",
"vpn_plan": "30d",
"reference": "order-1236"
}'{
"success": true,
"data": {
"order_id": 98423,
"reference": "order-1236",
"status": "paid",
"product": {
"type": "vpn",
"plan": { "key": "30d", "days": 30, "label": "30 days" },
"retail_price_usd": 9.99,
"discount_pct": 10,
"price_usd": 8.99
},
"lookup_code": "K7M9-2XP4",
"created_at": "2026-08-29T20:00:00+00:00",
"vpn": {
"provisioned": true,
"expires_at": "2026-09-28 00:00:00",
"username": "bk98423a1c3e",
"password": "s7Kq2vXpLm4A",
"protocols": ["wireguard", "openvpn", "vless"],
"config_endpoint": "https://buyukesim.com/api/v1/orders/98423/vpn-config"
},
"success_url": "https://buyukesim.com/en/success/#order_id=98423&access_token=...",
"balance": { "charged_usd": 8.99, "remaining_usd": 463.12, "currency": "USD" }
}
}/api/v1/orders/98422Order Status & Delivery
The delivery call: poll it until data.esim.ready is true and take the profile from data.esim.items. Each item carries both ways onto a phone - qr_code, and manual_install with the SM-DP+ address and activation code to type in by hand, for the very common case where your customer is reading your app on the same phone the profile has to install to and has no second screen to scan from. puk_code is null on travel eSIMs. Do not poll status: it reads "paid" the moment your balance is taken, which is a payment state, not a delivery one.
curl "https://buyukesim.com/api/v1/orders/98422" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"order_id": 98422,
"reference": "order-1235",
"status": "paid",
"product": { "type": "travel_data", "package_code": "GB_1GB_7D", "retail_price_usd": 5.99, "price_usd": 5.39 },
"lookup_code": "K7M9-2XP4",
"esim": {
"ready": true,
"items": [
{
"_comment": "hosts below are placeholders - the real ones differ per profile",
"qr_code": "https://qr.example-provider.net/8e2bba37e8b94ca49bf23be334a0a57f.png",
"iccid": "8944...",
"puk_code": null,
"manual_install": {
"activation_string": "LPA:1$rsp.example-provider.com$1173094A3D3A473D84695E0D6C404B34",
"smdp_address": "rsp.example-provider.com",
"activation_code": "1173094A3D3A473D84695E0D6C404B34",
"confirmation_code_required": false
}
}
]
}
}
}/api/v1/orders/98422/usageTravel eSIM Data Usage
Live remaining/used data, activation and expiry status for a Travel eSIM order, pulled fresh from the provider each call.
curl "https://buyukesim.com/api/v1/orders/98422/usage" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"order_id": 98422,
"status": "paid",
"package": {
"package_code": "GB_1GB_7D",
"name": "United Kingdom 1GB / 7 Days",
"location_code": "GB",
"volume_label": "1 GB",
"duration": 7,
"duration_unit": "DAY"
},
"usage": {
"iccid": "8944...",
"apn": "cmlink",
"esim_status": "IN_USE",
"smdp_status": "ENABLED",
"total_volume_bytes": 1073741824,
"used_volume_bytes": 214748364,
"remaining_volume_bytes": 858993459,
"usage_percent": 20.0,
"total_duration": 7,
"duration_unit": "DAY",
"expired_time": "2026-07-13T20:00:00+00:00"
}
}
}/api/v1/orders/98422/topupsTop-up Options for an eSIM
The data packages the provider currently offers for this order's eSIM, with your discount already applied. The catalogue is per eSIM and live, so these codes are not in GET /v1/products and must not be cached: fetch them when your customer asks to add data. An eSIM takes 8 top-ups in total and remaining_topups counts what is left.
curl "https://buyukesim.com/api/v1/orders/98422/topups" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"order_id": 98422,
"iccid": "8944...",
"discount_pct": 10,
"reloadable": true,
"used_topups": 1,
"remaining_topups": 7,
"max_topups": 8,
"options": [
{
"package_code": "TOPUP_GB_1GB_7D",
"name": "United Kingdom 1GB / 7 Days",
"retail_price_usd": 5.99,
"price_usd": 5.39,
"volume_label": "1 GB",
"volume_bytes": 1073741824,
"duration": 7,
"duration_unit": "DAY"
}
]
}
}/api/v1/topupsAdd Data to an eSIM
Reloads a Travel eSIM you already sold, billed to your prepaid balance at your discount. The same profile and the same QR keep working, so your customer never reinstalls anything. package_code must be one the list call returned for this eSIM; it is re-checked live and no price is ever taken from the request. reference is the idempotency key and shares its namespace with POST /v1/orders.
curl -X POST "https://buyukesim.com/api/v1/topups" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"order_id": 98422,
"package_code": "TOPUP_GB_1GB_7D",
"reference": "topup-4471"
}'{
"success": true,
"data": {
"order_id": 98599,
"reference": "topup-4471",
"status": "paid",
"product": {
"type": "travel_topup",
"package_code": "TOPUP_GB_1GB_7D",
"package_name": "United Kingdom 1GB / 7 Days",
"volume_label": "1 GB",
"duration": 7,
"duration_unit": "DAY",
"retail_price_usd": 5.99,
"discount_pct": 10,
"price_usd": 5.39
},
"esim": {
"iccid": "8944...",
"parent_order_id": 98422,
"reinstall_required": false,
"remaining_topups": 8
},
"created_at": "2026-07-09T11:20:00+00:00",
"balance": { "charged_usd": 5.39, "remaining_usd": 466.72, "currency": "USD" }
}
}/api/v1/orders/98423/vpn-config?protocol=wireguard&server_id=42VPN Configuration
Fetch a WireGuard, OpenVPN or VLESS configuration for one server on a VPN order you created. Take server_id from the servers list in List Products. WireGuard servers also serve OpenVPN; VLESS servers only serve VLESS. Call it as often as you need, up to 20 times a minute.
curl "https://buyukesim.com/api/v1/orders/98423/vpn-config?protocol=wireguard&server_id=42" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"order_id": 98423,
"protocol": "wireguard",
"server": { "id": 42, "country_code": "NL", "city": "Amsterdam" },
"name": "buyukesim-nl-amsterdam.conf",
"content": "[Interface]\nPrivateKey = ...\nAddress = ...",
"qr_payload": "[Interface]\nPrivateKey = ...\nAddress = ..."
}
}UK Number (+44)
Approved accounts only
The UK number is not open to every partner account: our team switches it on per account, on request. Until it is on for yours, GET /v1/products leaves out the uk_number block, and both POST /v1/orders with product_type uk_number and POST /v1/renewals answer 403 product_unavailable. Travel eSIM and VPN work on every account. To ask for access, write to our support team with your account name.
On an approved account, GET /v1/products also returns a uk_number block. A line includes its first 180 days. prepay_packages are the 6, 12 and 24-month packages sold with a new line (prepay_periods 0, 1 and 3), and renewal_packages extend a line you already sold (periods 1, 2 and 4). Every price_usd is your price at your UK rate; the sample uses 10%.
"uk_number": {
"type": "uk_number",
"retail_price_usd": 25,
"price_usd": 22.5,
"currency": "USD",
"min_quantity": 1,
"max_quantity": 10,
"period_days": 180,
"prepay_packages": [
{ "prepay_periods": 0, "months": 6, "retail_price_usd": 25, "price_usd": 22.5 },
{ "prepay_periods": 1, "months": 12, "retail_price_usd": 36, "price_usd": 32.4 },
{ "prepay_periods": 3, "months": 24, "retail_price_usd": 59.5, "price_usd": 53.55 }
],
"renewal_packages": [
{ "periods": 1, "months": 6, "retail_price_usd": 15, "price_usd": 13.5 },
{ "periods": 2, "months": 12, "retail_price_usd": 27, "price_usd": 24.3 },
{ "periods": 4, "months": 24, "retail_price_usd": 51, "price_usd": 45.9 }
]
}Tell your customer before they buy: each line's QR code installs once. It is never reissued, and a delivered UK line is not refunded. The number stays active until its end date and has to be renewed before then: a line that passes its end date is released and cannot be recovered.
/api/v1/ordersCreate Order - UK Number
Creates a UK Number (+44) order and delivers it from stock straight away, deducted from your prepaid balance at your UK rate. quantity is 1 to 10 lines. prepay_periods sells the longer package in the same call: 0 (or left out) is 6 months, 1 is 12 and 3 is 24. reference is the idempotency key and shares its namespace with every other POST /v1/orders. Delivery is all or nothing: if stock cannot cover the full quantity, no line is delivered, the order is cancelled and your balance refunded.
curl -X POST "https://buyukesim.com/api/v1/orders" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"product_type": "uk_number",
"quantity": 1,
"prepay_periods": 0,
"reference": "order-1234"
}'{
"success": true,
"data": {
"order_id": 98421,
"reference": "order-1234",
"status": "paid",
"product": {
"type": "uk_number",
"quantity": 1,
"prepay_periods": 0,
"months": 6,
"retail_price_usd": 25,
"discount_pct": 10,
"price_usd": 22.5
},
"lookup_code": "K7M9-2XP4",
"created_at": "2026-07-06 20:00:00",
"balance": { "charged_usd": 22.5, "remaining_usd": 449.61, "currency": "USD" }
}
}/api/v1/orders/98421UK Number Delivery
The same GET /v1/orders/{id} call as every other order. data.esim.items holds one entry per line. qr_code is a signed link to the QR image that expires after about two hours, so read the order again for a fresh link instead of storing it. manual_install carries the SM-DP+ address and activation code for installing by hand (null when the profile has no activation string on file), and puk_code is the line's PUK. The reply does not include the phone number itself, which is why POST /v1/renewals asks for phone.
curl "https://buyukesim.com/api/v1/orders/98421" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"success": true,
"data": {
"order_id": 98421,
"reference": "order-1234",
"status": "paid",
"product": { "type": "uk_number", "quantity": 1, "prepay_periods": 0, "months": 6, "retail_price_usd": 25, "price_usd": 22.5 },
"lookup_code": "K7M9-2XP4",
"created_at": "2026-07-06 20:00:00",
"esim": {
"ready": true,
"items": [
{
"qr_code": "https://buyukesim.com/api/serve_qr.php?order_id=98421&file=...&exp=...&sig=...",
"iccid": "8944...",
"puk_code": "12345678",
"assigned_at": "2026-07-06 20:00:00",
"manual_install": {
"activation_string": "LPA:1$smdp.example.com$ABCD-1234-EFGH-5678",
"smdp_address": "smdp.example.com",
"activation_code": "ABCD-1234-EFGH-5678",
"confirmation_code_required": false
}
}
]
}
}
}/api/v1/renewalsRenew UK Line
Extends a UK line you already sold, deducted from your prepaid balance at your UK rate. periods counts 180-day blocks: 1 is 6 months, 2 is 12 (10% off) and 4 is 24 (15% off), then your discount on top. order_id is required and must be one of your own UK orders. Send phone as well unless we already hold the number for that order. active_until in the reply is the line's new end date. reference works exactly as on POST /v1/orders: sending it again returns the first renewal and charges nothing.
curl -X POST "https://buyukesim.com/api/v1/renewals" \
-H "Authorization: Bearer buk_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"order_id": 98421,
"phone": "+447700900123",
"periods": 2,
"reference": "renewal-5501"
}'{
"success": true,
"data": {
"renewal_id": 412,
"order_id": 98421,
"reference": "renewal-5501",
"status": "completed",
"phone_number": "+447700900123",
"periods": 2,
"months": 12,
"price_usd": 24.3,
"active_until": "2027-07-01",
"created_at": "2026-07-06 20:05:00",
"completed_at": "2026-07-06 20:05:00",
"balance": { "charged_usd": 24.3, "remaining_usd": 425.31, "currency": "USD" }
}
}Error codes
Every error response has the same shape: a top-level success: false, plus an error object with a stable code field your code can check to know exactly what went wrong.
{
"success": false,
"error": { "code": "insufficient_balance", "message": "..." }
}| HTTP | code | Meaning |
|---|---|---|
| 401 | unauthorized | Missing or invalid API key. |
| 402 | insufficient_balance | Insufficient prepaid balance for this order's price. |
| 403 | product_unavailable | This account cannot sell the product: the UK number on an account it is not enabled for. |
| 404 | package_not_found | Travel package_code not found or no longer active. |
| 409 | provisioning_pending | The VPN account for this order is not created yet, or the plan has expired. |
| 429 | rate_limit | Rate limit exceeded - slow down requests. |
