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)

계정별 등급 가격이 적용된 활성 상품 목록을 반환합니다. 주문 생성 시 제품 ID를 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" } }