Generate access token

This endpoint allows API users to generate an access token for a user.

In the request, specify the grant_type to use:

  • password: generate an access token using the password grant.

  • refresh_token: generate an access token using the refresh token grant.

  • authorization_code: generate an access token using the authorization code grant.

See also: Authentication.

post/oauth2/token

Request

Request body multipart/form-data

usernamestring required

User email. Required if grant_type: password.

passwordstring required

User password. Required if grant_type: password.

grant_typestring required

Specifies the grant type for authorization. Possible values: password, refresh_token, authorization_code.

scopestring

Permissions for the issued token; * grants all permissions. Using scope, you can define a custom list of accessible URLs. For example: document/* GET/user will allow access to: 1) all routes starting with /document/ 2) GET /user route

refresh_tokenstring

The refresh token value, obtained from the Generate access token response. Required if grant_type: refresh_token.

codestring

The authorization code, obtained from the Get authorization code response. Required if grant_type: authorization_code.

expiration_timeinteger

Time until the token expires in seconds. Default value is 2592000 seconds (30 days).

Response

Returns an access_token for the user, along with its type, scope, expiration time, and refresh_token.

scopestring

Scope of the access token, for example *.

expires_ininteger

Number of seconds before the access token expires.

last_logininteger

1 if this is a repeat login, 0 for the first login of the user.

token_typestring

Type of the token. Always bearer.

access_tokenstring

Access token.

refresh_tokenstring

Refresh token. Use it to get a new access token with the refresh_token grant.

Changes

No recorded changes to this operation across all 1 revision of this API.