Generate an access token

When everything is setup the next thing you need to do is to use your client id and client secret ,in combination with the Next database number and the one-time API key, to generate an access token. This token can be used for further interaction with the API. Access tokens are created by using the /token endpoint like the example below.

curl -X 'POST' \
  '' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&username=next_database_number&password=your_one_time_api_key&scope=&client_id=client_id&client_secret=client_secret'

Username should be set to the database number for the Next customer and the password should be set to the one-time API Key created in previous step.

In response to the above request, you will receive a JSON object containing the access token.

  "access_token": "5109d8fc-aade-46ea-a355-2d707ba16b82",  
  "token_type": "bearer"  

That token shall be included as an authorization header in all requests to the API as demonstrated in the curl command below.

curl -X 'GET' \
  '' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer 5109d8fc-aade-46ea-a355-2d707ba16b82'

An access token has no maximum lifetime but it can be revoked by deleting the API Key in Next. If you lose the token or if it is disabled, a new token must be created from Next as described above.