# List the addresses at a postcode

`GET /api/v1/address/postcode/{postcode}`

- Authentication: Secret API key as a bearer token
- Billing: 2 credits per answered list, which is what the licensed partner charges through. A country with no partner configured answers 501 and costs nothing, and so does a partner that could not answer.
- Group: Address

Answers the addresses at one postcode, in the partner's own order, for callers that want a "find my address" picker under a postcode field.

This is the one address answer no open dataset carries: every full address list is derived from a postal operator's own address file, and serving it needs a licence. Until a partner is configured for the country, the endpoint answers `501 ADDRESS_LIST_UNAVAILABLE` and charges nothing, rather than returning an empty list that would read as "there are no addresses here". Nothing else in the address API depends on it.

`country` is an ISO 3166-1 alpha-2 code and defaults to `GB`. The postcode is passed in the path, with or without its space (`NW1 6XE` and `NW16XE` are the same postcode). At most 100 addresses are returned for one postcode; `count` is how many the answer carries.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `postcode` | path | string | yes | The postcode to list, in the country's own notation. |
| `country` | query | string | no | An ISO 3166-1 alpha-2 code the postal format table covers. Default: GB. |

## Example request

```bash
curl https://spaw.co/api/v1/address/postcode/NW1 6XE \
  -H "Authorization: Bearer sk_live_…"
```

## Responses

### 200 — The addresses the partner lists at that postcode.

```json
{
    "success": true,
    "data": {
        "postcode": "NW1 6XE",
        "country": "GB",
        "available": true,
        "addresses": [
            {
                "address_line1": "221B Baker Street",
                "address_line2": null,
                "organization": null,
                "street": "Baker Street",
                "house_number": "221B",
                "unit": null,
                "locality": "London",
                "administrative_area": null,
                "postal_code": "NW1 6XE",
                "country": "GB",
                "identifier": "10023456789"
            }
        ],
        "count": 1
    },
    "meta": {
        "credits_used": 2,
        "credits_remaining": 8,
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 401 — The key is missing, malformed, or revoked.

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

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

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

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

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

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

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

### 501 — No licensed address-list partner is configured for the country. Nothing was charged.

```json
{
    "success": false,
    "error": {
        "code": "ADDRESS_LIST_UNAVAILABLE",
        "message": "Listing the addresses at a postcode needs a licensed address-list partner, and none is configured for GB.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

## Error codes

- `UNAUTHENTICATED` — https://spaw.co/docs/errors/UNAUTHENTICATED
- `VALIDATION_FAILED` — https://spaw.co/docs/errors/VALIDATION_FAILED
- `INSUFFICIENT_CREDITS` — https://spaw.co/docs/errors/INSUFFICIENT_CREDITS
- `ADDRESS_LIST_UNAVAILABLE` — https://spaw.co/docs/errors/ADDRESS_LIST_UNAVAILABLE
- `RATE_LIMITED` — https://spaw.co/docs/errors/RATE_LIMITED

---

Canonical page: https://spaw.co/docs/api/find-addresses-by-postcode · OpenAPI document: https://spaw.co/openapi.json · All endpoints: https://spaw.co/docs/api
