Skip to main content
POST
/
actions
/
purchase
/
esims
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const purchase = await client.actions.purchase.create({ amount: 10 });

console.log(purchase.data);
{
  "data": [
    {
      "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "record_type": "sim_card",
      "status": {
        "value": "enabled",
        "reason": "The SIM card is active, ready to connect to networks and consume data."
      },
      "type": "physical",
      "iccid": "89310410106543789301",
      "imsi": "081932214823362973",
      "msisdn": "+13109976224",
      "sim_card_group_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "tags": [
        "personal",
        "customers",
        "active-customers"
      ],
      "data_limit": {
        "amount": "2048.0",
        "unit": "MB"
      },
      "current_billing_period_consumed_data": {
        "amount": "2049.0",
        "unit": "MB"
      },
      "actions_in_progress": true,
      "created_at": "2018-02-02T22:25:27.521Z",
      "updated_at": "2018-02-02T22:25:27.521Z",
      "esim_installation_status": "released",
      "version": "4.3",
      "resources_with_in_progress_actions": [],
      "eid": null,
      "authorized_imeis": [
        "106516771852751",
        "534051870479563",
        "508821468377961"
      ]
    }
  ],
  "errors": [
    {
      "code": "<string>",
      "title": "<string>",
      "detail": "<string>",
      "source": {
        "pointer": "<string>",
        "parameter": "<string>"
      },
      "meta": {}
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
amount
integer
required

The amount of eSIMs to be purchased.

Required range: x >= 1
Example:

10

sim_card_group_id
string<uuid>

The group SIMCardGroup identification. This attribute can be <code>null</code> when it's present in an associated resource.

Example:

"6a09cdc3-8948-47f0-aa62-74ac943d6c58"

tags
string[]

Searchable tags associated with the SIM cards

Example:
["personal", "customers", "active-customers"]
product
string

Type of product to be purchased, specify "whitelabel" to use a custom SPN

Example:

"whitelabel"

whitelabel_name
string

Service Provider Name (SPN) for the Whitelabel eSIM product. It will be displayed as the mobile service name by operating systems of smartphones. This parameter must only contain letters, numbers and whitespaces.

Example:

"Custom SPN"

status
enum<string>
default:enabled

Status on which the SIM cards will be set after being successfully registered.

Available options:
enabled,
disabled,
standby
Example:

"standby"

Response

Successful response

data
SIMCard · object[]

Successfully registered SIM cards.

errors
object[]