{"openapi":"3.1.0","info":{"title":"UK Grounding Postcode API","version":"1.0.0","description":"Unauthenticated postcode lookup grounded in the ONS Postcode Directory February 2025. Northern Ireland BT records are withheld pending confirmation of licensing.","license":{"name":"Open Government Licence v3.0","url":"https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"}},"servers":[{"url":"https://uk.grounding.360o.media"}],"paths":{"/api/v1/postcodes/{postcode}.json":{"get":{"operationId":"getUkPostcode","summary":"Look up a UK postcode","description":"Returns all published ONSPD fields for one matching postcode record.","parameters":[{"name":"postcode","in":"path","required":true,"schema":{"type":"string","minLength":5,"maxLength":9},"description":"Postcode with or without its separating space."}],"responses":{"200":{"description":"Postcode record found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LookupResult"}}}},"400":{"description":"Invalid postcode format"},"404":{"description":"No record found in this ONSPD release"},"422":{"description":"Outside supported coverage"},"429":{"description":"Request limit reached"},"503":{"description":"Postcode data source unavailable"}}}},"/api/v1/postcodes/validate":{"post":{"operationId":"validateUkPostcode","summary":"Look up a UK postcode using JSON","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["postcode"],"additionalProperties":false,"properties":{"postcode":{"type":"string","minLength":5,"maxLength":9}}}}}},"responses":{"200":{"description":"Postcode record found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LookupResult"}}}},"400":{"description":"Invalid request"},"404":{"description":"No record found in this ONSPD release"},"413":{"description":"Request body too large"},"415":{"description":"Unsupported content type"},"422":{"description":"Outside supported coverage"},"429":{"description":"Request limit reached"},"503":{"description":"Postcode data source unavailable"}}}}},"components":{"schemas":{"LookupResult":{"type":"object","required":["service","status","input","normalizedPostcode","data","sourceRecord","source","coverage"],"properties":{"service":{"const":"uk-postcode-grounding"},"status":{"type":"string","enum":["found","not_found","outside_coverage","invalid_input"]},"input":{"type":"string"},"normalizedPostcode":{"type":["string","null"]},"data":{"type":["object","null"],"additionalProperties":true,"description":"All fields from the ONSPD normalized postcode record."},"sourceRecord":{"type":["object","null"],"additionalProperties":true,"description":"Raw ONS source values retained by InfrastructureDb."},"source":{"type":"object","additionalProperties":true},"coverage":{"type":"object","additionalProperties":true},"message":{"type":"string"}}}}}}