Tray Embedded / Embedded Apis / Insomnia GraphQL collection (local testing)

Insomnia GraphQL collection (local testing)

Click here to download our collection for the Insomnia Http client

This will provide you with a local testing environment which allows you to very quickly run queries and mutations on your live data, before inspecting the results.

IMPORTANT!: You will be interacting with live production data and any changes will be permanent.

Import the Tray Embedded library

In your Insomnia Workspace click on the drop-down to import the above downloaded file:


Click on 'embedded tokens' followed by 'Manage Environments':


Then you can see that the base url is

If you are in the EU region, change the base URL to

If you are in the Asia Pacific region, change the base URL to


Then enter your master token (you can enter tokens from different accounts if you are using the Import / Export project APIs) obtained from the Embedded Dashboard (don't worry about the user_token error here - it will be rectified when you first use it):


Creating a session with a user token

One of the main benefits of using Insomnia is that it has dynamic environment variables.

With the Tray Embedded Insomnia library, we have set up a dynamic variable for user token such that when you run the 'Create User Access Token' mutation with a valid userID, the user token will then automatically be available for all queries and mutations that require it.

For example we can create a user token for a user and then get that user's authentications. Here you will see that you do not have to copy and paste the access token, because once it is created it is automatically pulled in to the 'Get User Authentications' endpoint:


The steps taken were:

  1. Use the 'Get Users' query to obtain the userId of an End User

  2. Paste that userId into 'Query Variables' for the 'Create User Token' mutation

  3. 'Send' to create the User Token

The User Token is then automatically available for all queries and mutations that require it.

Note that you can also switch between user and master token for queries that can use either.

Using fragments

Some queries have multiple data filtering and input options.

For example, with the 'Get Users' query you can get all users, filter by userId, get the first 5 users etc.

So for this endpoint we have created a fragment whereby we first specify fields we want to be returned. Then we can click on the request we want to make (e.g. Get user by ID) before clicking ‘send’:


Using autocomplete

Using a valid master or user token means that you are connected to the Tray Embedded API schema.

In Insomnia this means you can use 'ctrl + space' to bring up an auto-complete list of available fields to be returned: