API reference/address

Import known-dead addresses

POST/api/v1/address/suppressions

authentication
Secret API key as a bearer token
billing
Free.

Adds up to 10,000 addresses per request to the postal suppression list — a mailing house's return file, a hand-kept list. Each item is a written address or an object of the same fields the single lookup takes, and may name its own country; country at the top level applies to the rest. Addresses are folded the way a lookup folds them; ones that name no building (no postcode or locality, no street, no house number) are counted as invalid. Entries that already exist are never overwritten and are counted as already_suppressed. Imported entries are honoured from day one at no credit cost: batch, bulk and monitor runs answer them with reason suppressed.

Request body

field type description
itemsrequiredstring[]1 to 10,000 addresses. Each item is a written address as a string, or an object of the same fields the single lookup takes.
items[].addressstring | nullThe whole address written as it would be on an envelope. At most 500 characters.
items[].address_line1string | nullThe street line, when the address arrives separated. At most 255 characters.
items[].address_line2string | nullAt most 255 characters.
items[].organizationstring | nullAt most 200 characters.
items[].dependent_localitystring | nullAt most 100 characters.
items[].localitystring | nullAt most 100 characters.
items[].administrative_areastring | nullAt most 100 characters.
items[].postal_codestring | nullAt most 32 characters.
items[].po_boxstring | nullAt most 64 characters.
items[].countrystring | nullThis item's own country. Wins over the list-level one. At most 2 characters.
countrystring | nullAn ISO 3166-1 alpha-2 code applied to every item that does not name its own. At most 2 characters.

Example request

curl -X POST https://spaw.co/api/v1/address/suppressions \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
  "country": "GB",
  "items": [
    "221B Baker Street, London NW1 6XE",
    {
      "address_line1": "10 Downing Street",
      "locality": "London",
      "postal_code": "SW1A 2AA"
    }
  ]
}'
const response = await fetch('https://spaw.co/api/v1/address/suppressions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_live_…',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "country": "GB",
    "items": [
      "221B Baker Street, London NW1 6XE",
      {
        "address_line1": "10 Downing Street",
        "locality": "London",
        "postal_code": "SW1A 2AA"
      }
    ]
  }),
});
const result = await response.json();
import requests

response = requests.post(
    'https://spaw.co/api/v1/address/suppressions',
    headers={'Authorization': 'Bearer sk_live_…'},
    json={
        'country': 'GB',
        'items': [
            '221B Baker Street, London NW1 6XE',
            {
                'address_line1': '10 Downing Street',
                'locality': 'London',
                'postal_code': 'SW1A 2AA'
            }
        ]
    },
)
result = response.json()
$ch = curl_init('https://spaw.co/api/v1/address/suppressions');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['Authorization: Bearer sk_live_…', 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => json_encode([
        'country' => 'GB',
        'items' => [
            '221B Baker Street, London NW1 6XE',
            [
                'address_line1' => '10 Downing Street',
                'locality' => 'London',
                'postal_code' => 'SW1A 2AA'
            ]
        ]
    ]),
]);
$result = json_decode(curl_exec($ch), true);

Responses

200How many entries were added, already present, or named no building.

{
    "success": true,
    "data": {
        "added": 2,
        "already_suppressed": 0,
        "invalid": 0
    }
}

401The key is missing, malformed, or revoked.

{
    "success": false,
    "error": {
        "code": "UNAUTHENTICATED",
        "message": "Provide a valid API key as a bearer token.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}

422The request body could not be validated; `error.errors` lists the fields.

{
    "success": false,
    "error": {
        "code": "VALIDATION_FAILED",
        "message": "The email field is required.",
        "errors": {
            "email": [
                "The email field is required."
            ]
        },
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}

429Over 5 requests per second for the key. Retry after the limit resets.

{
    "success": false,
    "error": {
        "code": "RATE_LIMITED",
        "message": "Too many requests. Retry after the limit resets.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}

Error codes

Failures answer { success: false, error: { code, message, request_id } }. Each code has its own page.

markdown version·openapi.json