Token
A short-lived access token, issued for your client credentials.
Operations
Every route this entity exposes. Each route links to its own reference on this page.
| Method | Route | SDK operation | Returns |
|---|---|---|---|
POST |
/api/v1/auth/token |
create |
Returns the access token |
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{"access_token": "example", "expires_in": 1, "grant_type": "example", "scope": "example", "token_type": "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({ access_token = "example", expires_in = 1, grant_type = "example", scope = "example", token_type = "example" })
PHP
Construct client as shown in the PHP setup, then call the operations:
$created = $client->Token()->create(["access_token" => "example", "expires_in" => 1, "grant_type" => "example", "scope" => "example", "token_type" => "example"]);
Python
Construct client as shown in the Python setup, then call the operations:
created = client.Token().create({ "access_token": "example", "expires_in": 1, "grant_type": "example", "scope": "example", "token_type": "example" })
Ruby
Construct client as shown in the Ruby setup, then call the operations:
created = client.Token.create({ "access_token" => "example", "expires_in" => 1, "grant_type" => "example", "scope" => "example", "token_type" => "example" })
TypeScript
Construct client as shown in the TypeScript setup, then call the operations:
const created = await client.Token().create({ access_token: "example", expires_in: 1, grant_type: "example", scope: "example", token_type: "example" })
Fields
| Field | Type | Required | Description |
|---|---|---|---|
access_token |
string |
Yes | The JWT access token. |
expires_in |
number |
Yes | Expiration time of the token in seconds. |
grant_type |
string |
Yes | The type of grant being requested. |
scope |
string |
Yes | Scopes being requested. |
token_type |
string |
Yes | Token type. |
create
POST /api/v1/auth/token
Operation ID: AuthController_token_v1.
Request body
application/x-www-form-urlencoded
| Property | Type | Required | Description |
|---|---|---|---|
grant_type |
enum: client_credentials |
Yes | The type of grant being requested. |
scope |
string |
Yes | Scopes being requested. Must be a space-separated list of scopes. |
Responses
200: Returns the access token
application/json
| Property | Type | Required | Description |
|---|---|---|---|
access_token |
string |
Yes | The JWT access token. |
expires_in |
number |
Yes | Expiration time of the token in seconds. |
token_type |
string |
Yes | Token type. |
400: The request is not formatted correctly
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
string |
Yes | Error code representing the type of error. |
error_description |
string |
Yes | Detailed message describing the error. |
503: The OAuth service is currently unavailable
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
string |
Yes | Error code representing the type of error. |
error_description |
string |
Yes | Detailed message describing the error. |
Example response:
{
"error": "server_error",
"error_description": "The authorization server is currently unavailable"
}