Developer API
UK Address Generator API for Testing
PostcodeLab exposes the same test-record generator used by the website through a small JSON endpoint. It is intended for development, QA and demonstrations—not production identity, delivery or eligibility decisions.
By PostcodeLab · Published · Updated
Try the UK address generator API
Choose one endpoint to make a single same-origin request and inspect its real HTTP response. Nothing runs automatically: the playground waits for an explicit click, keeps only the current response in memory, and does not add batch generation, search, browser storage or a saved-record history.
Choose an endpoint to make one manual request.
Data boundary: a full-record response can contain a real-world postal location paired with unrelated synthetic fields. The postcode-only endpoint omits name, email and mobile fields. PostcodeLab does not persist the combination in application code; discard the response after testing and keep it out of production systems and logs.
Make a request
Send an HTTPS GET request and ask for JSON. No API key is currently required. The endpoint is rate limited, so clients should make requests only when a test needs a new record and should not use it as a production dependency. A machine-readable OpenAPI 3.1 description documents the supported single-record endpoints and schemas.
curl --request GET \
--header 'Accept: application/json' \
https://uk.chatgpt.org.uk/api/generate
JavaScript fetch
const response = await fetch('https://uk.chatgpt.org.uk/api/generate-postcode', {
headers: { Accept: 'application/json' },
});
if (!response.ok) throw new Error('HTTP ' + response.status);
const record = await response.json();
Python standard library
import json
from urllib.request import Request, urlopen
request = Request(
'https://uk.chatgpt.org.uk/api/generate-postcode',
headers={'Accept': 'application/json'},
)
with urlopen(request, timeout=12) as response:
record = json.load(response)
Postman and compatible API clients can import the OpenAPI 3.1 document instead of maintaining a separate collection. The contract intentionally contains no bulk, search, region, seed or persistence operation.
A successful request returns 200 OK. The response uses Cache-Control: private, no-store and X-Robots-Tag: noindex because generated records should not be cached or indexed.
Use /api/generate-postcode when the test only needs the selected postal record and matching postcode. That endpoint does not request a synthetic name or generate email and mobile fields.
Understand the response
{
"name": "Synthetic Name",
"gender": "Synthetic label",
"email": "generated@example.test",
"email_url": "https://mail.chatgpt.org.uk/generated@example.test",
"phone": "07432 581 XXX",
"phone_is_masked": true,
"phone_is_dialable": false,
"full_address": "Selected UK postal address",
"address_is_real_world": true,
"identity_is_synthetic": true
}
The exact response includes additional explanatory metadata. Treat the name, email and mobile pattern as synthetic fields that are unrelated to the selected postal location. The final three mobile digits remain literal X characters and must not be completed.
Test-data generation is not address lookup
PostcodeLab's API generates one random, non-production test record. It does not search by postcode, return a list of occupiers or properties, autocomplete an entered address, or confirm that a location is current and deliverable. Use the service that matches the decision your software needs to make.
| Developer task | Appropriate service |
|---|---|
| Exercise a form with one varied test payload | PostcodeLab single-record test-data API |
| Suggest addresses as a user types | A licensed address lookup or autocomplete provider with manual entry fallback |
| Confirm postcode existence or address matching | A maintained postcode directory or authoritative address product |
| Check delivery eligibility | The relevant carrier or service-specific availability endpoint |
For repeatable syntax testing without requesting a real-world postal record, use the versioned UK postcode validation test suite. For address-form interaction and accessibility states, use the constructed UK address form QA fixtures.
Handle limits and errors
The deployed limit is currently 30 requests per minute for a client. A limited request returns 429 Too Many Requests with a Retry-After header. Temporary data-service failures return a structured JSON error and a request_id for diagnosis.
- Use a request timeout and retry only transient failures with bounded backoff.
- Do not retry a
429response before itsRetry-Afterperiod. - Validate required fields before placing them in a test fixture.
- Keep generated payloads out of production logs, customer systems and analytics.
- Use your own deterministic fixture when a test must be perfectly repeatable.
Integration boundaries
The API does not verify that an address is deliverable, current or connected to any generated identity. It is not a KYC, fraud, credit, residency, occupancy or eligibility service. If a workflow makes a real-world decision, use the appropriate authoritative provider and a documented lawful purpose.
For browser automation, wait for the JSON response instead of scraping rendered page text. For server-side tests, avoid high parallelism and keep a local fallback fixture so an external dependency cannot make the whole suite unreliable.
Official references
Related developer guides
UK Test Data Guide for QA and Development
Plan safer UK test data for QA and development with environment separation, data minimisation, retention controls, logging safeguards and review steps.
Read guidePostcodeLab Data Methodology and Sources
See how PostcodeLab selects UK postal records, separates synthetic identity fields, masks mobile patterns, handles removals and documents data limitations.
Read guideUK Address Form Test Cases and QA Checklist
Use practical UK address form test cases for field variation, postcodes, lookup failure, accessibility, mobile layouts, exports and integration safety.
Read guideUK Address Lookup and Autocomplete Guide
Design a resilient UK address lookup and autocomplete flow with postcode search, editable results, manual entry, accessibility and provider safeguards.
Read guide