API reference/phone

Import known-dead numbers

POST/api/v1/phone/suppressions

authentication
Secret API key as a bearer token
billing
Free.

Adds up to 10,000 numbers per request to the phone suppression list — an SMS provider's failure export, a hand-kept blocklist. Each item is a number in any notation or an object naming its own country; country at the top level applies to the rest. Numbers are normalised to E.164 first; ones that are not valid subscriber numbers (including national notation with no country) 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 numbers, each a string of at most 32 characters or an object with its own country.
items[].phonestringAt most 32 characters.
items[].countrystring | nullAn ISO 3166-1 alpha-2 region code for this number.
countrystring | nullThe region for items written without a calling code that name none of their own.

Example request

curl -X POST https://spaw.co/api/v1/phone/suppressions \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    "+1 415 201 0142",
    {
      "phone": "07911 012345",
      "country": "GB"
    }
  ]
}'
const response = await fetch('https://spaw.co/api/v1/phone/suppressions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_live_…',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "items": [
      "+1 415 201 0142",
      {
        "phone": "07911 012345",
        "country": "GB"
      }
    ]
  }),
});
const result = await response.json();
import requests

response = requests.post(
    'https://spaw.co/api/v1/phone/suppressions',
    headers={'Authorization': 'Bearer sk_live_…'},
    json={
        'items': [
            '+1 415 201 0142',
            {
                'phone': '07911 012345',
                'country': 'GB'
            }
        ]
    },
)
result = response.json()
$ch = curl_init('https://spaw.co/api/v1/phone/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([
        'items' => [
            '+1 415 201 0142',
            [
                'phone' => '07911 012345',
                'country' => 'GB'
            ]
        ]
    ]),
]);
$result = json_decode(curl_exec($ch), true);

Responses

200How many entries were added, already present, or not valid numbers.

{
    "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