API Endpoints

Census Demographics

Age by 5 year Age Bands

Tokens
× 1

API Credit Cost


Endpoint Overview

Census2021 Demographics

The Age by 5 Year Age Bands endpoint provides a breakdown of the population within a postcode area by five-year age groups, offering detailed demographic insights for targeted analysis.


Coverage

EnglandEngland
WalesWales

Update Frequency

Census

Request Format

HTTP Method:

GET

To use the API you should send an HTTP request to the following endpoint URL. This will return a JSON response.

https://api.postcodearea.co.uk/census-ts007a/?key=&postcode={postcode}

Note that your key has automatically been added to the API endpoint for convenience.

Querystring Parameters:

{postcode}

A valid UK postcode (e.g., SW1A 1AA). Note that you can send the postcode with or without the space separating the outward and inward codes. For example, both "SW1A 1AA" and "SW1A1AA" are both valid.

{api_key}

A valid API key that authenticates your account.


Authorisation

For every endpoint request your API Key should be sent as part of the querystring:

https://api.postcodearea.co.uk/census-ts007a/?key={api_key}&postcode=WS3+3PD

For example:

https://api.postcodearea.co.uk/census-ts007a/?key=&postcode=WS3+3PD

Example Request and Response

If the above URL endpoint exists and the API key is valid, our system will return the following example response:

https://api.postcodearea.co.uk/census-ts007a/?key=&postcode=WS3+3PD
{"data":[{"Postcode":"ST20 0LY","Age: Total":312,"Age: Aged 4 years and under":7,"Age: Aged 5 to 9 years":8,"Age: Aged 10 to 14 years":16,"Age: Aged 15 to 19 years":13,"Age: Aged 20 to 24 years":9,"Age: Aged 25 to 29 years":8,"Age: Aged 30 to 34 years":3,"Age: Aged 35 to 39 years":10,"Age: Aged 40 to 44 years":7,"Age: Aged 45 to 49 years":29,"Age: Aged 50 to 54 years":28,"Age: Aged 55 to 59 years":27,"Age: Aged 60 to 64 years":30,"Age: Aged 65 to 69 years":26,"Age: Aged 70 to 74 years":31,"Age: Aged 75 to 79 years":39,"Age: Aged 80 to 84 years":9,"Age: Aged 85 years and over":12}],"response_time":0.0156,"Source":"PostcodeArea API","Output Area":"OA","Radius":10,"Distance Unit":"Mile","Records":1,"Unique Fields":1,"Referrer":"api.postcodearea.co.uk","Host":"https://api.postcodearea.co.uk/census-ts007a/?key=pa_XWQAV24RXCUU19NGUFM11TKTLN&postcode=st200ly","Endpoint":"/census-ts007a/?key=pa_XWQAV24RXCUU19NGUFM11TKTLN&postcode=st200ly"}

Error Handling

HTTP Status Code Error Message Reason
400 Invalid postcode format The postcode provided is not valid.
401 Unauthorised request API key missing or invalid.
404 Postcode not found No data available for the given postcode.
404 No Results Found No data available for the given radius.
429 Too many requests Exceeded rate limit.
500 Internal server error An unexpected issue occurred.

Caching Policy

You may temporarily cache data retrieved from the API for performance optimisation purposes, provided that the cached data is:

  1. Stored in-memory only (e.g., application-level cache).
  2. Retained for no longer than one hour.

Caching API data to any persistent storage, including but not limited to databases, files, or external systems, constitutes a breach of our API Terms and Conditions. Such actions are strictly prohibited to ensure data accuracy and compliance with our licensing agreements.

If you have specific requirements for extended caching, you must seek prior written consent from us.


Get started today

Ready to use this data for your own business or organisation? Sign up today and get immediate access to all the PostcodeArea API endpoints.

Share this page