eSIMWholesale

Offentlig API-dokumentation

Offentligt API är tillgängligt via versionerade HTTP-rutter (inte tRPC). Använd din API-nyckel i headern och anropa:

https://esim.agents.co.th/api/v1
Ladda ner OpenAPI-spec

API-nyckel för exempel

Klistra in en giltig API‑nyckel för att anpassa exemplen. Hämta nycklar efter KYC‑godkännande i din konsol.

Autentisering

x-api-key: <your_api_key>

GET https://esim.agents.co.th/api/v1/getBalance (omfattning: balance:read)

Returnerar en sammanfattning av kontosaldot inklusive totala påfyllningar, totala inköp och aktuellt tillgängligt saldo.

Exempel på begäran

curl -X GET 'https://esim.agents.co.th/api/v1/getBalance' \ -H 'x-api-key: <your_api_key>'

Exempelsvar

{ "success": true, "data": { "accountId": "a1b2c3d4-...", "totalTopupsThb": 12000, "totalPurchasesThb": 4500, "balanceThb": 7500 } }

GET https://esim.agents.co.th/api/v1/getProducts (omfattning: products:read)

Returnerar aktiva produkter med kontospecifik prisnivå. Använd produkt-ID:t som productId när du skapar ordrar.

Förfrågningsparametrar

limitintegervalfrittdefault: 50

Number of products to return (1–200)

Exempel på begäran

curl -X GET 'https://esim.agents.co.th/api/v1/getProducts?limit=50' \ -H 'x-api-key: <your_api_key>'

Exempelsvar

{ "success": true, "data": [ { "id": "b2f7e8a1-...", "name": "Thailand 15-Day eSIM", "description": "15GB data, 15 days validity", "provider": "TDAC", "sku": "TH-15D-15GB", "retailPriceThb": 450, "currentUnitPriceThb": 225, "activeTierMinTrailingYearQty": 0, "promotionLabel": null, "promotionFeatures": [] } ] }

GET https://esim.agents.co.th/api/v1/getPaymentHistory (omfattning: payments:read)

Returnerar historik för plånbokspåfyllning och betalningar inklusive beloppsfördelning, metod, status och tidsstämplar.

Förfrågningsparametrar

limitintegervalfrittdefault: 50

Number of records to return (1–200)

Exempel på begäran

curl -X GET 'https://esim.agents.co.th/api/v1/getPaymentHistory?limit=50' \ -H 'x-api-key: <your_api_key>'

Exempelsvar

{ "success": true, "data": [ { "id": "c3d4e5f6-...", "merchantOrderId": "PAY-20260307-001", "amountThb": 5000, "baseAmountThb": 4673, "processingFeeThb": 140, "vatThb": 187, "walletCreditThb": 5000, "status": "success", "paymentMethod": "promptpay", "paidAt": "2026-03-07T10:30:00Z", "createdAt": "2026-03-07T10:29:00Z" } ] }

POST https://esim.agents.co.th/api/v1/createOrder (omfattning: orders:write)

Skapar en grossistbeställning av eSIM. eSIM:er tillhandahålls omedelbart och returneras i svaret. Stöder idempotens. Att skicka in samma idempotencyKey igen returnerar den ursprungliga beställningen utan dubbeldebitering.

Body-parametrar

productIduuidobligatorisk

Product ID from /getProducts

quantityintegerobligatorisk

Number of eSIMs to purchase (1–2000)

idempotencyKeystringvalfritt

Unique key to prevent duplicate orders on retry (8–120 chars)

includeQrImagesbooleanvalfrittdefault: false

Include base64-encoded QR images per eSIM in the response

Exempel på begäran

curl -X POST 'https://esim.agents.co.th/api/v1/createOrder' \ -H 'x-api-key: <your_api_key>' \ -H 'content-type: application/json' \ -d '{ "productId": "b2f7e8a1-...", "quantity": 2 }'

Exempelsvar

{ "success": true, "data": { "purchaseOrderId": "d4e5f6a7-...", "reused": false, "unitPriceThb": 225, "totalPriceThb": 450, "quantity": 2, "items": [ { "sequenceNo": 1, "status": "provisioned", "provider": "TDAC", "iccid": "8966012345678901234", "phone": "+66809048375", "activationCode": "LPA:1$smdp.example.com$ABCDEF", "smdpAddress": "smdp.example.com", "qrCode": "LPA:1$smdp.example.com$ABCDEF" }, { "sequenceNo": 2, "status": "provisioned", "provider": "TDAC", "iccid": "8966012345678905678", "phone": "+66809048376", "activationCode": "LPA:1$smdp.example.com$GHIJKL", "smdpAddress": "smdp.example.com", "qrCode": "LPA:1$smdp.example.com$GHIJKL" } ] } }

GET https://esim.agents.co.th/api/v1/getOrderStatus (omfattning: orders:read)

Returnerar en enskild inköpsorder med fullständiga eSIM-detaljer för varje artikel.

Förfrågningsparametrar

purchaseOrderIduuidobligatorisk

The order ID to look up

includeQrImagesbooleanvalfrittdefault: false

Include base64-encoded QR images per eSIM

Exempel på begäran

curl -X GET 'https://esim.agents.co.th/api/v1/getOrderStatus?purchaseOrderId=d4e5f6a7-...' \ -H 'x-api-key: <your_api_key>'

Exempelsvar

{ "success": true, "data": { "id": "d4e5f6a7-...", "status": "confirmed", "orderSource": "api", "quantity": 2, "unitPriceThb": 225, "totalPriceThb": 450, "createdAt": "2026-03-07T12:00:00Z", "product": { "name": "Thailand 15-Day eSIM", "sku": "TH-15D-15GB" }, "items": [ { "id": "e5f6a7b8-...", "sequenceNo": 1, "status": "provisioned", "provider": "TDAC", "iccid": "8966012345678901234", "phone": "+66809048375", "activationCode": "LPA:1$smdp.example.com$ABCDEF", "smdpAddress": "smdp.example.com", "qrCode": "LPA:1$smdp.example.com$ABCDEF" } ] } }

GET https://esim.agents.co.th/api/v1/getOrders (omfattning: orders:read)

Returnerar en lista över alla inköpsordrar med deras eSIM-artiklar. Varje order inkluderar produktinformation, prissättning och tilldelade eSIM-detaljer.

Förfrågningsparametrar

limitintegervalfrittdefault: 50

Number of orders to return (1–200)

includeQrImagesbooleanvalfrittdefault: false

Include base64-encoded QR images per eSIM

Exempel på begäran

curl -X GET 'https://esim.agents.co.th/api/v1/getOrders?limit=10' \ -H 'x-api-key: <your_api_key>'

Exempelsvar

{ "success": true, "data": [ { "id": "d4e5f6a7-...", "status": "confirmed", "orderSource": "api", "quantity": 2, "unitPriceThb": 225, "totalPriceThb": 450, "createdAt": "2026-03-07T12:00:00Z", "product": { "name": "Thailand 15-Day eSIM", "sku": "TH-15D-15GB" }, "items": [ { "id": "e5f6a7b8-...", "sequenceNo": 1, "status": "provisioned", "provider": "TDAC", "iccid": "8966012345678901234", "phone": "+66809048375", "activationCode": "LPA:1$...", "smdpAddress": "smdp.example.com", "qrCode": "LPA:1$..." } ] } ] }

Felformat

{ "success": false, "error": { "code": "FORBIDDEN_SCOPE", "message": "Missing required scope: orders:write" } }