Authentication
You'll need to authenticate your requests to access any of the endpoints in the n_2 API. In this guide, we'll look at how authentication works using company tokens.
Company token authentication
Company tokens are the primary method for authenticating API requests to n_2. These tokens are used to make API calls in the name of a company and provide access to all resources of that company. Unlike user tokens, company tokens are not tied to individual users. There can be only one company token per company at a time.
Company tokens are never-expiring tokens. Keep them safe and do not share them with anyone. In case you suspect that a token has been compromised, revoke it immediately.
Generate your company token
There are two ways to manage company tokens:
Via the Dashboard UI
The easiest way to generate a company token is through the dashboard on the integrations page. You can create, view, and revoke your token directly from the UI.
Via API endpoints
You can also manage company tokens programmatically using these API endpoints:
Get current company token
Get existing company token
curl https://api.n2api.io/auth/company_token
Create a new company token
Create new company token
curl https://api.n2api.io/auth/company_token \
--request POST
Revoke company token
Revoke company token
curl https://api.n2api.io/auth/company_token \
--request DELETE
Using your company token
Once you have your company token, you can use it in the Authorization
header of your API requests:
Example request with company token
curl -X 'GET' \
'https://api.n2api.io/v1/platforms' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <company_token>'