Skip to main content
POST
OAuth 2.0 token
Sendcloud supports the OAuth 2.0 client credentials grant, which is intended for server-to-server integrations where your application acts on its own behalf. Send your client ID and client secret using HTTP Basic authentication, with grant_type=client_credentials and scope=api:
Use the returned access_token as a bearer token on subsequent API requests:
Access tokens expire 1 hour after they are issued. The client credentials grant does not return a refresh token: your application already holds its client credentials and can request a new access token at any time. Cache the access token and request a new one shortly before it expires, instead of requesting a token for every API call. The token endpoint returns a expires_in field, use this to cache the bearer token and refresh just before it expires.
You can find a list of open-source libraries to help with OAuth 2.0 authentication at https://oauth.net/code/

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/x-www-form-urlencoded
grant_type
enum<string>
required

The OAuth 2.0 grant type. Only client_credentials is supported.

Available options:
client_credentials
Example:

"client_credentials"

scope
string

The scope to request for the access token. Must be set to api, which grants access to the Sendcloud API.

Example:

"api"

client_id
string

Your OAuth 2.0 client ID. You can omit this field when you send your client ID and client secret using HTTP Basic authentication.

Response

OAuth2TokenExchange

OAuth2 Token Exchange Result

access_token
string

The access token issued by the authorization server.

Example:

"ory_at_dK..."

expires_in
integer<int64>

The lifetime in seconds of the access token. Access tokens issued through the client credentials grant expire 1 hour after they are issued, so this value is always close to 3600.

Example:

3599

scope
string

The scope of the access token

Example:

"api"

token_type
string

The type of the token issued

Example:

"bearer"