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"
}
'import requests
url = "https://panel.sendcloud.sc/api/v3/contracts/{id}"
payload = {
"is_active": False,
"is_default_per_carrier": False,
"contract_data": {
"country": "NL",
"client_id": "sendcloud-1"
},
"name": "main"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
is_active: false,
is_default_per_carrier: false,
contract_data: {country: 'NL', client_id: 'sendcloud-1'},
name: 'main'
})
};
fetch('https://panel.sendcloud.sc/api/v3/contracts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://panel.sendcloud.sc/api/v3/contracts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'is_active' => false,
'is_default_per_carrier' => false,
'contract_data' => [
'country' => 'NL',
'client_id' => 'sendcloud-1'
],
'name' => 'main'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://panel.sendcloud.sc/api/v3/contracts/{id}"
payload := strings.NewReader("{\n \"is_active\": false,\n \"is_default_per_carrier\": false,\n \"contract_data\": {\n \"country\": \"NL\",\n \"client_id\": \"sendcloud-1\"\n },\n \"name\": \"main\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://panel.sendcloud.sc/api/v3/contracts/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"is_active\": false,\n \"is_default_per_carrier\": false,\n \"contract_data\": {\n \"country\": \"NL\",\n \"client_id\": \"sendcloud-1\"\n },\n \"name\": \"main\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://panel.sendcloud.sc/api/v3/contracts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"is_active\": false,\n \"is_default_per_carrier\": false,\n \"contract_data\": {\n \"country\": \"NL\",\n \"client_id\": \"sendcloud-1\"\n },\n \"name\": \"main\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 60,
"carrier": {
"code": "lettresuivie",
"name": "Lettre Suivie"
},
"client_id": "sendcloud-1",
"is_default_per_carrier": true,
"state": "active",
"type": "direct"
}
}{
"errors": [
{
"detail": "This field is required.",
"status": "400",
"source": {
"pointer": "/data/client_id"
},
"code": "required"
}
]
}{
"errors": [
{
"status": "<string>",
"detail": "<string>",
"id": "<string>",
"links": {
"about": "<string>"
},
"title": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>",
"header": "<string>"
},
"meta": {}
}
]
}Update a contract
Update or replace a contract by including the id of the contract as a path parameter.
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"
}
'import requests
url = "https://panel.sendcloud.sc/api/v3/contracts/{id}"
payload = {
"is_active": False,
"is_default_per_carrier": False,
"contract_data": {
"country": "NL",
"client_id": "sendcloud-1"
},
"name": "main"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
is_active: false,
is_default_per_carrier: false,
contract_data: {country: 'NL', client_id: 'sendcloud-1'},
name: 'main'
})
};
fetch('https://panel.sendcloud.sc/api/v3/contracts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://panel.sendcloud.sc/api/v3/contracts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'is_active' => false,
'is_default_per_carrier' => false,
'contract_data' => [
'country' => 'NL',
'client_id' => 'sendcloud-1'
],
'name' => 'main'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://panel.sendcloud.sc/api/v3/contracts/{id}"
payload := strings.NewReader("{\n \"is_active\": false,\n \"is_default_per_carrier\": false,\n \"contract_data\": {\n \"country\": \"NL\",\n \"client_id\": \"sendcloud-1\"\n },\n \"name\": \"main\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://panel.sendcloud.sc/api/v3/contracts/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"is_active\": false,\n \"is_default_per_carrier\": false,\n \"contract_data\": {\n \"country\": \"NL\",\n \"client_id\": \"sendcloud-1\"\n },\n \"name\": \"main\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://panel.sendcloud.sc/api/v3/contracts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"is_active\": false,\n \"is_default_per_carrier\": false,\n \"contract_data\": {\n \"country\": \"NL\",\n \"client_id\": \"sendcloud-1\"\n },\n \"name\": \"main\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 60,
"carrier": {
"code": "lettresuivie",
"name": "Lettre Suivie"
},
"client_id": "sendcloud-1",
"is_default_per_carrier": true,
"state": "active",
"type": "direct"
}
}{
"errors": [
{
"detail": "This field is required.",
"status": "400",
"source": {
"pointer": "/data/client_id"
},
"code": "required"
}
]
}{
"errors": [
{
"status": "<string>",
"detail": "<string>",
"id": "<string>",
"links": {
"about": "<string>"
},
"title": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>",
"header": "<string>"
},
"meta": {}
}
]
}Authorizations
Basic Authentication using API key and secrets is currently the main authentication mechanism.
Path Parameters
The id of the contract.
Body
Update request object model
New contracts are inactive by default, if you want to activate it immediately set this flag.
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.
false
Fields for creating a contract. It supports dynamic key-value pairs, where keys represent field names and values are string-based data.
Show child attributes
Show child attributes
{
"country": "NL",
"client_id": "sendcloud-1"
}
The name of the contract
50"main"
Response
OK
Update contract
User contract
Show child attributes
Show child attributes