Frequently Asked Question

PostCodeLookup - Get detailed information for any UK Postcode
Last Updated 7 days 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.php

Authentication

This API requires authentication using an API key. The key should be passed in the HTTP_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.
This website relies on temporary cookies to function, but no personal data is ever stored in the cookies.
OK
Powered by GEN UK CLEAN GREEN ENERGY

Loading ...