{
  "openapi": "3.0.1",
  "info": {
    "title": "France Town Amenities: Shops, Doctors & Schools (INSEE BPE)",
    "description": "Official INSEE BPE open data: how many bakeries, supermarkets, pharmacies, GPs, dentists, schools, banks, restaurants and 200+ other facility types each French town, EPCI or department has, per 10,000 inhabitants. Find towns with no pharmacy or bakery. Pay per area.",
    "version": "1.0",
    "x-build-id": "JKlgmEdXPB8qFGTe5"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datacraft-studio~france-town-amenities/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datacraft-studio-france-town-amenities",
        "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/datacraft-studio~france-town-amenities/runs": {
      "post": {
        "operationId": "runs-sync-datacraft-studio-france-town-amenities",
        "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/datacraft-studio~france-town-amenities/run-sync": {
      "post": {
        "operationId": "run-sync-datacraft-studio-france-town-amenities",
        "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": {
          "geoLevel": {
            "title": "Geographic level",
            "enum": [
              "COM",
              "ARM",
              "EPCI",
              "DEP",
              "REG",
              "ARR",
              "BV2022",
              "AAV2020",
              "UU2020",
              "ZE2020",
              "FRANCE"
            ],
            "type": "string",
            "description": "Level of the areas returned. COM = towns (communes), ARM = Paris/Lyon/Marseille districts, EPCI = intercommunalities, DEP = departments, REG = regions, BV2022 = living areas, AAV2020 = functional urban areas, UU2020 = urban units, ZE2020 = employment areas.",
            "default": "COM"
          },
          "codes": {
            "title": "Area codes",
            "type": "array",
            "description": "Official INSEE codes at the chosen level, e.g. 69123 (Lyon) for towns, 200046977 for an EPCI, 69 for a department.",
            "items": {
              "type": "string"
            }
          },
          "townNames": {
            "title": "Town or area names",
            "type": "array",
            "description": "Exact names at the chosen level, e.g. Villeurbanne. Add the department in brackets to avoid homonyms: Saint-Denis (93).",
            "items": {
              "type": "string"
            }
          },
          "postalCodes": {
            "title": "Postal codes",
            "type": "array",
            "description": "5-digit postal codes (towns or districts only). Resolved with geo.api.gouv.fr.",
            "items": {
              "type": "string"
            }
          },
          "departments": {
            "title": "Departments",
            "type": "array",
            "description": "All towns (or districts) of these departments, e.g. 69, 2A, 974. Leave all area fields empty to scan the whole of France.",
            "items": {
              "type": "string"
            }
          },
          "facilityTypes": {
            "title": "Facility types to focus on",
            "type": "array",
            "description": "BPE type codes (B207 bakery, D307 pharmacy, D265 GP...), sub-domains (B2 food shops) or French words (boulangerie, pharmacie, coiffure). Adds selectedFacilities counts and per-10k density, and allows sorting by them.",
            "items": {
              "type": "string"
            }
          },
          "missingFacilityTypes": {
            "title": "Gap finder: only areas with none of",
            "type": "array",
            "description": "Return only areas where ALL of these facility types are absent, e.g. pharmacie. Combine with a minimum population to find towns without a pharmacy, bakery or GP.",
            "items": {
              "type": "string"
            }
          },
          "minPopulation": {
            "title": "Minimum population",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only areas with at least this municipal population (towns, districts, departments, regions)."
          },
          "maxPopulation": {
            "title": "Maximum population",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only areas with at most this municipal population."
          },
          "minTotalFacilities": {
            "title": "Minimum number of facilities",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only areas with at least this many facilities of all types."
          },
          "includeAllTypes": {
            "title": "Include the full list of facility types",
            "type": "boolean",
            "description": "Add the count of every facility type present (200+ types) in the facilities field.",
            "default": true
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "population_desc",
              "population_asc",
              "total_desc",
              "total_asc",
              "selected_desc",
              "selected_asc",
              "selected_per10k_desc",
              "selected_per10k_asc",
              "facilities_per10k_desc",
              "facilities_per10k_asc",
              "code"
            ],
            "type": "string",
            "description": "Order of the rows before the maxItems limit.",
            "default": "population_desc"
          },
          "maxItems": {
            "title": "Maximum areas",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of areas returned (each one is charged).",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}