Skip to main content
POST
/
contracts
Create a contract for a carrier
curl --request POST \
  --url https://panel.sendcloud.sc/api/v3/contracts \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contract_data": {
    "country": "NL",
    "client_id": "sendcloud-1"
  },
  "carrier_code": "postnl",
  "is_active": false,
  "is_default_per_carrier": false
}
'
{
  "data": {
    "id": 60,
    "carrier": {
      "code": "lettresuivie",
      "name": "Lettre Suivie"
    },
    "client_id": "sendcloud-1",
    "is_active": false,
    "country": "FR",
    "is_default": false
  }
}
This endpoint creates a contract for a carrier.
Creating a carrier contract via the API is not supported for 2FA carriers, including UPS, Hermes, Amazon, Bol, and FedEx. To create a carrier contract for these carriers, please use the Sendcloud panel.
After creating a contract, its initial state will be "validating". This means the system is verifying the contract data with carriers, which typically takes only a few seconds, depending on the carriers. Once validation is complete, the contract’s state will change to one of the following:
  • "active" or "inactive": The contract has been successfully processed.
  • "validation_failed": An error occurred during validation. Additional information about the failure will be provided.
You can check the current state of the contract using the Retrieve a contract endpoint.

Authorizations

Authorization
string
header
required

Basic Authentication using API key and secrets is currently the main authentication mechanism.

Body

application/json

Contract request object model

contract_data
object
required

Fields for creating a contract. It supports dynamic key-value pairs, where keys represent field names and values are string-based data.

Example:
{
"country": "NL",
"client_id": "sendcloud-1"
}
carrier_code
string
required

The carrier code of the contract

Example:

"postnl"

is_active
boolean
default:false

New contracts are inactive by default, if you want to activate it immediately set this flag.

Example:

false

is_default_per_carrier
boolean
default:false

Marks the contract as default for a carrier. You can have only one default direct contract per carrier.

Example:

false

Response

OK

Create a contract

data
Contract · object

User contract