Skip to content

API reference/address

List the streets at a postcode

GET/api/v1/address/streets

authentication
Secret API key as a bearer token
billing
1 credit per answered postcode, free for the next seven days for the same postcode. A country or postcode with nothing to list costs nothing.

Answers every street a national address register lists inside one postcode, in the register's own spelling and sorted: the list behind a street picker under a postcode field, and the list a single lookup's street_suggestion is drawn from. One call returns the whole postcode, so a form filters locally as the visitor types rather than calling per keystroke.

Open data only: the registers publish their streets and Spaw lists them back, with no house numbers and nothing about who is there. Available wherever a register with a street listing is installed — Switzerland, Austria, Czechia, Norway, Belgium, Luxembourg, Latvia, Australia and Denmark in full, the parts of the United States and France their registers carry, and Great Britain by postcode district from Ordnance Survey's Open Names. A country with no such register, and a postcode the register lists no street at, both answer 404 ADDRESS_STREETS_NOT_FOUND and cost nothing.

country is an ISO 3166-1 alpha-2 code the postal format table covers and postal_code the postcode in the country's own notation, with or without its space.

Parameters

name in type description
countryrequiredquerystringAn ISO 3166-1 alpha-2 code the postal format table covers, in either case. 2 to 2 characters.
postal_coderequiredquerystringThe postcode to list, in the country's own notation. At most 32 characters.

Example request

curl https://spaw.co/api/v1/address/streets \
  -H "Authorization: Bearer sk_live_…"
const response = await fetch('https://spaw.co/api/v1/address/streets', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer sk_live_…',
  },
});
const result = await response.json();
import requests

response = requests.get(
    'https://spaw.co/api/v1/address/streets',
    headers={'Authorization': 'Bearer sk_live_…'},
)
result = response.json()
$ch = curl_init('https://spaw.co/api/v1/address/streets');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer sk_live_…'],
]);
$result = json_decode(curl_exec($ch), true);
from spaw import Client

client = Client('sk_live_…')
result = client.address_streets('CH', '8001')
import Spaw from 'spaw';

const spaw = new Spaw({ apiKey: 'sk_live_…' });
const result = await spaw.addressStreets('CH', '8001');
use Spaw\Client;

$spaw = new Client('sk_live_…');
$result = $spaw->addressStreets('CH', '8001');

This endpoint has no console on its page. It bills per postcode and has no free guest path; the address checker under /tools/address-checker answers a single address for nothing.

Responses

200The streets the register lists at that postcode.

{
    "success": true,
    "data": {
        "country": "CH",
        "postal_code": "8001",
        "register": "ch-amtliches-gebaeudeadressverzeichnis",
        "streets": [
            "Bahnhofstrasse",
            "Limmatquai",
            "Münsterhof",
            "Paradeplatz",
            "Rennweg"
        ],
        "count": 5
    },
    "meta": {
        "credits_used": 1,
        "credits_remaining": 9,
        "cache_hit": false,
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}

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

402The balance is empty. The lookup did not run.

{
    "success": false,
    "error": {
        "code": "INSUFFICIENT_CREDITS",
        "message": "Your credit balance is empty.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}

404No register with a street listing covers the country, or the register lists no street at the postcode. Nothing was charged.

{
    "success": false,
    "error": {
        "code": "ADDRESS_STREETS_NOT_FOUND",
        "message": "No street is listed at 9999 in CH.",
        "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