eSIMWholesale

पब्लिक API दस्तावेज़

पब्लिक API संस्करणित HTTP रूट्स (tRPC नहीं) के माध्यम से उपलब्ध है। हेडर में अपना API कुंजी उपयोग करें और कॉल करें:

https://esim.agents.co.th/api/v1
OpenAPI स्पेक डाउनलोड करें

उदाहरणों के लिए API कुंजी

उदाहरणों को वैयक्तिकृत करने के लिए कोई भी मान्य API कुंजी पेस्ट करें। KYC स्वीकृति के बाद अपनी कंसोल में कुंजियाँ प्राप्त करें।

प्रमाणीकरण

x-api-key: <your_api_key>

GET https://esim.agents.co.th/api/v1/getBalance (स्कोप: balance:read)

अकाउंट बैलेंस सारांश देता है, जिसमें कुल टॉप-अप, कुल खरीद और वर्तमान उपलब्ध बैलेंस शामिल होता है।

उदाहरण अनुरोध

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

उदाहरण प्रतिक्रिया

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

GET https://esim.agents.co.th/api/v1/getProducts (स्कोप: products:read)

अकाउंट-विशिष्ट टियर प्राइसिंग के साथ सक्रिय उत्पाद वापस करता है। ऑर्डर बनाते समय उत्पाद आईडी को productId के रूप में उपयोग करें।

क्वेरी पैरामीटर्स

limitintegerवैकल्पिकdefault: 50

Number of products to return (1–200)

उदाहरण अनुरोध

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

उदाहरण प्रतिक्रिया

{ "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 (स्कोप: payments:read)

वॉलेट टॉप-अप और भुगतान इतिहास वापस करता है, जिसमें राशि का ब्रेकडाउन, तरीका, स्थिति और टाइमस्टैम्प शामिल होते हैं।

क्वेरी पैरामीटर्स

limitintegerवैकल्पिकdefault: 50

Number of records to return (1–200)

उदाहरण अनुरोध

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

उदाहरण प्रतिक्रिया

{ "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 (स्कोप: orders:write)

एक व्होलसेल eSIM खरीद ऑर्डर बनाता है। eSIM तुरंत प्रोविज़न किए जाते हैं और रिस्पॉन्स में लौटाए जाते हैं। आइडेम्पोटेंसी को सपोर्ट करता है। वही idempotencyKey दोबारा सबमिट करने पर दोबारा चार्ज किए बिना मूल ऑर्डर ही लौटाता है।

बॉडी पैरामीटर

productIduuidआवश्यक

Product ID from /getProducts

quantityintegerआवश्यक

Number of eSIMs to purchase (1–2000)

idempotencyKeystringवैकल्पिक

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

includeQrImagesbooleanवैकल्पिकdefault: false

Include base64-encoded QR images per eSIM in the response

उदाहरण अनुरोध

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

उदाहरण प्रतिक्रिया

{ "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 (स्कोप: orders:read)

प्रत्येक आइटम के लिए पूर्ण eSIM विवरण के साथ एकल परचेज ऑर्डर देता है।

क्वेरी पैरामीटर्स

purchaseOrderIduuidआवश्यक

The order ID to look up

includeQrImagesbooleanवैकल्पिकdefault: false

Include base64-encoded QR images per eSIM

उदाहरण अनुरोध

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

उदाहरण प्रतिक्रिया

{ "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 (स्कोप: orders:read)

सभी परचेज ऑर्डर और उनके eSIM आइटमों की सूची देता है। हर ऑर्डर में उत्पाद की जानकारी, मूल्य निर्धारण और प्रोविज़न की गई eSIM का विवरण शामिल होता है।

क्वेरी पैरामीटर्स

limitintegerवैकल्पिकdefault: 50

Number of orders to return (1–200)

includeQrImagesbooleanवैकल्पिकdefault: false

Include base64-encoded QR images per eSIM

उदाहरण अनुरोध

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

उदाहरण प्रतिक्रिया

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

एरर फ़ॉर्मैट

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