{
  "openapi": "3.0.1",
  "info": {
    "title": "UK Council Planning Applications Monitor",
    "description": "Monitor newly validated, decided, or updated planning applications across selected UK council portals (Idox PublicAccess, Northgate Planning Explorer). HTTP-only; designed for scheduled runs with onlyNew dedupe.",
    "version": "0.3",
    "x-build-id": "WUcyz5XaEtnhtqJrp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/illehius~uk-planning-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-illehius-uk-planning-monitor",
        "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/illehius~uk-planning-monitor/runs": {
      "post": {
        "operationId": "runs-sync-illehius-uk-planning-monitor",
        "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/illehius~uk-planning-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-illehius-uk-planning-monitor",
        "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",
        "required": [
          "councils"
        ],
        "properties": {
          "councils": {
            "title": "Councils",
            "type": "array",
            "description": "Array of council IDs (e.g. \"woking\") or full portal URLs. Supported IDs in MVP: woking. More councils added as adapter coverage expands.",
            "items": {
              "type": "string"
            }
          },
          "dateMode": {
            "title": "Date Mode",
            "enum": [
              "validated",
              "decided",
              "updated"
            ],
            "type": "string",
            "description": "Which application date drives the search window: validated (default), decided, or updated.",
            "default": "validated"
          },
          "dateFrom": {
            "title": "Date From (ISO)",
            "type": "string",
            "description": "Start of search window in YYYY-MM-DD. Defaults to 7 days ago when omitted."
          },
          "dateTo": {
            "title": "Date To (ISO)",
            "type": "string",
            "description": "End of search window in YYYY-MM-DD. Defaults to today when omitted."
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Optional array of keywords matched (case-insensitive) against proposal, description, or address. Empty = no keyword filter.",
            "items": {
              "type": "string"
            }
          },
          "postcodes": {
            "title": "Postcodes",
            "type": "array",
            "description": "Optional outward (e.g. GU21) or full postcode filters; only applied where the portal supports postcode search.",
            "items": {
              "type": "string"
            }
          },
          "maxResultsPerCouncil": {
            "title": "Max Results Per Council",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on records returned per council per run.",
            "default": 100
          },
          "includeDetails": {
            "title": "Include Detail Page Fields",
            "type": "boolean",
            "description": "Fetch each application's detail page to enrich status/decision/ward/document metadata. Disable for cheaper list-only runs.",
            "default": true
          },
          "includeDocuments": {
            "title": "Include Document Metadata List",
            "type": "boolean",
            "description": "Surface the application's document list (title, type, date, url) without downloading the documents themselves. Copyright-safe; differentiator vs PlanIt.",
            "default": false
          },
          "stateKey": {
            "title": "State Key (Monitoring Mode)",
            "type": "string",
            "description": "Optional key for monitoring/dedupe state. Stored namespaced by user. Use the same key across scheduled runs to enable onlyNew filtering and firstSeenAt/lastSeenAt tracking."
          },
          "onlyNew": {
            "title": "Output Only New Applications",
            "type": "boolean",
            "description": "When true, output only applications not seen in prior runs for the same stateKey. Requires stateKey.",
            "default": false
          },
          "failOnCouncilError": {
            "title": "Fail on Council Error",
            "type": "boolean",
            "description": "When true, the run fails on the first council that errors. When false (default), per-council failures are recorded in SUMMARY but the run continues to remaining councils.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}