Importing our API into Insomnia and other API clients, and setting the Bearer key

WhatsApp & APIs·· 13 views· 3 min read

The short answer: Insomnia, like most API clients, imports our OpenAPI specification and creates every request in one go. What changes from one client to the next is the name of the menus; the steps are the same: import, put the key in a variable, authenticate with Bearer, and test.

In Insomnia

1 Have the specification ready: the link is in the API reference, Specification section, or download the openapi.json file.
2 Use the Import option and choose to import from a link or from a file. Insomnia recognises the OpenAPI format and creates the requests.
3 Create an environment with a variable for the key, for example rlx_api_key, holding your sandbox_ key.
4 In the auth settings of the requests, or of the folder that groups them, choose Bearer Token and use the variable, for example {{ _.rlx_api_key }}.
5 Test with GET /v1/ping, which needs no key, and then with GET /v1/token.

In other clients

Clients such as Bruno and Hoppscotch also import OpenAPI specifications. Look for the import option, choose OpenAPI and follow the same order. In all of them, authentication is the same: the Authorization: Bearer header followed by the key.

If the import fails

Symptom What to try
The client says it does not recognise the version The specification is OpenAPI 3.1. Update the client: older versions of some tools only read 3.0.
Importing from the link does not work Download the file and import it from disk.
Requests go to the wrong address Check the base address in the environment or collection. The paths already start with /v1.
401 error The key is missing, mistyped, revoked or expired. Check that the variable has a value in the active environment.
A desktop client keeps the key in its own data. Use a sandbox_ key for testing, do not export collections with the key, and if you share it by mistake, revoke it: what to do, in the right order.
Prefer Postman? Its steps, with the right variables, are in importing the API into Postman.

The specification link is at the end of the API reference.

See the specification

SEE ALSO

Importing our API into Postman from the OpenAPI specification, step by step

The OpenAPI specification of our API: what it is, where to download it and what it contains

Generating an API client for your language from our OpenAPI specification

Your key in the API Playground: where it stays, why sandbox_ first, and the prod_ warning

An API key or token has leaked: what to do, in the right order

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from £5.28/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.