Skip to main content

POST Create Package

This endpoint creates a new package for a specific SIM card using a package template.

Configure the API Endpoint

https://esim.betatel.com/api/v1/esim/packages
  • Method: POST

Set Up the Headers

ParamValueDescription
Content-Typeapplication/jsonSpecifies 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.

Request Body

Info: Ensure each field in the request is validated and cross-referenced with existing data for consistency.

Request Body Example
{
"sim": "89148000004012345678",
"package_template": 21145354,
"time_allowance": 604800
}

Parameters

ParamTypeRequiredDescription
simstringrequiredThe ICCID of the SIM card
package_templateintegerrequiredThe package template ID to use
time_allowanceintegeroptionalOptional time allowance in seconds

Example Response

Status Code: 201 Created
Content-Type: application/json

Example Response
{
"id": "pkg_789012",
"sim": "8910300000045681955",
"package_template": 21145354,
"status": "NOT_ACTIVE",
"created_date": 1761330317000,
"time_allowance": 604800
}

The response includes the id - unique package identifier, sim - associated SIM ICCID, package_template - template used, and status - current package status.

Code Snippets

Hint: Use code snippets for reference on different programming environments. Customize the examples as needed.

Example - cURL
curl --location 'https://esim.betatel.com/api/v1/esim/packages' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--header 'x-user-id: {{x-user-id}}' \
--data '{
"sim": "89148000004012345678",
"package_template": 21145354,
"time_allowance": 604800
}'

Error Handling

Important: Attempting to create a package with an invalid or non-existent SIM or template ID will result in errors such as '404'.

  • 400 - Bad Request - Invalid input parameters
  • 404 - Not Found - SIM or package template not found
  • 401 - Unauthorized - Invalid or missing API key