Skip to content

2. Get the token

You need a valid authorization token to use the API.

To get the token you must have an expert.ai developer account. Visit the developer portal and sign up to get one.

If you are going to make your first call using an interactive tool like curl or Postman, follow the instructions below to get the token by using the same tool.
If, instead, you are going to make the first call using an SDK client, you can go to the next step since the client is able to get the token by itself.

Get the token with curl

To get the authorization token with curl, run the following command from a shell after replacing yourusername and yourpassword with your account credentials:

curl -X POST https://developer.expert.ai/oauth2/token \
    -H 'Content-Type: application/json; charset=utf-8' \
    -d '{
  "username": "yourusername",
  "password": "yourpassword"
}'

To get the authorization token with curl, open a command prompt in the folder where you installed curl and run the following command after replacing yourusername and yourpassword with your account credentials:

curl -X POST https://developer.expert.ai/oauth2/token -H "Content-Type: application/json; charset=utf-8" -d "{\"username\": \"yourusername\", \"password\": \"yourpassword\"}"

The token is the command output, note it down or copy it to the clipboard.

Get the token with Postman

To obtain the token with Postman:

  1. Run Postman.
  2. Expand the expert.ai Natural Language API collection you imported when you set up Postman.
  3. Select token.
  4. Edit the raw Body of the request replacing yourusername and yourpassword with your account credentials.
  5. Select Send in the right panel — the token will appear in the response.

The next step

You are now ready to make your first call.