Insomnia
Insomnia is an HTTP client for testing APIs. It imports Postman collections in the v2.1 format natively, so the file is the same one used for Postman — there is no separate version for Insomnia.
⬇️ Download
There are 24 requests, organized in the same folders as the menu of this documentation, with folder and request names in Portuguese, exactly as they appear in the file. The collection is the same one for all three clients — the folder list is in What comes in the collection, and the documents used in the requests are in Sample data. This page covers only what changes in Insomnia.
The description of each request becomes its Docs tab in Insomnia, with the link to the corresponding reference page and the warnings about the routes that behave unexpectedly.
How to import
- In Insomnia, open the Dashboard and click Import, at the top right.
- Choose File, or drag the
nextcode-apis.postman_collection.jsonfile into the window. - Confirm with Scan and then with Import.
Insomnia recognizes the file as a Postman collection and creates a collection named Nextcode APIs, with the five folders.
How to set the variables
The variables of the collection arrive in Insomnia as the collection's base environment.
- Open the Nextcode APIs collection.
- Click the environment selector, at the top of the sidebar, and choose Manage Environments (or press
Ctrl/Cmd+E). - Fill in the values in the Base Environment:
{
"baseUrl": "https://api-homolog.nxcd.app",
"apiKey": "YOUR_API_KEY",
"livenessRequestId": ""
}What each variable means is described in How to set the variables.
Keep staging apart from production
Instead of swapping baseUrl every time, create two sub-environments — one per URL, each with its own key — and switch between them through the environment selector.
Check the authentication after importing
In the collection, authentication is configured at the collection level, as an API Key in the header:
Authorization: ApiKey {{apiKey}}Depending on the version of Insomnia, that configuration may not come along in the import. Check it before the first call:
- Right-click the Nextcode APIs collection and choose Settings.
- Open the Auth tab.
- If it is set to None, switch it to API Key and fill in:
- Key:
Authorization - Value:
ApiKey {{apiKey}} - Add to:
Header
- Key:
- In the requests, leave the authentication as Inherit from parent.
A 401 on the first call is the symptom that this configuration did not come along.
Endpoints with file upload
The file fields already exist in the body of the request, but empty: the file comes from your computer and has to be picked by you.
- Open the request and go to the Body tab, under Multipart Form.
- On the row of the field (
file, orfrenteandverso, ordocumentoandselfie), click Choose File and select the image or the PDF. - Send it.
The name of the field, the limits on format and size and the two endpoints that require two files are covered in Endpoints with file upload.