eSIMWholesale

Öffentliche API-Dokumentation

Die öffentliche API ist über versionierte HTTP-Routen verfügbar (nicht tRPC). Verwenden Sie Ihren API-Schlüssel im Header und rufen Sie folgende Adresse auf:

https://esim.agents.co.th/api/v1
OpenAPI-Spezifikation herunterladen

API-Schlüssel für Beispiele

Fügen Sie einen beliebigen gültigen API-Key ein, um Beispiele zu personalisieren. Sie erhalten Keys nach KYC-Genehmigung in Ihrer Konsole.

Authentifizierung

x-api-key: <your_api_key>

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

Gibt eine Zusammenfassung des Kontostands zurück, einschließlich Gesamtaufladungen, Gesamtkäufe und aktuell verfügbarem Guthaben.

Beispielanfrage

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

Beispielantwort

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

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

Gibt aktive Produkte mit kontospezifischer Staffelpreisliste zurück. Verwenden Sie die Produkt-ID als productId beim Erstellen von Bestellungen.

Abfrageparameter

limitintegeroptionaldefault: 50

Number of products to return (1–200)

Beispielanfrage

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

Beispielantwort

{ "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 (Geltungsbereich: payments:read)

Gibt die Verlaufshistorie von Wallet-Aufladungen und Zahlungen zurück, einschließlich Aufschlüsselung der Beträge, Methode, Status und Zeitstempeln.

Abfrageparameter

limitintegeroptionaldefault: 50

Number of records to return (1–200)

Beispielanfrage

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

Beispielantwort

{ "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 (Geltungsbereich: orders:write)

Erstellt eine Wholesale-eSIM-Bestellung. eSIMs werden sofort bereitgestellt und in der Antwort zurückgegeben. Unterstützt Idempotenz. Das erneute Senden desselben idempotencyKey gibt die ursprüngliche Bestellung zurück, ohne doppelt zu berechnen.

Hauptparameter

productIduuiderforderlich

Product ID from /getProducts

quantityintegererforderlich

Number of eSIMs to purchase (1–2000)

idempotencyKeystringoptional

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

includeQrImagesbooleanoptionaldefault: false

Include base64-encoded QR images per eSIM in the response

Beispielanfrage

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 }'

Beispielantwort

{ "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 (Geltungsbereich: orders:read)

Gibt eine einzelne Bestellung mit vollständigen eSIM-Details für jede Position zurück.

Abfrageparameter

purchaseOrderIduuiderforderlich

The order ID to look up

includeQrImagesbooleanoptionaldefault: false

Include base64-encoded QR images per eSIM

Beispielanfrage

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

Beispielantwort

{ "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 (Geltungsbereich: orders:read)

Gibt eine Liste aller Bestellungen mit ihren eSIM-Positionen zurück. Jede Bestellung enthält Produktinformationen, Preise und bereitgestellte eSIM-Details.

Abfrageparameter

limitintegeroptionaldefault: 50

Number of orders to return (1–200)

includeQrImagesbooleanoptionaldefault: false

Include base64-encoded QR images per eSIM

Beispielanfrage

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

Beispielantwort

{ "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$..." } ] } ] }

Fehlerformat

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