Frequently Asked Question
PostCodeLookup - Get detailed information for any UK Postcode
Last Updated 10 months ago
PostCodeLookup API
Overview
The PostCodeLookup API provides detailed information about UK postcodes, including county, local authority, and additional geographical data.
Version
1.002
Endpoint
/v2/pclookup
Authentication
This API requires authentication using an API key. The key should be passed in the X_API_Key header.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| p | string | UK Postcode (required, max 8 characters) |
Response
The API returns a JSON object with the following structure:
| Field | Type | Description |
|---|---|---|
| status | string | "ok" if successful, or an error message |
| County Name | string | Name of the county |
| Local Authority Name | string | Name of the local authority |
| Rendered County | string | Either the real county name or local authority name if county is pseudo |
| detail | object | Additional postcode details from postcodes.io API |
| ... | various | Other fields from the NSPC database |
Example Response (Success)
{
"status": "ok",
"County Name": "Greater London",
"Local Authority Name": "Westminster",
"Rendered County": "Greater London",
"detail": {
"postcode": "SW1A 1AA",
"quality": 1,
"eastings": 530047,
"northings": 179951,
"country": "England",
"nhs_ha": "London",
"longitude": -0.141588,
"latitude": 51.501009,
...
},
...
}
Example Response (Error)
{
"status": "Postcode not found"
}
Error Handling
- If no postcode is provided:
{"status": "Invalid postcode"} - If the postcode is not found in the database:
{"status": "Postcode not found"} - If there's an authentication error:
{"status": "[validation status]"}
Notes
- The API combines data from several databases.
- The postcode is sanitised and converted to uppercase before querying the database.
- If the county name contains "pseudo", the API returns the Local Authority Name as the Rendered County.
Security
- Ensure that the API key is kept secure and not exposed in client-side code.
Limitations
- The API is limited to UK postcodes.
