{
  "openapi": "3.0.1",
  "info": {
    "title": "Sync Ofsted Reports Data with Supabase",
    "description": "Pulls Ofsted children's home inspection data from PDF reports, deduplicates by URN, and upserts directly into your Supabase table. Filter by date range, schedule daily runs, and feed dashboards or compliance workflows — no Make, no Zapier, no glue code needed.",
    "version": "0.0",
    "x-build-id": "Wk8Zn5J6RjrC3njgQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alkausari_mujahid~sync-ofsted-reports-data-with-supabase/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alkausari_mujahid-sync-ofsted-reports-data-with-supabase",
        "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/alkausari_mujahid~sync-ofsted-reports-data-with-supabase/runs": {
      "post": {
        "operationId": "runs-sync-alkausari_mujahid-sync-ofsted-reports-data-with-supabase",
        "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/alkausari_mujahid~sync-ofsted-reports-data-with-supabase/run-sync": {
      "post": {
        "operationId": "run-sync-alkausari_mujahid-sync-ofsted-reports-data-with-supabase",
        "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": [
          "start_urls",
          "apify_api_token",
          "ofsted_actor_id",
          "supabase_url",
          "supabase_api_key",
          "supabase_table"
        ],
        "properties": {
          "start_urls": {
            "title": "Start URLs",
            "type": "array",
            "description": "A search URLs from reports.ofsted.gov.uk",
            "default": [
              {
                "url": "https://reports.ofsted.gov.uk/search?q=&level_1_types=3&level_2_types%5B0%5D=11&status%5B0%5D=1&start=0&rows=10"
              }
            ],
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "latest_report_date_start": {
            "title": "Report Date From",
            "type": "string",
            "description": "Filter inspections from this date (DD-MM-YYYY)"
          },
          "latest_report_date_end": {
            "title": "Report Date To",
            "type": "string",
            "description": "Filter inspections up to this date (DD-MM-YYYY)"
          },
          "only_latest_inspection": {
            "title": "Only Latest Inspections per URN",
            "type": "boolean",
            "description": "Returns only the latest inspection per URN",
            "default": true
          },
          "include_unsupported": {
            "title": "Include Unsupported PDFs",
            "type": "boolean",
            "description": "Include unsupported inspection types in results for later processing.",
            "default": false
          },
          "max_depth": {
            "title": "Max Depth",
            "minimum": 1,
            "type": "integer",
            "description": "Keep it always 3 otherwise if you want to process PDFs URLs directly then set it to 1. Maximum crawl depth for the Ofsted actor",
            "default": 3
          },
          "apify_api_token": {
            "title": "Apify API Token",
            "type": "string",
            "description": "The Apify API token of your account where the Ofsted Data Scraper Scraper is installed"
          },
          "ofsted_actor_id": {
            "title": "Ofsted Actor ID",
            "type": "string",
            "description": "The actor ID for the Ofsted Reports Data scraper",
            "default": "UNmCLFqfH6zXa3Mfc"
          },
          "supabase_url": {
            "title": "Supabase URL",
            "type": "string",
            "description": "Your Supabase project URL (e.g. https://xxxx.supabase.co)"
          },
          "supabase_api_key": {
            "title": "Supabase API Key",
            "type": "string",
            "description": "Use the service_role key if Row Level Security is enabled on your table (recommended); the anon key may block inserts."
          },
          "supabase_table": {
            "title": "Supabase Table Name",
            "type": "string",
            "description": "Name of the table in your Supabase database to upsert into. Must exist before the run (see the README for the CREATE TABLE statement).",
            "default": "ofsted_inspections"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}