Docs / Postal codes
Look up a postal code
Returns the places and approximate coordinates for a postal code. Coordinates are area centroids, not street addresses.
GET
/v1/postal-codes/{country}/{code}import { Client } from "@liveapiio/liveapi";
const client = new Client({ token: process.env.LIVEAPI_TOKEN });
const postal = await client.postalCode("US", "90210");Request
Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.
| Field | Type | Description |
|---|---|---|
| country | string | ISO country code. Path parameter. |
| code | string | Postal code. Spaces and hyphens are ignored. Path parameter. |
Response
A 200 response uses one call. In CA, IE, NL, and GB the source holds only the leading part of each code, so a longer code can match with match set to partial.
Errors
A failed request returns { "error": { "code", "message" } } and does not use a call.
| Status | Code | When |
|---|---|---|
| 404 | not_found | Unknown code or country. |
| 503 | data_unavailable | Postal code data is not available right now. |
| 401 | unauthorized | The bearer token is missing or not recognized. |