curl --request POST \
--url https://panel.sendcloud.sc/api/v3/addresses/validate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"address": {
"address_line_1": "Stadhuisplein",
"house_number": "50",
"address_line_2": "Apartment 17B",
"postal_code": "1013 AB",
"city": "Eindhoven",
"po_box": "<string>",
"state_province_code": "IT-RM",
"country_code": "NL"
},
"carrier_code": "trunkrs",
"validation_methods": [
"here"
]
}
'import requests
url = "https://panel.sendcloud.sc/api/v3/addresses/validate"
payload = {
"address": {
"address_line_1": "Stadhuisplein",
"house_number": "50",
"address_line_2": "Apartment 17B",
"postal_code": "1013 AB",
"city": "Eindhoven",
"po_box": "<string>",
"state_province_code": "IT-RM",
"country_code": "NL"
},
"carrier_code": "trunkrs",
"validation_methods": ["here"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: {
address_line_1: 'Stadhuisplein',
house_number: '50',
address_line_2: 'Apartment 17B',
postal_code: '1013 AB',
city: 'Eindhoven',
po_box: '<string>',
state_province_code: 'IT-RM',
country_code: 'NL'
},
carrier_code: 'trunkrs',
validation_methods: ['here']
})
};
fetch('https://panel.sendcloud.sc/api/v3/addresses/validate', 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/addresses/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => [
'address_line_1' => 'Stadhuisplein',
'house_number' => '50',
'address_line_2' => 'Apartment 17B',
'postal_code' => '1013 AB',
'city' => 'Eindhoven',
'po_box' => '<string>',
'state_province_code' => 'IT-RM',
'country_code' => 'NL'
],
'carrier_code' => 'trunkrs',
'validation_methods' => [
'here'
]
]),
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/addresses/validate"
payload := strings.NewReader("{\n \"address\": {\n \"address_line_1\": \"Stadhuisplein\",\n \"house_number\": \"50\",\n \"address_line_2\": \"Apartment 17B\",\n \"postal_code\": \"1013 AB\",\n \"city\": \"Eindhoven\",\n \"po_box\": \"<string>\",\n \"state_province_code\": \"IT-RM\",\n \"country_code\": \"NL\"\n },\n \"carrier_code\": \"trunkrs\",\n \"validation_methods\": [\n \"here\"\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://panel.sendcloud.sc/api/v3/addresses/validate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"address\": {\n \"address_line_1\": \"Stadhuisplein\",\n \"house_number\": \"50\",\n \"address_line_2\": \"Apartment 17B\",\n \"postal_code\": \"1013 AB\",\n \"city\": \"Eindhoven\",\n \"po_box\": \"<string>\",\n \"state_province_code\": \"IT-RM\",\n \"country_code\": \"NL\"\n },\n \"carrier_code\": \"trunkrs\",\n \"validation_methods\": [\n \"here\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://panel.sendcloud.sc/api/v3/addresses/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": {\n \"address_line_1\": \"Stadhuisplein\",\n \"house_number\": \"50\",\n \"address_line_2\": \"Apartment 17B\",\n \"postal_code\": \"1013 AB\",\n \"city\": \"Eindhoven\",\n \"po_box\": \"<string>\",\n \"state_province_code\": \"IT-RM\",\n \"country_code\": \"NL\"\n },\n \"carrier_code\": \"trunkrs\",\n \"validation_methods\": [\n \"here\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"input_address_is_valid": true,
"results": [
{
"address": {
"address_line_1": "Stadhuisplein",
"house_number": "50",
"address_line_2": "Apartment 17B",
"postal_code": "1013 AB",
"city": "Eindhoven",
"po_box": "<string>",
"state_province_code": "IT-RM",
"country_code": "NL"
},
"validation_method": "here",
"recommended": true,
"analysis": {
"validation_result": {
"is_valid": true,
"reasons": [
"ADDRESS_TOO_LONG"
]
},
"changed_attributes": [
"<string>"
],
"invalid_attributes": [
"<string>"
]
}
}
]
}{
"errors": [
{
"detail": "This field is required.",
"status": "400",
"source": {
"pointer": "/address/carrier_code"
},
"code": "required"
}
]
}Validate an address
This address validation endpoint allows you to validate shipping addresses before using them. By validating addresses in advance, you can ensure that the shipping information is accurate and complete, reducing the risk of delivery issues and improving overall shipping efficiency. Providing the carrier helps to tailor the address validation process according to specific carrier requirements. Using additional validation methods can further enhance the accuracy of the address verification.
The default Sendcloud validation, will always be applied, has in 2 steps:
-
checks the address against the carrier limits (e.g. maximum length of the address line, existence of the postal code for the country, etc.). see also Carrier address limits.
-
optimizes (washes) the address to fit within the carrier limits. (e.g. deduplication of address lines, abbreviations, etc.)
curl --request POST \
--url https://panel.sendcloud.sc/api/v3/addresses/validate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"address": {
"address_line_1": "Stadhuisplein",
"house_number": "50",
"address_line_2": "Apartment 17B",
"postal_code": "1013 AB",
"city": "Eindhoven",
"po_box": "<string>",
"state_province_code": "IT-RM",
"country_code": "NL"
},
"carrier_code": "trunkrs",
"validation_methods": [
"here"
]
}
'import requests
url = "https://panel.sendcloud.sc/api/v3/addresses/validate"
payload = {
"address": {
"address_line_1": "Stadhuisplein",
"house_number": "50",
"address_line_2": "Apartment 17B",
"postal_code": "1013 AB",
"city": "Eindhoven",
"po_box": "<string>",
"state_province_code": "IT-RM",
"country_code": "NL"
},
"carrier_code": "trunkrs",
"validation_methods": ["here"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
address: {
address_line_1: 'Stadhuisplein',
house_number: '50',
address_line_2: 'Apartment 17B',
postal_code: '1013 AB',
city: 'Eindhoven',
po_box: '<string>',
state_province_code: 'IT-RM',
country_code: 'NL'
},
carrier_code: 'trunkrs',
validation_methods: ['here']
})
};
fetch('https://panel.sendcloud.sc/api/v3/addresses/validate', 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/addresses/validate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => [
'address_line_1' => 'Stadhuisplein',
'house_number' => '50',
'address_line_2' => 'Apartment 17B',
'postal_code' => '1013 AB',
'city' => 'Eindhoven',
'po_box' => '<string>',
'state_province_code' => 'IT-RM',
'country_code' => 'NL'
],
'carrier_code' => 'trunkrs',
'validation_methods' => [
'here'
]
]),
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/addresses/validate"
payload := strings.NewReader("{\n \"address\": {\n \"address_line_1\": \"Stadhuisplein\",\n \"house_number\": \"50\",\n \"address_line_2\": \"Apartment 17B\",\n \"postal_code\": \"1013 AB\",\n \"city\": \"Eindhoven\",\n \"po_box\": \"<string>\",\n \"state_province_code\": \"IT-RM\",\n \"country_code\": \"NL\"\n },\n \"carrier_code\": \"trunkrs\",\n \"validation_methods\": [\n \"here\"\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://panel.sendcloud.sc/api/v3/addresses/validate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"address\": {\n \"address_line_1\": \"Stadhuisplein\",\n \"house_number\": \"50\",\n \"address_line_2\": \"Apartment 17B\",\n \"postal_code\": \"1013 AB\",\n \"city\": \"Eindhoven\",\n \"po_box\": \"<string>\",\n \"state_province_code\": \"IT-RM\",\n \"country_code\": \"NL\"\n },\n \"carrier_code\": \"trunkrs\",\n \"validation_methods\": [\n \"here\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://panel.sendcloud.sc/api/v3/addresses/validate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": {\n \"address_line_1\": \"Stadhuisplein\",\n \"house_number\": \"50\",\n \"address_line_2\": \"Apartment 17B\",\n \"postal_code\": \"1013 AB\",\n \"city\": \"Eindhoven\",\n \"po_box\": \"<string>\",\n \"state_province_code\": \"IT-RM\",\n \"country_code\": \"NL\"\n },\n \"carrier_code\": \"trunkrs\",\n \"validation_methods\": [\n \"here\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"input_address_is_valid": true,
"results": [
{
"address": {
"address_line_1": "Stadhuisplein",
"house_number": "50",
"address_line_2": "Apartment 17B",
"postal_code": "1013 AB",
"city": "Eindhoven",
"po_box": "<string>",
"state_province_code": "IT-RM",
"country_code": "NL"
},
"validation_method": "here",
"recommended": true,
"analysis": {
"validation_result": {
"is_valid": true,
"reasons": [
"ADDRESS_TOO_LONG"
]
},
"changed_attributes": [
"<string>"
],
"invalid_attributes": [
"<string>"
]
}
}
]
}{
"errors": [
{
"detail": "This field is required.",
"status": "400",
"source": {
"pointer": "/address/carrier_code"
},
"code": "required"
}
]
}- checks the address against the carrier limits (e.g. maximum length of the address line, existence of the postal code for the country, etc.). see also Carrier address limits.
- optimizes (washes) the address to fit within the carrier limits. (e.g. deduplication of address lines, abbreviations, etc.)
Authorizations
Basic Authentication using API key and secrets is currently the main authentication mechanism.
Headers
If you are an official Sendcloud Tech Partner, you can provide this additional request header for the system to recognize you. Sendcloud Partner UUID is provided to Sendcloud partners. The token is not required but if the header is set, the system will try to validate it. An unknown UUID will cause the 404 return, whilst an invalid one will return 400.
"550e8400-e29b-41d4-a716-446655440000"
Body
Address Washer Request object model
Raw address object
Show child attributes
Show child attributes
The code of the carrier to be used for the address validation. Only carriers available to your account can be used.
"trunkrs"
An array of optional address validation methods to be applied The default Sendcloud validation will always be applied.
here ["here"]
Response
Address validation successful
Address Washer Response object model