API

Token

An access token, issued for your client credentials. Valid for 30 days and meant to be reused.

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
POST /v1/auth/token create OK

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

created, err := client.Token(nil).Create(map[string]any{"clientId": "example", "clientSecret": "example", "grant_type": "example", "scope": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(created)

Lua

Construct client as shown in the Lua setup, then call the operations:

local created, err = client:Token():create({ clientId = "example", clientSecret = "example", grant_type = "example", scope = "example" })

PHP

Construct client as shown in the PHP setup, then call the operations:

$created = $client->Token()->create(["clientId" => "example", "clientSecret" => "example", "grant_type" => "example", "scope" => "example"]);

Python

Construct client as shown in the Python setup, then call the operations:

created = client.Token().create({ "clientId": "example", "clientSecret": "example", "grant_type": "example", "scope": "example" })

Ruby

Construct client as shown in the Ruby setup, then call the operations:

created = client.Token.create({ "clientId" => "example", "clientSecret" => "example", "grant_type" => "example", "scope" => "example" })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const created = await client.Token().create({ clientId: "example", clientSecret: "example", grant_type: "example", scope: "example" })

Fields

Field Type Required Description
access_token string No Access Token represent as a Bearer Token, used with the Authorization header
clientId string Yes The client ID is unique to the client application on that authorization server.
clientSecret string Yes A client secret is a secret known only to your application and the authorization server.
data object Yes Warning: The data field in this response is deprecated, please use fields at the root of this Token Resonse
expires_in number No The number of seconds the token is valid for, represented as an integer
grant_type string Yes The Client Credentials grant type is used by clients to obtain an access token outside of the context of a user
scope string No A list of scopes that have been authorized against the token
token_type string No Type of token the authorization server has issued.

create

POST /v1/auth/token

Operation ID: POST/v1/auth/token.

Authentication: not required.

Request body

application/json

Property Type Required Description
clientId string Yes The client ID is unique to the client application on that authorization server.
clientSecret string Yes A client secret is a secret known only to your application and the authorization server. It protects your resources by only granting tokens to authorized requestors. Protect your client secrets and never include them in mobile or browser-based apps
grant_type enum: client_credentials Yes The Client Credentials grant type is used by clients to obtain an access token outside of the context of a user
scope string Yes A list of scopes that are requried

Responses

200: OK

application/json

Property Type Required Description
access_token string No Access Token represent as a Bearer Token, used with the Authorization header
data object No Warning: The data field in this response is deprecated, please use fields at the root of this Token Resonse
data.access_token string Yes Access Token represent as a Bearer Token, used with the Authorization header
data.expires_in number Yes Token expiration time represented as an unix epoch timestamp
data.scope string Yes A list of scopes that have been authorized against the token
data.token_type enum: Bearer Yes Type of token the authorization server has issued.
expires_in number No The number of seconds the token is valid for, represented as an integer
scope string No A list of scopes that have been authorized against the token
token_type enum: Bearer No Type of token the authorization server has issued.
400: Bad Request

application/json

Property Type Required Description
error string Yes 400 Bad Request is the status code that indicates the server cannot or will not process the request due to something that is perceived to be a client error
401: Unauthorized

application/json

Property Type Required Description
error string Yes 401 Unauthorized is the status code to return when the client provides no credentials or invalid credentials.
403: Forbidden

application/json

Property Type Required Description
error string Yes 403 Forbidden is the status code to return when a client has valid credentials but not enough privileges to perform an action on a resource.
429: Too Many Requests

application/json

Property Type Required Description
error string Yes 429 Too Many Requests is the status code that indicates the client application has surpassed its rate limit, or number of requests they can send in a given period of time