{
  "openapi": "3.0.1",
  "info": {
    "title": "Schools API - US School Directory & District Lookup",
    "description": "Official US K-12 school directory as JSON, no API key: 102,274 public and 22,510 private schools from NCES (2023-24) with NCES id, district, address, lat/lon, locale, grades, enrollment, teachers and student-teacher ratio. Search by name, city, state or ZIP, schools near a point or ZIP within N mile",
    "version": "0.1",
    "x-build-id": "UuqUbAvxovMAqbXlm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/martin10291~us-schools-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-martin10291-us-schools-api",
        "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/martin10291~us-schools-api/runs": {
      "post": {
        "operationId": "runs-sync-martin10291-us-schools-api",
        "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/martin10291~us-schools-api/run-sync": {
      "post": {
        "operationId": "run-sync-martin10291-us-schools-api",
        "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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "near",
              "school",
              "district",
              "bulk"
            ],
            "type": "string",
            "description": "search = filter by name/city/state/ZIP/district; near = schools within radiusMiles of lat/lon or a ZIP; school = one or more schools by NCES id; district = all schools of a district (LEAID or name) plus a summary row; bulk = up to 50 queries in one call.",
            "default": "search"
          },
          "name": {
            "title": "School name",
            "type": "string",
            "description": "Part of the school name, case-insensitive (search mode), e.g. Lincoln."
          },
          "city": {
            "title": "City",
            "type": "string",
            "description": "City name (search mode), e.g. Austin."
          },
          "state": {
            "title": "State",
            "type": "string",
            "description": "2-letter code or full name, e.g. CA or California."
          },
          "zip": {
            "title": "ZIP code",
            "type": "string",
            "description": "5-digit ZIP. search: schools in this ZIP; near: centre of the radius."
          },
          "lat": {
            "title": "Latitude",
            "type": "number",
            "description": "near mode: centre latitude (use with lon instead of zip)."
          },
          "lon": {
            "title": "Longitude",
            "type": "number",
            "description": "near mode: centre longitude."
          },
          "radiusMiles": {
            "title": "Radius (miles)",
            "type": "number",
            "description": "near mode: 0.1-50 miles, default 5. Rows are sorted by distanceMiles.",
            "default": 5
          },
          "district": {
            "title": "District",
            "type": "string",
            "description": "District NCES LEAID (7 digits) or district name (search and district modes), e.g. 0622710 (Los Angeles Unified)."
          },
          "ncesIds": {
            "title": "NCES ids",
            "type": "array",
            "description": "school mode: up to 50 NCES school ids (12-digit public NCESSCH or 8-character private PPIN).",
            "items": {
              "type": "string"
            }
          },
          "schoolType": {
            "title": "School type",
            "enum": [
              "public",
              "private",
              "all"
            ],
            "type": "string",
            "description": "public (default), private or all.",
            "default": "public"
          },
          "level": {
            "title": "Level",
            "type": "array",
            "description": "Public schools only: elementary, middle, high, secondary, prekindergarten, other.",
            "items": {
              "type": "string"
            }
          },
          "queries": {
            "title": "Bulk queries",
            "type": "array",
            "description": "bulk mode: up to 50 objects, each one an input of another mode, e.g. {\"mode\":\"near\",\"zip\":\"10001\",\"radiusMiles\":1}. A failing query returns an error row; the others still answer."
          },
          "limit": {
            "title": "Max rows",
            "type": "integer",
            "description": "1-5000, default 100.",
            "default": 100
          },
          "onlyNew": {
            "title": "Only new rows (monitor)",
            "type": "boolean",
            "description": "Return only rows not returned before for the same Monitor ID. Schedule the run to get changes only.",
            "default": false
          },
          "monitorId": {
            "title": "Monitor ID",
            "type": "string",
            "description": "Name of this monitor; each ID keeps its own memory of rows already returned."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}