Docs
Query Profiles
Query Profiles
Query allocated eSIM profiles and order status
Query Profiles
Query the status of your allocated eSIM profiles and orders.
Query All Allocated Profiles
Endpoint: POST /api/v1/open/esim/query
Request Parameters
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
orderNo | String | Optional | Platform order number | ORD20240101123456 |
iccid | String | Optional | eSIM ICCID | 8901234567890123456 |
esimTranNo | String | Optional | eSIM transaction number | ESIM123456789 |
startTime | String | Optional | Query start time (ISO 8601) | 2024-01-01T00:00:00+0000 |
endTime | String | Optional | Query end time (ISO 8601) | 2024-01-31T23:59:59+0000 |
pager.pageNum | Integer | Optional | Page number (default: 1) | 1 |
pager.pageSize | Integer | Optional | Results per page (max 100, default: 20) | 20 |
Example Request - Query by Order Number
curl --location --request POST 'https://b2b.hiroaming.com/api/v1/open/esim/query' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"orderNo": "ORD20240101123456"
}'Example Request - Query by ICCID
curl --location --request POST 'https://b2b.hiroaming.com/api/v1/open/esim/query' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"iccid": "8901234567890123456"
}'Example Request - Query by Time Period with Pagination
curl --location --request POST 'https://b2b.hiroaming.com/api/v1/open/esim/query' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"startTime": "2024-01-01T00:00:00+0000",
"endTime": "2024-01-31T23:59:59+0000",
"pager": {
"pageNum": 1,
"pageSize": 50
}
}'Response Parameters
| Name | Type | Description |
|---|---|---|
success | Boolean | true = succeeded, false = failed |
errorCode | String | Error code when failed |
errorMsg | String | Error message |
obj.esimList | Array | List of eSIM profiles |
obj.pager.total | Integer | Total number of results |
obj.pager.pageNum | Integer | Current page number |
obj.pager.pageSize | Integer | Results per page |
eSIM Object
| Field | Type | Description | Example |
|---|---|---|---|
esimTranNo | String | eSIM transaction number | ESIM123456789 |
orderNo | String | Platform order number | ORD20240101123456 |
transactionId | String | Vendor transaction ID | TX123456 |
iccid | String | eSIM ICCID | 8901234567890123456 |
imsi | String | IMSI number | 123456789012345 |
msisdn | String | Phone number (if applicable) | +66812345678 |
eid | String | eUICC ID | 89049032000000000000000000012345 |
ac | String | Activation code | LPA:1$smdp.example.com$XXXX |
qrCodeUrl | String | QR code image URL | https://... |
shortUrl | String | Short installation URL | https://... |
smdpStatus | String | SM-DP+ status | RELEASED, INSTALLED, ENABLED |
esimStatus | String | eSIM status | GOT_RESOURCE, IN_USE, USED_UP |
smsStatus | Integer | SMS support status | 0, 1, 2 |
activeType | Integer | Activation type | 1 = First Installation, 2 = First Network |
dataType | Integer | Data plan type | 1 = Fixed, 2 = Day Pass |
totalVolume | Long | Total data in bytes | 1073741824 |
totalDuration | Integer | Plan duration | 7 |
durationUnit | String | Duration unit | DAY |
orderUsage | Long | Used data in bytes | 524288000 |
activateTime | String | Activation timestamp | 2024-01-02T10:30:00+0000 |
expiredTime | String | Expiry timestamp | 2024-02-07T00:00:00+0000 |
installationTime | String | Installation timestamp | 2024-01-01T15:00:00+0000 |
pin | String | eSIM PIN code | 1234 |
puk | String | eSIM PUK code | 12345678 |
apn | String | Access Point Name | internet |
ipExport | String | IP exit country code | TH |
supportTopUpType | Integer | Top-up support type | 0, 1, 2 |
fupPolicy | String | Fair Usage Policy | 384 Kbps after limit |
packageList | Array | List of packages on this eSIM | See Package Object |
SMS Status Values
| Value | Description |
|---|---|
0 | SMS not supported |
1 | SMS supported (API + Mobile) |
2 | SMS supported (API only) |
Active Type Values
| Value | Description |
|---|---|
1 | Activates on first installation |
2 | Activates on first network connection |
Data Type Values
| Value | Description |
|---|---|
1 | Data in Total (fixed data amount) |
2 | Daily Limit - Speed Reduced after limit |
3 | Daily Limit - Cut-off after limit |
4 | Daily Unlimited |
Support TopUp Type Values
| Value | Description |
|---|---|
0 | Top-up not supported |
1 | Top-up supported (same slug only) |
2 | Top-up supported (any compatible package) |
SM-DP+ Status Values
| Status | Description |
|---|---|
RELEASED | Profile ready for download |
DOWNLOADED | Profile downloaded to device |
INSTALLED | Profile installed on device |
ENABLED | Profile enabled and active |
DISABLED | Profile disabled |
DELETED | Profile deleted from device |
eSIM Status Values
| Status | Description |
|---|---|
GOT_RESOURCE | Profile allocated, ready for download |
IN_USE | Profile is actively being used |
USED_UP | Data exhausted |
EXPIRED | Profile validity expired |
CANCELLED | Profile cancelled |
SUSPENDED | Profile temporarily suspended |
REVOKED | Profile permanently revoked |
Example Success Response
{
"errorCode": null,
"errorMsg": null,
"success": true,
"obj": {
"esimList": [
{
"esimTranNo": "ESIM123456789",
"orderNo": "ORD20240101123456",
"transactionId": "TX123456",
"iccid": "8901234567890123456",
"imsi": "123456789012345",
"msisdn": "",
"eid": "",
"ac": "LPA:1$smdp.example.com$XXXX-XXXX-XXXX-XXXX",
"qrCodeUrl": "https://static.example.com/qr/xxx.png",
"shortUrl": "https://esim.example.com/i/xxx",
"smdpStatus": "RELEASED",
"esimStatus": "GOT_RESOURCE",
"smsStatus": 2,
"activeType": 1,
"dataType": 1,
"totalVolume": 1073741824,
"totalDuration": 7,
"durationUnit": "DAY",
"orderUsage": 0,
"activateTime": null,
"expiredTime": null,
"installationTime": null,
"pin": "",
"puk": "",
"apn": "internet",
"ipExport": "TH",
"supportTopUpType": 2,
"fupPolicy": "",
"packageList": [
{
"packageCode": "TH_1_7",
"slug": "TH_1_7",
"volume": 1073741824,
"duration": 7,
"locationCode": "TH"
}
]
}
],
"pager": {
"pageSize": 20,
"pageNum": 1,
"total": 1
}
}
}Calculating Data Usage
Data values are in bytes. To convert:
// Convert bytes to human readable
function formatBytes(bytes) {
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
// Calculate remaining data percentage
const orderUsage = 524288000; // 500 MB used
const totalVolume = 1073741824; // 1 GB total
const remainingPercent = ((totalVolume - orderUsage) / totalVolume * 100).toFixed(1);
// Result: 51.2%Pagination
For large result sets, use the pager object:
# Get first page
curl --location --request POST 'https://b2b.hiroaming.com/api/v1/open/esim/query' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"startTime": "2024-01-01T00:00:00+0000",
"endTime": "2024-12-31T23:59:59+0000",
"pager": {
"pageNum": 1,
"pageSize": 100
}
}'
# Get second page
curl --location --request POST 'https://b2b.hiroaming.com/api/v1/open/esim/query' \
--header 'RT-AccessCode: YOUR_ACCESS_CODE' \
--header 'RT-SecretKey: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{
"startTime": "2024-01-01T00:00:00+0000",
"endTime": "2024-12-31T23:59:59+0000",
"pager": {
"pageNum": 2,
"pageSize": 100
}
}'