Skip to Content
Terminal Docs

Make your first API call

In this tutorial you create an API key, use it to get an access token, and ask the API for one SIM’s details. At the end you have the SIM’s status, data package and usage as a JSON response in your terminal.

Before you start

You need:

Create an API key

  1. In Terminal, go to Apps > API.
  2. Select + Create API key.
  3. Under Label, enter first-test.
  4. Under Permissions, choose Read.
  5. Leave IP whitelist (optional) empty.
  6. Select Create API key.

Terminal shows Your API key has been created, with a username and password. Copy both and keep them somewhere safe. Terminal shows the password only once.

Get an access token

Run this command. Put your username and password in place of the placeholders.

curl -X POST "https://api.1ot.mobi/v1/oauth/token?username=YOUR_USERNAME&password=YOUR_PASSWORD&grant_type=password"

You now see a response like this:

{"access_token":"cdfgf91f-...","expires_in":3153600000,"refresh_token":"55th0b4d-...","scope":"read write trust","token_type":"bearer"}

Copy the access_token. It doesn’t expire, so you only need to do this once.

Ask for one SIM’s details

Run this command. Put your access token and ICCID in place of the placeholders.

curl "https://api.1ot.mobi/v1/get_sim?iccid=YOUR_ICCID" -H "Authorization: YOUR_ACCESS_TOKEN"

You now see the SIM’s details as JSON, including its state, which matches the SIM status you see in Terminal.

What you’ve done

You created an API key, got an access token and read a SIM’s details through the 1oT Terminal API.

Next steps

On this page