> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emnify.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emnify.com/_mcp/server.

> Explore and test GraphQL queries using the in-browser IDE.

There's an in-browser [emnify GraphiQL IDE](https://graphql-playground.emnify.net/) where you can experiment with the GraphQL API.

Similar to OpenAPI in the REST world, [GraphiQL](https://github.com/graphql/graphiql) (pronounced "graphical") helps you accurately structure and validate queries, then run them directly against the server endpoint.
It's equipped with tools to help you try out the GraphQL API.
Notable features include autocompleting, syntax highlighting, interactive documentation, and schema explorers.

> **Tip**
>
> If you're new to GraphQL, visit the [official GraphQL documentation](https://graphql.org/learn/) to familiarize yourself with how the query language is structured.

## Navigate the interface

The UI is divided into three parts:

* **Sidebar** where you can open plugin panes and change settings
* **Left panel** where you write your queries
* **Right panel** where the results of your queries are displayed

![](https://user-images.githubusercontent.com/25433336/225385087-37c5fa5c-4b23-4fca-a1b5-675974392473.png)

At the top of the sidebar, there are buttons for the documentation explorer, history, and GraphiQL explorer.
Underneath, the sidebar shows buttons that allow you to re-fetch the GraphQL schema, see the keyboard shortcuts, and change settings.

The bottom of the left panel has two sections, **Variables** and **Headers**.
By default, there's a placeholder for the **Authorization** header.

When you type queries into this side of the screen, the IDE provides autocomplete based on the current GraphQL type schema and live syntax and validation error highlighting.

An example GraphQL query might look like this:

```graphql
{
  field(arg: "value") {
    subField
  }
}
```

> **Tip**
>
> GraphQL queries typically start with a `{` character.
> Lines that start with a `#` are ignored.

## Authorization

To make calls from this IDE, you need to provide an authentication token in the **Headers** section.

### Retrieve your authentication token

Use the emnify REST API to retrieve your authentication token.
For step-by-step instructions, see [Authenticate with application tokens](/developers/auth/application-tokens).

### Add your authentication token to GraphiQL

Once you have your authentication token, you need to pass that token to the GraphiQL IDE.

Navigate to the [emnify GraphiQL IDE](https://graphql-playground.emnify.net/)

Locate the **Headers** section
By default, this section has the following placeholder:

```http
{
  "Authorization": "Bearer AUTH_TOKEN"
}
```

Replace *`AUTH_TOKEN`* with your authentication token value

> **Check**
>
> To test that you're authorized, click the **Execute query** button (▶️) and check your result.

## Execute your first query

> **Note**
>
> GraphiQL's interactive documentation is used throughout this example.
> To follow along, click the **Show Documentation Explorer** button in the sidebar.
> Once the **Docs** are visible, choose `Query`, then select `myUser`.
>
> ![](/_fern-files/_img/0837057073fd5f4ff7b55e5b20496859de9b2b66f4e9e869d45cd2d6da9d3d96.webp)

When you first visit the GraphiQL IDE, there's a pre-populated example query in the left panel:

```graphql
{
  myUser {
    organisation {
      name
      id
    }
  }
}
```

In this example, `myUser` is a [query](https://graphql.org/learn/queries/) that can return your user and organization details, including endpoint (device) status and active tariff plan (data plan).

![Docs panel with the query description and its User return type](/_fern-files/_img/0652b1d470f3170d4df47f293000d34053bf4783016bce6cc8f707379cb3dabe.webp)

> **Tip**
>
> In GraphQL, the `!` means that [variable definition](https://graphql.org/learn/queries/#variable-definitions) is required.

Within `myUser`, `User` is listed as a required [object type](https://graphql.org/learn/schema/#object-types-and-fields) and indicates which [fields](https://graphql.org/learn/queries/#fields) you can use in this query.
Because `User` is the only type available, you don't need to type it out explicitly.

![Docs panel listing the fields of the User type, including id, username, and organisation](/_fern-files/_img/298fc96432a0e69a3c9c66e445f5b519a393bf0c2efd890a281a33996fa47309.webp)

This example uses the `organisation` field, which requires the `Organisation` object type.
You want to receive the `name` and `id` fields from that object type.

![Docs panel listing the fields of the Organisation type, including id, name, and the active tariff plan](/_fern-files/_img/24fceea6bda3486ac28f98bf47087150ca6cb955ce73967262d3f97b35fdb945.webp)

Finally, when you execute the query, it returns a `data` object with your requested information.

![Query response with a data object holding the organisation name and id](/_fern-files/_img/88737992a5096cb0e49cafe1bfbd607f8223a2c4e5c08443db9f4589daed3fe7.webp)

## Write your own query

Remove any content in the left panel and begin typing:

```graphql
{

}
```

Inside the curly braces, you can start typing or use the keyboard shortcuts to open the autocomplete window.

In the following example, the IDE suggests `endpoint`, `endpoints`, and `endpointsQuery` once you've started typing "end":

![](/_fern-files/_img/819429e492f3d3e0d005fc892096cda2e05a699742f1c361140bc58c078ff71d.webp)

If you need help with what to write, click the **Show GraphiQL Explorer** button on the sidebar.

![](/_fern-files/_img/c15949b03cbf621e1a7b17b3b57c23a60bc2831c1375bf2515047225b38d18be.webp)

This displays an interactive overview of the current GraphQL schema.
Open and select your desired fields, and the query builds and formats itself automatically.

![Explorer panel with the endpoint connectivity services field checked and the generated query beside it](/_fern-files/_img/21148920b5eaf703bad293a5f38e48bf77d3e28582dc9fadf793f54e25b6f4f2.webp)

> **Tip**
>
> To see the queries you've executed during a session, click the **Show history** button on the sidebar.
>
> ![](/_fern-files/_img/6cb09d899cdf2283376f3aadfed751188a872ee253252d92367f26962509c078.webp)

## Generate code from your query

On the left panel are buttons allowing you to generate a cURL query, Node.js code, or Python code from your GraphQL query.
Click these buttons to copy this code to your clipboard.

![CURL, Node.js, and Python code buttons highlighted beside the query editor](/_fern-files/_img/ef3b93216ade7b522f92905a371f92c1b30034b0943120357f8566cf077f5d8d.webp)

The following examples show code generated from the default query:

#### curl

```shell
curl -X POST \
  -H "Authorization: Bearer AUTH_TOKEN" \
  -H "Content-Type: application/json" \
    https://cdn.emnify.net/graphql \
    --data-raw '{"query":"{\n  myUser {\n    organisation {\n      name\n      id\n    }\n  }\n}"}'
```

#### Node.js

```js
var axios = require('axios');
var data = JSON.stringify({
  query: `{
  myUser {
    organisation {
      name
      id
    }
  }
}`,
  variables: {}
});

var config = {
  method: 'post',
  url: 'https://cdn.emnify.net/graphql',
  headers: {
    'Authorization': 'Bearer AUTH_TOKEN',
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

#### Python

```python maxLines=0
import requests
import json

url = "https://cdn.emnify.net/graphql"

payload = {"query": """{
  myUser {
    organisation {
      name
      id
    }
  }
}"""}
headers = {
  'Authorization': 'Bearer AUTH_TOKEN',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=json.dumps(payload))

print(response.text)
```