GET Get Package Templates
Note: Before using package templates, verify their compatibility with your current eSIM configurations to avoid mismatches.
This endpoint returns a paginated list of all available package templates that can be used to create packages for eSIMs.
Configure the API Endpoint
https://esim.betatel.com/api/v1/esim/package-templates
- Method:
GET
Set Up the Headers
| Param | Value | Description |
|---|---|---|
| Content-Type | application/json | Specifies the payload format. |
| x-api-key | {{x-api-key}} | Your unique API key for secure access. |
| x-user-id | {{x-user-id}} | Your user identifier for added security and tracking. |
Query Parameters
Note: Query parameters allow specifying which page of the paginated results you want to retrieve, helpful for managing large datasets.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| offset | integer | optional | 0 | Pagination offset |
| count | integer | optional | 20 | Number of items to return |
Example Response
Status Code: 200 OK
Content-Type: application/json
{
"total": 50,
"offset": 0,
"count": 20,
"package_templates": [
{
"id": 21145354,
"name": "Basic Data Plan",
"description": "1GB Monthly Data Package",
"data_allowance": 1073741824,
"validity_days": 30,
"price": 10.00,
"currency": "USD"
}
]
}
The response includes the total number of package templates, current pagination offset, number of items returned, and an array of available package template objects.
Code Snippets
Tip: Choose a programming language snippet that aligns with your application stack for seamless API integration.
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
curl --location 'https://esim.betatel.com/api/v1/esim/package-templates?offset=0&count=20' \
--header 'Accept: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--header 'x-user-id: {{x-user-id}}'
import http.client
conn = http.client.HTTPSConnection("esim.betatel.com")
headers = {
'Accept': 'application/json',
'x-api-key': '{{x-api-key}}',
'x-user-id': '{{x-user-id}}'
}
conn.request("GET", "/api/v1/esim/package-templates?offset=0&count=20", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
const axios = require('axios');
axios.get('https://esim.betatel.com/api/v1/esim/package-templates', {
params: {
offset: 0,
count: 20
},
headers: {
'Accept': 'application/json',
'x-api-key': '{{x-api-key}}',
'x-user-id': '{{x-user-id}}'
}
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://esim.betatel.com/api/v1/esim/package-templates?offset=0&count=20',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'x-api-key: {{x-api-key}}',
'x-user-id': {{x-user-id}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
HttpResponse<String> response = Unirest.get("https://esim.betatel.com/api/v1/esim/package-templates?offset=0&count=20")
.header("Accept", "application/json")
.header("x-api-key", "{{x-api-key}}")
.header("x-user-id", "{{x-user-id}}")
.asString();
System.out.println(response.getBody());
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://esim.betatel.com/api/v1/esim/package-templates?offset=0&count=20");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("x-api-key", "{{x-api-key}}");
request.Headers.Add("x-user-id", "{{x-user-id}}");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Error Handling
Important: Ensure parameters are valid to avoid '400' errors, especially when setting pagination options.
- 400 - Bad Request - Invalid pagination parameters