Openbare API-documentatie
De openbare API is beschikbaar via versiegebonden HTTP-routes (niet tRPC). Gebruik uw API-sleutel in de header en voer de volgende call uit:
https://esim.agents.co.th/api/v1API-sleutel voor voorbeelden
Plak een geldige API-sleutel om voorbeelden te personaliseren. Ontvang sleutels na KYC-goedkeuring in uw console.
Authenticatie
x-api-key: <your_api_key>GET https://esim.agents.co.th/api/v1/getBalance (scope: balance:read)
Geeft een samenvatting van het rekeningsaldo terug, inclusief totaal aantal opwaarderingen, totale aankopen en het huidige beschikbare saldo.
Voorbeeldverzoek
curl -X GET 'https://esim.agents.co.th/api/v1/getBalance' \
-H 'x-api-key: <your_api_key>'Voorbeeldantwoord
{
"success": true,
"data": {
"accountId": "a1b2c3d4-...",
"totalTopupsThb": 12000,
"totalPurchasesThb": 4500,
"balanceThb": 7500
}
}GET https://esim.agents.co.th/api/v1/getProducts (scope: products:read)
Geeft actieve producten terug met accountspecifieke staffelprijzen. Gebruik de product-id als productId bij het aanmaken van orders.
Queryparameters
Number of products to return (1–200)
Voorbeeldverzoek
curl -X GET 'https://esim.agents.co.th/api/v1/getProducts?limit=50' \
-H 'x-api-key: <your_api_key>'Voorbeeldantwoord
{
"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 (scope: payments:read)
Geeft de opwaardeer- en betalingsgeschiedenis van de wallet terug, inclusief uitsplitsing van bedragen, methode, status en tijdstempels.
Queryparameters
Number of records to return (1–200)
Voorbeeldverzoek
curl -X GET 'https://esim.agents.co.th/api/v1/getPaymentHistory?limit=50' \
-H 'x-api-key: <your_api_key>'Voorbeeldantwoord
{
"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 (scope: orders:write)
Maakt een wholesale-eSIM-inkooporder aan. eSIMs worden direct geactiveerd en in de response teruggegeven. Ondersteunt idempotency. Het opnieuw verzenden van dezelfde idempotencyKey retourneert de oorspronkelijke order zonder dubbel te rekenen.
Body-parameters
Product ID from /getProducts
Number of eSIMs to purchase (1–2000)
Unique key to prevent duplicate orders on retry (8–120 chars)
Include base64-encoded QR images per eSIM in the response
Voorbeeldverzoek
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
}'Voorbeeldantwoord
{
"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 (scope: orders:read)
Geeft één inkooporder terug met volledige eSIM-gegevens voor elk item.
Queryparameters
The order ID to look up
Include base64-encoded QR images per eSIM
Voorbeeldverzoek
curl -X GET 'https://esim.agents.co.th/api/v1/getOrderStatus?purchaseOrderId=d4e5f6a7-...' \
-H 'x-api-key: <your_api_key>'Voorbeeldantwoord
{
"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 (scope: orders:read)
Geeft een lijst terug van alle inkooporders met hun eSIM-items. Elke order bevat productinformatie, prijzen en de verstrekte eSIM-gegevens.
Queryparameters
Number of orders to return (1–200)
Include base64-encoded QR images per eSIM
Voorbeeldverzoek
curl -X GET 'https://esim.agents.co.th/api/v1/getOrders?limit=10' \
-H 'x-api-key: <your_api_key>'Voorbeeldantwoord
{
"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$..."
}
]
}
]
}Foutformaat
{
"success": false,
"error": {
"code": "FORBIDDEN_SCOPE",
"message": "Missing required scope: orders:write"
}
}