{
 "openapi": "3.1.0",
 "info": {
  "title": "Clear Postcode API",
  "version": "1.0.0",
  "description": "UK postcode lookup, validation, autocomplete, reverse geocoding, distances and area data, on the ONS Postcode Directory and OS Open Names. v1 only ever grows: new endpoints and new fields, never a removed or renamed one. Anything breaking would be v2, announced at least 12 months ahead with Deprecation and Sunset headers.\n\nFields: postcode; status; outcode, incode, sector, district, area; introduced, terminated; replaced_by; user_type; location; country, region, county, local_authority, ward, parish; county_electoral_division; constituency; police_force, nhs_region, icb, sub_icb; national_park, built_up_area, travel_to_work_area; lsoa, msoa, output_area; rural_urban; area_classification; deprivation.",
  "contact": {
   "name": "Clear Postcode",
   "url": "https://clearpostcode.co.uk/contact",
   "email": "hello@clearpostcode.co.uk"
  },
  "license": {
   "name": "Data: Open Government Licence v3.0",
   "url": "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
  }
 },
 "externalDocs": {
  "url": "https://clearpostcode.co.uk/developers/docs"
 },
 "servers": [
  {
   "url": "https://api.clearpostcode.co.uk/v1"
  }
 ],
 "security": [
  {
   "ApiKey": []
  },
  {
   "Bearer": []
  },
  {}
 ],
 "tags": [
  {
   "name": "Postcodes"
  },
  {
   "name": "Geography"
  },
  {
   "name": "Places"
  },
  {
   "name": "Addresses"
  },
  {
   "name": "Account"
  }
 ],
 "paths": {
  "/postcodes/{postcode}": {
   "get": {
    "operationId": "getPostcode",
    "tags": [
     "Postcodes"
    ],
    "summary": "Look up a postcode",
    "description": "Everything about one postcode: status (live or terminated), coordinates with positional quality, and every area it sits in (country, region, county, council, ward, parish, constituency, police force, NHS board, census areas), plus rural-urban class and deprivation decile. A terminated postcode answers 200 with status \"terminated\", the month it ended and the nearest live postcode in replaced_by.\n\nBilling: 1 lookup when found; not found is free. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "postcode",
      "in": "path",
      "required": true,
      "description": "Any UK postcode, in any case, with or without the space.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1AA"
     },
     {
      "name": "fields",
      "in": "query",
      "required": false,
      "description": "Comma-separated top-level fields to return (postcode and status always come back).",
      "schema": {
       "type": "string"
      },
      "example": "location,local_authority,ward"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {
           "$ref": "#/components/schemas/Postcode"
          },
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup when found; not found is free"
   }
  },
  "/postcodes/{postcode}/validate": {
   "get": {
    "operationId": "validatePostcode",
    "tags": [
     "Postcodes"
    ],
    "summary": "Validate a postcode",
    "description": "Three answers in one: is the format valid, is it in the current edition (known), and is it live. Northern Ireland (BT) postcodes are checked by format only and come back with coverage \"not_covered\". New-build postcodes can take up to a quarter to reach the open data, so treat known: false as \"check again\", never as \"wrong\".\n\nBilling: 1 lookup when known; otherwise free. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "postcode",
      "in": "path",
      "required": true,
      "description": "Any UK postcode, in any case, with or without the space.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1AA"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup when known; otherwise free"
   }
  },
  "/postcodes/{postcode}/nearest": {
   "get": {
    "operationId": "nearestToPostcode",
    "tags": [
     "Postcodes"
    ],
    "summary": "Postcodes near a postcode",
    "description": "Live postcodes closest to this one, nearest first, with the distance in metres.\n\nBilling: 1 lookup. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "postcode",
      "in": "path",
      "required": true,
      "description": "Any UK postcode, in any case, with or without the space.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1AA"
     },
     {
      "name": "radius",
      "in": "query",
      "required": false,
      "description": "Search radius in metres (up to 2,000; default 500).",
      "schema": {
       "type": "integer"
      },
      "example": 500
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "How many results (1 to 50, default 10).",
      "schema": {
       "type": "integer"
      },
      "example": 10
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup"
   }
  },
  "/postcodes": {
   "get": {
    "operationId": "reverseGeocode",
    "tags": [
     "Postcodes"
    ],
    "summary": "Postcodes near a point (reverse geocode)",
    "description": "Live postcodes nearest a latitude and longitude, nearest first.\n\nBilling: 1 lookup when anything is found. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "lat",
      "in": "query",
      "required": true,
      "description": "Latitude (WGS84).",
      "schema": {
       "type": "number"
      },
      "example": 51.501
     },
     {
      "name": "lon",
      "in": "query",
      "required": true,
      "description": "Longitude (WGS84).",
      "schema": {
       "type": "number"
      },
      "example": -0.1416
     },
     {
      "name": "radius",
      "in": "query",
      "required": false,
      "description": "Metres (up to 2,000; default 500).",
      "schema": {
       "type": "integer"
      },
      "example": 500
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "How many results (1 to 50, default 10).",
      "schema": {
       "type": "integer"
      },
      "example": 10
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup when anything is found"
   },
   "post": {
    "operationId": "bulkLookup",
    "tags": [
     "Postcodes"
    ],
    "summary": "Bulk lookup (up to 100)",
    "description": "Look up to 100 postcodes in one call. Results come back in the order sent, each with the query, the record or null, and an error code when it wasn't found.\n\nBilling: 1 lookup per postcode found. Secret (server) keys only.",
    "parameters": [
     {
      "name": "fields",
      "in": "query",
      "required": false,
      "description": "Comma-separated top-level fields to return (postcode and status always come back).",
      "schema": {
       "type": "string"
      },
      "example": "location,local_authority,ward"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object"
       },
       "example": {
        "postcodes": [
         "SW1A 1AA",
         "M1 1AE",
         "EH1 1YZ"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup per postcode found"
   }
  },
  "/reverse": {
   "post": {
    "operationId": "bulkReverse",
    "tags": [
     "Postcodes"
    ],
    "summary": "Bulk reverse geocode (up to 50)",
    "description": "Nearest postcodes for up to 50 points in one call.\n\nBilling: 1 lookup per point with a result. Secret (server) keys only.",
    "parameters": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object"
       },
       "example": {
        "points": [
         {
          "lat": 51.5014,
          "lon": -0.1419,
          "limit": 1
         },
         {
          "lat": 53.4808,
          "lon": -2.2426,
          "limit": 1
         }
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup per point with a result"
   }
  },
  "/autocomplete": {
   "get": {
    "operationId": "autocomplete",
    "tags": [
     "Postcodes"
    ],
    "summary": "Autocomplete a partial postcode",
    "description": "Postcodes (or districts, for 1 to 4 characters) that start with what has been typed. Free: keystrokes are never billed. Send at least 2 characters.\n\nBilling: Free (fair use). Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "description": "What has been typed so far.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "How many results (1 to 20, default 10).",
      "schema": {
       "type": "integer"
      },
      "example": 10
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "Free (fair use)"
   }
  },
  "/distance": {
   "get": {
    "operationId": "distance",
    "tags": [
     "Postcodes"
    ],
    "summary": "Distance between two postcodes",
    "description": "Straight-line distance in kilometres and miles, and the compass bearing from the first to the second.\n\nBilling: 1 lookup. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "from",
      "in": "query",
      "required": true,
      "description": "First postcode.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1AA"
     },
     {
      "name": "to",
      "in": "query",
      "required": true,
      "description": "Second postcode.",
      "schema": {
       "type": "string"
      },
      "example": "EH1 1YZ"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup"
   }
  },
  "/outcodes/{outcode}": {
   "get": {
    "operationId": "getOutcode",
    "tags": [
     "Geography"
    ],
    "summary": "A postcode district",
    "description": "One district (the outward code, e.g. SW1A): how many live and terminated postcodes, its sectors, centre, councils, wards, constituencies and places.\n\nBilling: 1 lookup. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "outcode",
      "in": "path",
      "required": true,
      "description": "Outward code.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup"
   }
  },
  "/outcodes/{outcode}/postcodes": {
   "get": {
    "operationId": "outcodePostcodes",
    "tags": [
     "Geography"
    ],
    "summary": "Every postcode in a district",
    "description": "The district's live postcodes with coordinates, in order, a page at a time. Pass the last postcode you received as after= to get the next page.\n\nBilling: 1 lookup per page. Secret (server) keys only.",
    "parameters": [
     {
      "name": "outcode",
      "in": "path",
      "required": true,
      "description": "Outward code.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A"
     },
     {
      "name": "after",
      "in": "query",
      "required": false,
      "description": "Cursor: the last postcode of the previous page.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1AA"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "How many results (1 to 500, default 100).",
      "schema": {
       "type": "integer"
      },
      "example": 100
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup per page"
   }
  },
  "/sectors/{sector}": {
   "get": {
    "operationId": "getSector",
    "tags": [
     "Geography"
    ],
    "summary": "A postcode sector",
    "description": "One sector (e.g. SW1A 1): its live postcodes with coordinates, centre, and the councils and wards it covers.\n\nBilling: 1 lookup. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "sector",
      "in": "path",
      "required": true,
      "description": "Sector, e.g. \"SW1A 1\".",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup"
   }
  },
  "/areas/{area}": {
   "get": {
    "operationId": "getArea",
    "tags": [
     "Geography"
    ],
    "summary": "A postcode area",
    "description": "One postcode area (the letters, e.g. SW): its name, counts and every district in it.\n\nBilling: 1 lookup. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "area",
      "in": "path",
      "required": true,
      "description": "Area letters.",
      "schema": {
       "type": "string"
      },
      "example": "SW"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup"
   }
  },
  "/places": {
   "get": {
    "operationId": "places",
    "tags": [
     "Places"
    ],
    "summary": "Find a place",
    "description": "Cities, towns, villages and neighbourhoods by name (OS Open Names), each with its postcode district and coordinates.\n\nBilling: 1 lookup when anything is found. Works with publishable (browser) keys. Can be tried without a key (rate-limited per IP).",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "description": "Place name or its start.",
      "schema": {
       "type": "string"
      },
      "example": "Chelsea"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "How many results (1 to 20, default 10).",
      "schema": {
       "type": "integer"
      },
      "example": 10
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "1 lookup when anything is found"
   }
  },
  "/usage": {
   "get": {
    "operationId": "usage",
    "tags": [
     "Account"
    ],
    "summary": "Your usage",
    "description": "Your plan, this period's allowance, lookups used, credits and when the allowance resets.\n\nBilling: Free. Secret (server) keys only.",
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-billing": "Free"
   }
  },
  "/addresses": {
   "get": {
    "operationId": "addressesByPostcode",
    "tags": [
     "Addresses"
    ],
    "summary": "Addresses at a postcode (early access)",
    "description": "Every Royal Mail PAF address at a postcode, with UDPRN, line_1 to line_3, post_town and organisation. In early access: join the list at clearpostcode.co.uk/address-lookup.\n\nBilling: 1 address lookup per postcode (early access). Works with publishable (browser) keys.",
    "parameters": [
     {
      "name": "postcode",
      "in": "query",
      "required": true,
      "description": "Postcode.",
      "schema": {
       "type": "string"
      },
      "example": "SW1A 1AA"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-status": "preview",
    "x-billing": "1 address lookup per postcode (early access)"
   }
  },
  "/addresses/suggest": {
   "get": {
    "operationId": "addressSuggest",
    "tags": [
     "Addresses"
    ],
    "summary": "Address autocomplete (early access)",
    "description": "Suggestions as the customer types; suggestions are always free, only the address you resolve is billed.\n\nBilling: Free. Works with publishable (browser) keys.",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "description": "What has been typed.",
      "schema": {
       "type": "string"
      },
      "example": "10 Downing"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-status": "preview",
    "x-billing": "Free"
   }
  },
  "/addresses/{udprn}": {
   "get": {
    "operationId": "addressByUdprn",
    "tags": [
     "Addresses"
    ],
    "summary": "Resolve one address (early access)",
    "description": "The full PAF address for a UDPRN from a suggestion.\n\nBilling: 1 address lookup. Works with publishable (browser) keys.",
    "parameters": [
     {
      "name": "udprn",
      "in": "path",
      "required": true,
      "description": "Royal Mail's Unique Delivery Point Reference Number.",
      "schema": {
       "type": "string"
      },
      "example": "23747771"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "data": {},
          "meta": {
           "$ref": "#/components/schemas/Meta"
          }
         }
        }
       }
      }
     },
     "304": {
      "description": "Not modified (free)"
     },
     "400": {
      "$ref": "#/components/responses/Problem"
     },
     "401": {
      "$ref": "#/components/responses/Problem"
     },
     "402": {
      "$ref": "#/components/responses/Problem"
     },
     "403": {
      "$ref": "#/components/responses/Problem"
     },
     "404": {
      "$ref": "#/components/responses/Problem"
     },
     "429": {
      "$ref": "#/components/responses/Problem"
     }
    },
    "x-status": "preview",
    "x-billing": "1 address lookup"
   }
  }
 },
 "components": {
  "securitySchemes": {
   "ApiKey": {
    "type": "apiKey",
    "in": "header",
    "name": "X-Api-Key"
   },
   "Bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "responses": {
   "Problem": {
    "description": "RFC 9457 problem details",
    "content": {
     "application/problem+json": {
      "schema": {
       "type": "object",
       "properties": {
        "type": {
         "type": "string",
         "format": "uri"
        },
        "title": {
         "type": "string"
        },
        "status": {
         "type": "integer"
        },
        "detail": {
         "type": "string"
        },
        "instance": {
         "type": "string"
        },
        "request_id": {
         "type": "string"
        }
       },
       "required": [
        "type",
        "title",
        "status",
        "detail"
       ]
      }
     }
    }
   }
  },
  "schemas": {
   "Meta": {
    "type": "object",
    "properties": {
     "edition": {
      "type": "string",
      "example": "2026-08"
     },
     "next_edition_due": {
      "type": "string"
     },
     "coverage": {
      "type": "string"
     },
     "licence": {
      "type": "string"
     },
     "attribution": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "docs": {
      "type": "string"
     }
    }
   },
   "Named": {
    "type": [
     "object",
     "null"
    ],
    "properties": {
     "code": {
      "type": "string"
     },
     "name": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "Postcode": {
    "type": "object",
    "properties": {
     "postcode": {
      "type": "string",
      "example": "SW1A 1AA"
     },
     "status": {
      "type": "string",
      "enum": [
       "live",
       "terminated"
      ]
     },
     "outcode": {
      "type": "string"
     },
     "incode": {
      "type": "string"
     },
     "sector": {
      "type": "string"
     },
     "district": {
      "type": "string"
     },
     "area": {
      "type": "string"
     },
     "introduced": {
      "type": [
       "string",
       "null"
      ]
     },
     "terminated": {
      "type": [
       "string",
       "null"
      ]
     },
     "replaced_by": {
      "type": [
       "string",
       "null"
      ]
     },
     "user_type": {
      "type": "string",
      "enum": [
       "small",
       "large"
      ]
     },
     "location": {
      "type": "object",
      "properties": {
       "latitude": {
        "type": [
         "number",
         "null"
        ]
       },
       "longitude": {
        "type": [
         "number",
         "null"
        ]
       },
       "easting": {
        "type": [
         "integer",
         "null"
        ]
       },
       "northing": {
        "type": [
         "integer",
         "null"
        ]
       },
       "positional_quality": {
        "type": [
         "integer",
         "null"
        ]
       },
       "positional_quality_label": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     },
     "country": {
      "$ref": "#/components/schemas/Named"
     },
     "region": {
      "$ref": "#/components/schemas/Named"
     },
     "county": {
      "$ref": "#/components/schemas/Named"
     },
     "county_electoral_division": {
      "$ref": "#/components/schemas/Named"
     },
     "local_authority": {
      "$ref": "#/components/schemas/Named"
     },
     "ward": {
      "$ref": "#/components/schemas/Named"
     },
     "parish": {
      "$ref": "#/components/schemas/Named"
     },
     "constituency": {
      "$ref": "#/components/schemas/Named"
     },
     "police_force": {
      "$ref": "#/components/schemas/Named"
     },
     "nhs_region": {
      "$ref": "#/components/schemas/Named"
     },
     "icb": {
      "$ref": "#/components/schemas/Named"
     },
     "sub_icb": {
      "$ref": "#/components/schemas/Named"
     },
     "national_park": {
      "$ref": "#/components/schemas/Named"
     },
     "built_up_area": {
      "$ref": "#/components/schemas/Named"
     },
     "travel_to_work_area": {
      "$ref": "#/components/schemas/Named"
     },
     "lsoa": {
      "$ref": "#/components/schemas/Named"
     },
     "msoa": {
      "$ref": "#/components/schemas/Named"
     },
     "output_area": {
      "type": [
       "string",
       "null"
      ]
     },
     "rural_urban": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "code": {
        "type": "string"
       },
       "name": {
        "type": [
         "string",
         "null"
        ]
       },
       "urban": {
        "type": [
         "boolean",
         "null"
        ]
       }
      }
     },
     "area_classification": {
      "type": [
       "string",
       "null"
      ]
     },
     "deprivation": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "index": {
        "type": "string"
       },
       "rank": {
        "type": "integer"
       },
       "of": {
        "type": "integer"
       },
       "decile": {
        "type": "integer"
       }
      }
     }
    },
    "required": [
     "postcode",
     "status"
    ]
   }
  }
 }
}