Before you begin
Before you can start making requests towards Sendcloud APIs, register a Sendcloud account, and obtain your Public and Secret API keys in order to authenticate your requests. When adding an API integration in the Sendcloud platform, take a look at the following settings:- Service Points: allows the API integration to be used in
servicepoint.sendcloud.scAPI. - Use OAuth2 authentication: enforces the integration to use OAuth2 authentication instead of basic, otherwise it fails.
OAuth2 authentication
OAuth2 provides a token-based authentication mechanism. Obtain an access token by authenticating with the OAuth2 server, then include the obtained token in theAuthorization headers of your API requests.
Example request using curl
Response body
Access tokens expire 1 hour after they are issued, as indicated by
expires_in (in seconds). Cache the access token
and request a new one shortly before it expires, instead of requesting a token for every API call.access_token, which you can use in subsequent API requests:
Example request using curl
Basic Authentication
Sendcloud uses Basic Authentication for authenticating requests for APIs, where your username is your Public Key and your password is your Private Key as provided for your integration.Do not share your Private API keys in publicly accessible areas such as GitHub, client-side code, etc.
Authenticating your requests
Once you have obtained your Public and Private keys, start authenticating your requests. To do this, include your keys in your requests.Example request using curl
Authorization header value is constructed by combining the API keys (base64-encoded) separated by a colon (:).
While this example uses curl, you can use any programming language or HTTP client that supports setting HTTP headers to make authenticated requests to the Sendcloud API.