POST /api/v2/oauth/tokens

Returns an OAuth access token with a specified scope.

Refresh tokens aren't used. An access token doesn't expire but it can be revoked.

For a tutorial, see Creating and using OAuth tokens with the API.

Note: For OAuth authorization code, use the Create Token for Grant Type endpoint. The two APIs don't share the same path, JSON format, or request parameters. However, both APIs return access tokens that can be used to authenticate API requests.

Allowed For

Request parameters

The POST request takes a "token" object that contains an OAuth client's resource id and scopes.

NameTypeDescription
client_idintegerThe resource id of an OAuth client (not the client's unique identifier). For the ids, see List Clients
scopesarrayValid scopes for the token. See Scopes below

Scopes

The scopes parameter defines whether requests authenticated with the token can post, put, and delete data, or only get data.

Note: Don't confuse the scopes parameter (plural) with the scope parameter (singular) for grant-type tokens.

The scopes parameter is an array of strings, each specifying a resource name and an access setting. Access is either "read" or "write". If you don't specify a resource, access to all resources is assumed. If you don't specify the access, read and write access are assumed.

The syntax is as follows:

"scopes": [resource:scope, ...]

where resource is optional.

Examples

"scopes": ["read"]

"scopes": ["tickets:read"]

To give read and write access to a resource, specify both scopes:

"scopes": ["users:read", "users:write"]

To give write access only to one resource and read access to everything else:

"scopes": ["organizations:write", "read"]

Note: The endpoint returns an access token even if you specify an invalid scope. Any request you make with the token will return a "Forbidden" error.

Available scopes

Resources that can be scoped

Servers

Query parameters

Name Type Required Description
client_id Integer No

The id of the OAuth client

all Boolean No

A boolean that returns all OAuth tokens in the account. Requires admin role

global_client_id Integer No

The id of the global OAuth client

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.