Exchange client credentials for an access token (grant_type=client_credentials)
POST
/oauth/token
const url = 'https://acme.gravitastec.com/api/v1/oauth/token';const options = { method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'}, body: new URLSearchParams({ grant_type: 'client_credentials', client_id: 'example', client_secret: 'example' })};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://acme.gravitastec.com/api/v1/oauth/token \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data grant_type=client_credentials \ --data client_id=example \ --data client_secret=exampleRequest Bodyrequired
Sección titulada «Request Bodyrequired»Media typeapplication/x-www-form-urlencoded
object
grant_type
required
string
client_id
required
string
client_secret
required
string
Responses
Sección titulada «Responses»Token
Media typeapplication/json
object
access_token
string
token_type
string
expires_in
integer
Example
{ "token_type": "Bearer", "expires_in": 900}Invalid_client / unsupported_grant_type (RFC 6749)
Plan without API access (code limit_exceeded)