How can I get or generate an access token for testing?

Problem statement

I need to quickly gather an Access Token to test my API.


If you need a Management API Token for testing environments, you can follow our documentation here:

Otherwise, you can use an M2M application with the Client Credentials flow to retrieve an access token for any of your APIs (including Management APIv2 in production environments) by sending this request:

curl --request POST \
  --url 'https://{yourDomain}/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=client_credentials \
  --data 'client_id={yourM2MClientId}' \
  --data 'client_secret={yourM2MClientSecret}' \
  --data 'audience={yourApiIdentifier}

Postman’s example:

More details here: