Authentication

Before you can start making requests towards Sendcloud APIs, you will need to register and obtain your Public and Secret API keys and learn how to authenticate your requests.

Sendcloud Authentication

Sendcloud uses Basic Authentication for authenticating requests for APIs, where username is your Public Key and password 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, and so forth.

Authenticating your requests

Once you have obtained your Public and Private key you will need to start authenticating your requests, in order to so, you need to include your keys in your requests.

Here’s an example using curl to authenticate a request to the Sendcloud API:

1curl --location 'https://panel.sendcloud.sc/api/v2/parcels' \
2--header 'Accept: application/json' \
3--header 'Authorization: Basic <based-64-encoded-token>'


In the example above, the Authorization header value is constructed by combining the API keys (base64-encoded) separated by a colon (:)

Below is an example with the Python requests library. In this case, the base64 encoding is handled automatically, you just pass you public and private key.

1import requests
2
3# Replace 'your_sendcloud_public_key' and 'your_sendcloud_private_key' with your actual API keys
4public_key = "your_sendcloud_public_key"
5private_key = "your_sendcloud_private_key"
6
7r = requests.get('https://panel.sendcloud.sc/api/v2/parcels', auth=(public_key, private_key))
Go to top