eSIMWholesale

ເອກະສານ API ສາທາລະນະ

Public API ໃຫ້ບໍລິການຜ່ານເສັ້ນທາງ HTTP ທີ່ກໍານົດເວີຊັນ (ບໍ່ແມ່ນ tRPC). ໃຫ້ໃສ່ກະແຈ API ຂອງທ່ານໃນ header ແລ້ວເອີ້ນ:

https://esim.agents.co.th/api/v1
ດາວນ໌ໂຫຼດ OpenAPI Spec

API Key ສໍາລັບຕົວຢ່າງ

ວາງກະແຈ API ໃດໆທີ່ຖືກຕ້ອງເພື່ອປັບແຕ່ງຕົວຢ່າງໃຫ້ເຫມາະກັບທ່ານ. ຮັບກະແຈໄດ້ຫຼັງຈາກການອະນຸມັດ KYC ໃນ console ຂອງທ່ານ.

ການຢືນຢັນຕົວຕົນ

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)

ສົ່ງຄືນສິນຄ້າທີ່ກຳລັງໃຊ້ງານພ້ອມລາຄາແບບຂັ້ນຂອງແຕ່ລະບັນຊີ. ໃຊ້ product id ເປັນ productId ເມື່ອສ້າງຄຳສັ່ງຊື້.

Query Parameters

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)

ສົ່ງຄືນປະຫວັດການເຕີມເງິນແລະການຊຳລະຜ່ານ wallet ລວມທັງລາຍລະອຽດການແຍກຈຳນວນເງິນ, ວິທີການ, ສະຖານະ, ແລະເວລາບັນທຶກ.

Query Parameters

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 ຈະຖືກສົ່ງມອບທັນທີ ແລະສົ່ງຄືນໃນຄໍາຕອບ. ຮອງຮັບ idempotency. ຖ້າສົ່ງ idempotencyKey ເດີມອີກຄັ້ງ ຈະໄດ້ຮັບຄໍາສັ່ງເດີມກັບຄືນໂດຍບໍ່ຖືກເກັບເງິນຊ້ໍາ.

ພາລາມິເຕີຂອງຂໍ້ມູນຫຼັກ (Body Parameters)

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 ຢ່າງຄົບຖ້ວນສຳລັບແຕ່ລະລາຍການ.

Query Parameters

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 ທີ່ໄດ້ຖືກເປີດໃຊ້.

Query Parameters

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