Skip to main content
PATCH
/
contracts
/
{id}
Update a contract
curl --request PATCH \
  --url https://panel.sendcloud.sc/api/v3/contracts/{id} \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "is_active": false,
  "is_default_per_carrier": false,
  "contract_data": {
    "country": "NL",
    "client_id": "sendcloud-1"
  },
  "name": "main"
}
'
{
  "data": {
    "id": 60,
    "carrier": {
      "code": "lettresuivie",
      "name": "Lettre Suivie"
    },
    "client_id": "sendcloud-1",
    "is_default_per_carrier": true,
    "state": "active",
    "type": "direct"
  }
}
This endpoint will either update or replace a contract. Changes to unused contracts or the contract’s state and description will be done in place and not cause a new contract to be created (name, is_active, is_default, is_per_carrier_default). However, used contracts are immutable, if you change the contract_data of a contract that has already been used for shipments, it will cause a new contract ID to be created. In this case, the old one will no longer be active for use. After updating a contract with contract_data, we need to validate it again and its state will be "validating". During the validation the contract is not active and cannot be used for creating shipments. The validation process is asynchronous and will happen in the background. 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.

Authorizations

Authorization
string
header
required

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

Path Parameters

id
integer
required

The id of the contract.

Body

application/json

Update request object model

is_active
boolean

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.

Note: You cannot mark a contract as not default, to switch the default contract of a carrier use is_default_per_carrier: true on the contract you like to set as active, other contracts for this carrier will automatically be marked as not default.

Example:

false

contract_data
object

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"
}
name
string

The name of the contract

Maximum string length: 50
Example:

"main"

Response

OK

Update contract

data
Contract · object

User contract