Skip to content

Get an access token

POST
/oauth/token
curl --request POST \
--url https://api.devsecure.io/oauth/token \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data 'scope=issues:read scans:read' \
--data client_id=devsc_exampleexample00 \
--data client_secret=example

Exchange OAuth client credentials for a short-lived bearer access token (client credentials grant). The token carries the client’s scopes, or the requested subset.

Media typeapplication/x-www-form-urlencoded
object
grant_type
required
string
Allowed values: client_credentials
scope

Optional space-separated subset of the client’s scopes.

string
client_id

Only when not using HTTP Basic.

string
client_secret

Only when not using HTTP Basic.

string format: password

OK.

Media typeapplication/json
TokenResponse
object
access_token
required
Access Token
string
token_type
Token Type
string
default: Bearer
Allowed value: Bearer
expires_in
required
Expires In

Seconds until the token expires.

integer
scope
required
Scope

Space-separated scopes.

string
Example
{
"access_token": "devsat_exampleexample00_EXAMPLE-not-a-real-token-EXAMPLE-0000000",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "issues:read scans:read"
}
X-Request-ID
string

Identifies the request; quote it to support.

Invalid request, grant type or scope.

Media typeapplication/json
OAuthErrorResponse
object
error
required
Error
string
error_description
required
Error Description
string
request_id
required
Any of:
string
Example
{
"error": "invalid_client",
"error_description": "Client authentication failed.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}

Client authentication failed.

Media typeapplication/json
OAuthErrorResponse
object
error
required
Error
string
error_description
required
Error Description
string
request_id
required
Any of:
string
Example
{
"error": "invalid_client",
"error_description": "Client authentication failed.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}

The workspace’s plan does not include API access.

Media typeapplication/json
OAuthErrorResponse
object
error
required
Error
string
error_description
required
Error Description
string
request_id
required
Any of:
string
Example
{
"error": "invalid_client",
"error_description": "Client authentication failed.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}

Too many requests.

Media typeapplication/json
OAuthErrorResponse
object
error
required
Error
string
error_description
required
Error Description
string
request_id
required
Any of:
string
Example
{
"error": "invalid_client",
"error_description": "Client authentication failed.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}