API Endpoints

Community and Leisure

Libraries

Tokens
× 1

API Credit Cost


Endpoint Overview

The Libraries endpoint provides information on libraries within a postcode radius, including their names, locations, and available services.


Coverage

EnglandEngland
ScotlandScotland
WalesWales
N. IrelandN. Ireland

Update Frequency

Annually

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/libraries/?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/libraries/?key={api_key}&postcode=WS3+3PD

For example:

https://api.postcodearea.co.uk/libraries/?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/libraries/?key=&postcode=WS3+3PD
{"data":[{"Library Name":"Gnosall Library","Address 1":"Lowfield Lane","Address 2":"Gnosall","Address 3":"","Address 4":"","Town":"Stafford","County":"Staffordshire","Postcode":"ST20 0ET","Phone":"01785824989","Website":"www.staffordshire.gov.uk/leisure/librariesnew/branchlibraries/GnosallLibrary/GnosallLibrary.aspx","Email":"","Latitude":"52.78271","Longitude":"-2.251423","Distance":0.349384761467441},{"Library Name":"Eccleshall Library","Address 1":"20 High Street","Address 2":"","Address 3":"","Address 4":"Eccleshall","Town":"Stafford","County":"Staffordshire","Postcode":"ST21 6BZ","Phone":"01785850452","Website":"www.staffordshire.gov.uk/cgi-bin/MsmGo.exe?grab_id=61&page_id=1842432&query=Eccleshall+Library&hiword=Eccleshall+Library+","Email":"eccleshall.library@staffordshire.gov.uk","Latitude":"52.85965","Longitude":"-2.254126","Distance":5.01217148723507},{"Library Name":"Rising Brook Library","Address 1":"Merrey Road","Address 2":"","Address 3":"","Address 4":"","Town":"Stafford","County":"Staffordshire","Postcode":"ST17 9LX","Phone":"01785242155","Website":"www.staffordshire.gov.uk/cgi-bin/MsmGo.exe?grab_id=61&page_id=723456&query=Rising+Brook+Library&hiword=Brook+Library+Rising+","Email":"risingbrook.library@staffordshire.gov.uk","Latitude":"52.7868","Longitude":"-2.119097","Distance":5.37297329859631},{"Library Name":"Holmcroft Library","Address 1":"Holmcroft Road","Address 2":"","Address 3":"","Address 4":"","Town":"Stafford","County":"Staffordshire","Postcode":"ST16 1JG","Phone":"01785253908","Website":"www.staffordshire.gov.uk/leisure/librariesnew/libraries.aspx","Email":"","Latitude":"52.82241","Longitude":"-2.132016","Distance":5.40657183362722},{"Library Name":"Newport Library","Address 1":"53-55 High Street","Address 2":"","Address 3":"","Address 4":"","Town":"Newport","County":"Shropshire","Postcode":"TF10 7AT","Phone":"01952382965","Website":"www.telford.gov.uk/libraries","Email":"newport.library@telford.gov","Latitude":"52.76828","Longitude":"-2.37818","Distance":5.61238590543053},{"Library Name":"Stafford Library","Address 1":"Shire Hall","Address 2":"Market Street","Address 3":"","Address 4":"","Town":"Stafford","County":"Staffordshire","Postcode":"ST16 2LQ","Phone":"01785278585","Website":"www.staffordshire.gov.uk/leisure/libraries/branchlibraries/StaffordLibrary.htm","Email":"stafford.library@staffordshire.gov.uk","Latitude":"52.80693","Longitude":"-2.115769","Distance":5.67523349993771},{"Library Name":"Penkridge Library","Address 1":"Bellbrook","Address 2":"Penkridge","Address 3":"","Address 4":"","Town":"Stafford","County":"Staffordshire","Postcode":"ST19 5DL","Phone":"01785712916","Website":"www.staffordshire.gov.uk/cgi-bin/MsmGo.exe?grab_id=61&page_id=592384&query=Penkridge+Library&hiword=Library+Penkridge+","Email":"penkridge.library@staffordshire.gov.uk","Latitude":"52.72575","Longitude":"-2.112948","Distance":7.05863426395977}],"response_time":0,"Source":"PostcodeArea API","Output Area":"Radius","Radius":10,"Distance Unit":"Mile","Records":7,"Unique Fields":14,"Referrer":"api.postcodearea.co.uk","Host":"https://api.postcodearea.co.uk/libraries/?key=pa_XWQAV24RXCUU19NGUFM11TKTLN&postcode=st200ly","Endpoint":"/libraries/?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