Create endpoints

After registering SIMs, you need to create a virtual representation of the device associated with the SIM. In the emnify REST API, this is called an endpoint.

You can create one or multiple endpoints using the Create an Endpoint API call. In this call, you must:

Optionally, you can also:

  • Assign and activate a SIM
  • Set tags
  • Designate the IMEI and enable IMEI lock
  • Designate the IP address and space

This guide uses the Postman API platform for example purposes. Each time you use the emnify REST API, you must authenticate in Postman.

For more information, see How to use the REST API via Postman on the emnify Developer Blog.

Individual endpoint

To create a new request in Postman, click +New in the upper left corner. Name the request Endpoint creation and add it to a new collection called Endpoints.

Then follow these steps to set up your request:

1

Select the POST HTTP method.

2

Set the request URL as https://cdn.emnify.net/api/v1/endpoint

3

Navigate to the Headers tab. Insert Content-Type and Authorization as Keys and add the respective Values application/json and Bearer TOKEN. Replace TOKEN with your auth_token and make sure there’s a non-breaking space between Bearer and the token value.

4

Go to the Body tab and select raw. Make sure the format is set to JSON. Then, specify the endpoint details.

To get your endpoint online immediately, set the endpoint status to Enabled and activate the SIM card:

1{
2 "name": "ENDPOINT_NAME",
3 "status": {
4 "id": 0
5 },
6 "service_profile": {
7 "id": SERVICE_PROFILE_ID
8 },
9 "tariff_profile": {
10 "id": TARIFF_PROFILE_ID
11 },
12 "sim": {
13 "id": SIM_ID,
14 "activate": true
15 }
16}

Keep in mind that a monthly cost is charged for each activated SIM card, even if the endpoint status is set to Disabled.

If you don’t plan on using the endpoint right away, set the endpoint status to Disabled and don’t activate the SIM:

1{
2 "name": "ENDPOINT_NAME",
3 "status": {
4 "id": 1
5 },
6 "service_profile": {
7 "id": SERVICE_PROFILE_ID
8 },
9 "tariff_profile": {
10 "id": TARIFF_PROFILE_ID
11 },
12 "sim": {
13 "id": SIM_ID,
14 "activate": false
15 }
16}

The activate property defaults to false, so you can also omit it.

5

To complete the request, click Send.

A 200 OK response status indicates the successful creation of the endpoint.

Multiple endpoints

Prepare your data

The most efficient way to create multiple endpoints via the emnify REST API is to have your data prepared in a comma-separated values (CSV) file.

One way to generate a CSV file is to create a table in Excel that includes the necessary endpoint details. After you create your file, do the following:

1

In the first row, insert the required properties as columns: endpoint_name, sim_id, service_profile, tariff_profile. If any SIMs shouldn’t be activated immediately, include a sim_activate column.

2

Fill in the corresponding data for your endpoints. Each row should represent one endpoint.

3

Once complete, save it as a CSV file (.csv).

Run the API in bulk with Postman

Check the rate limits before running the API in bulk.

If you haven’t already, set up your Endpoint creation request using the process outlined in the preceding “Individual endpoint” section. Then, follow these steps:

1

Click Runner in the lower right corner.

2

Choose how to run your collection and set your Run configuration:

  • Iterations: Number of devices you want to create (also the number of rows from your CSV file).
  • Delay: Time between calls. Best practice is 1000 ms regardless of how many devices you’re creating.
  • Data: Upload your CSV file with the Data File Type set to text/csv.
3

Adjust any other settings as necessary, then click Start Run.