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:
- Name the endpoint
- Set the endpoint status
- Assign a service profile
- Assign a tariff profile
Optionally, you can also:
- Assign and activate a SIM
- Set tags
- Designate the IMEI and enable IMEI lock
- Designate the IP address and space
Note: 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.
Alternatively, you can create devices via the emnify Portal. For step-by-step instructions, see Create a device in the emnify Documentation.
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:
- Select the POST HTTP method.
- Set the request URL as https://cdn.emnify.net/api/v1/endpoint
- Navigate to the Headers tab. Insert
Content-Type
andAuthorization
as Keys and add the respective Valuesapplication/json
andBearer TOKEN
. ReplaceTOKEN
with yourauth_token
and make sure there’s a non-breaking space betweenBearer
and the token value.
- 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:
{
"name": "ENDPOINT_NAME",
"status": {
"id": 0
},
"service_profile": {
"id": SERVICE_PROFILE_ID
},
"tariff_profile": {
"id": TARIFF_PROFILE_ID
},
"sim": {
"id": SIM_ID,
"activate": true
}
}
The activate
property defaults to true
, so you can also omit it. 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:
{
"name": "ENDPOINT_NAME",
"status": {
"id": 1
},
"service_profile": {
"id": SERVICE_PROFILE_ID
},
"tariff_profile": {
"id": TARIFF_PROFILE_ID
},
"sim": {
"id": SIM_ID,
"activate": false
}
}
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:
- 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 asim_activate
column. - Fill in the corresponding data for your endpoints. Each row should represent one endpoint.
- Once complete, save it as a CSV file (
.csv
).
Run the API in bulk with Postman
Warning: 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:
- Click Runner in the lower right corner.
- 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
.
- Adjust any other settings as necessary, then click Start Run.