{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Postcode & Address Lookup — Batch to 100 + Geolocation",
    "description": "UK postcode lookup API: resolve any postcode to lat/lng, eastings/northings, district, ward, constituency, LSOA, MSOA, NHS CCG and IMD decile. Batch up to 100 per run, autocomplete search, reverse geocoding and outcode districts. No API key needed.",
    "version": "1.0",
    "x-build-id": "in4dse9bUGNHFoI4P"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sian.agency~uk-postcode-address-lookup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sian.agency-uk-postcode-address-lookup",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/sian.agency~uk-postcode-address-lookup/runs": {
      "post": {
        "operationId": "runs-sync-sian.agency-uk-postcode-address-lookup",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/sian.agency~uk-postcode-address-lookup/run-sync": {
      "post": {
        "operationId": "run-sync-sian.agency-uk-postcode-address-lookup",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "operation": {
            "title": "⚙️ Operation",
            "enum": [
              "lookup",
              "batch",
              "search",
              "reverse",
              "outcode"
            ],
            "type": "string",
            "description": "One operation per run:\n\n- **Postcode Lookup**: one full postcode to its complete record (coordinates, local authority, ward, constituency, ONS areas)\n- **Batch Lookup**: up to 100 postcodes per run, one row each\n- **Postcode Search**: postcodes that start with what you typed (e.g. SW1A or SW1A 1), for autocomplete\n- **Reverse Geocode**: the nearest postcode to a UK latitude/longitude\n- **Outcode District**: the centre point and areas covered by the first half of a postcode (e.g. SW1A)",
            "default": "lookup"
          },
          "postcode": {
            "title": "📮 Postcode (Lookup / Search / Outcode)",
            "type": "string",
            "description": "LOOKUP: a full UK postcode such as SW1A 1AA.\n\nSEARCH: the start of a postcode, such as SW1A or SW1A 1. Search matches postcodes only, not street or town names.\n\nOUTCODE: the first half of a postcode, such as SW1A.\n\nSpacing and capitals are fixed for you, so sw1a1aa works too."
          },
          "postcodes": {
            "title": "📦 Bulk Postcodes (Batch, up to 100)",
            "uniqueItems": true,
            "type": "array",
            "description": "📦 **BATCH LOOKUP:** up to 100 UK postcodes, one per line. In the JSON tab, pass them as an array of strings:\n\n```\n{\"operation\": \"batch\", \"postcodes\": [\"SW1A 1AA\", \"EC1A 1BB\", \"M1 1AE\"]}\n```\n\nEach postcode gets one row. Duplicates are removed before anything is charged. A postcode that is mistyped or no longer in use gets a row saying so, and costs nothing.\n\n🎯 **TIP:** more than 100? Run the batch again with the next 100.",
            "items": {
              "type": "string"
            }
          },
          "latitude": {
            "title": "📍 Latitude (Reverse Geocode)",
            "minimum": -90,
            "maximum": 90,
            "type": "number",
            "description": "📍 **REVERSE GEOCODE:** latitude of the point, in decimal degrees (WGS84).\n\n**Example:** 51.501009 for Buckingham Palace"
          },
          "longitude": {
            "title": "📍 Longitude (Reverse Geocode)",
            "minimum": -180,
            "maximum": 180,
            "type": "number",
            "description": "📍 **REVERSE GEOCODE:** longitude of the point, in decimal degrees (WGS84).\n\n**Example:** -0.141588 for Buckingham Palace"
          },
          "limit": {
            "title": "🔢 Max Results (Search)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "🔢 **POSTCODE SEARCH:** how many matching postcodes to return, 1 to 100. Default 10. You pay only for postcodes actually returned.",
            "default": 10
          },
          "wideSearch": {
            "title": "🌐 Wide Search (Reverse Geocode, up to 20 km)",
            "type": "boolean",
            "description": "🌐 **REVERSE GEOCODE:** by default the nearest postcode is looked for within 2 km of your point. Turn this on to look up to 20 km away, which helps for points in open country, on the coast or in the Highlands.\n\nIgnored by the other operations.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}