{
  "openapi": "3.1.0",
  "info": {
    "title": "Glimby public API",
    "version": "1.0.0",
    "description": "Published reports are incomplete, delayed and approximate. No reports does not establish safety. A report is not a finding of guilt. Glimby supplies no safety score, monitoring, alerts or route safety assessment."
  },
  "servers": [
    {
      "url": "https://safearea-worker.mtokmak06.workers.dev"
    }
  ],
  "paths": {
    "/v1/tools/explore_area": {
      "post": {
        "operationId": "explore_area",
        "description": "Published police reports within a radius, nearest first. Always preserve coverage, approximation and reporting-window caveats. No safety assessment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number",
                    "minimum": -85,
                    "maximum": 85
                  },
                  "longitude": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "radius_miles": {
                    "type": "number",
                    "enum": [
                      0.25,
                      0.5,
                      1,
                      2
                    ]
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "all",
                      "burglary",
                      "robbery",
                      "assault",
                      "vehicle",
                      "sexual",
                      "other"
                    ]
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/get_report": {
      "post": {
        "operationId": "get_report",
        "description": "Read one public police report with source attribution. Never returns personal registry records.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/list_sources": {
      "post": {
        "operationId": "list_sources",
        "description": "Coverage, publication windows and last successful refresh times. A refresh time is not an incident date.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/search_places": {
      "post": {
        "operationId": "search_places",
        "description": "Search covered cities or coordinates. US street addresses use the US Census geocoder. Apple search is used when configured. No search history is stored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/walking_directions": {
      "post": {
        "operationId": "walking_directions",
        "description": "Return an Apple Maps walking-direction link from explicit origin coordinates to destination coordinates or an address. Does not calculate or assess route safety.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "minItems": 2,
                    "maxItems": 2
                  },
                  "to": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "minItems": 2,
                    "maxItems": 2
                  },
                  "destination": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "from"
                ],
                "additionalProperties": false,
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "to": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "destination": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "from",
                      "to"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "from": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "to": {
                        "type": "array",
                        "items": {
                          "type": "number"
                        },
                        "minItems": 2,
                        "maxItems": 2
                      },
                      "destination": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "from",
                      "destination"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/save_place": {
      "post": {
        "operationId": "save_place",
        "description": "Return a new local bookmark collection. Stateless: the caller must persist the returned places; Glimby stores nothing on the server.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "places": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "latitude": {
                          "type": "number",
                          "minimum": -85,
                          "maximum": 85
                        },
                        "longitude": {
                          "type": "number",
                          "minimum": -180,
                          "maximum": 180
                        },
                        "radius_miles": {
                          "type": "number",
                          "enum": [
                            0.25,
                            0.5,
                            1,
                            2
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "latitude",
                        "longitude",
                        "radius_miles"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "latitude": {
                    "type": "number",
                    "minimum": -85,
                    "maximum": 85
                  },
                  "longitude": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "radius_miles": {
                    "type": "number",
                    "enum": [
                      0.25,
                      0.5,
                      1,
                      2
                    ]
                  }
                },
                "required": [
                  "places",
                  "name",
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/delete_place": {
      "post": {
        "operationId": "delete_place",
        "description": "Return the supplied bookmark collection without the specified id. The caller persists it locally.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "places": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "latitude": {
                          "type": "number",
                          "minimum": -85,
                          "maximum": 85
                        },
                        "longitude": {
                          "type": "number",
                          "minimum": -180,
                          "maximum": 180
                        },
                        "radius_miles": {
                          "type": "number",
                          "enum": [
                            0.25,
                            0.5,
                            1,
                            2
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "latitude",
                        "longitude",
                        "radius_miles"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": [
                  "places",
                  "id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/clear_places": {
      "post": {
        "operationId": "clear_places",
        "description": "Return an empty bookmark collection after explicit confirmation. The caller persists it locally.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "confirm"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/get_app_info": {
      "post": {
        "operationId": "get_app_info",
        "description": "Product, legal, support, registry links, covered-city suggestions and navigation links. No account, subscription, safety score or alerts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    },
    "/v1/tools/list_places": {
      "post": {
        "operationId": "list_places",
        "description": "Read a bookmark collection explicitly supplied by this client. Does not access or sync bookmarks on another device.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "places": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "latitude": {
                          "type": "number",
                          "minimum": -85,
                          "maximum": 85
                        },
                        "longitude": {
                          "type": "number",
                          "minimum": -180,
                          "maximum": 180
                        },
                        "radius_miles": {
                          "type": "number",
                          "enum": [
                            0.25,
                            0.5,
                            1,
                            2
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "latitude",
                        "longitude",
                        "radius_miles"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 100
                  }
                },
                "required": [
                  "places"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Machine-readable result; preserve caveats and truncation information."
          },
          "400": {
            "description": "Invalid arguments"
          },
          "413": {
            "description": "Body exceeds 64 KiB"
          },
          "429": {
            "description": "Rate limited; honor Retry-After"
          },
          "503": {
            "description": "Provider unavailable; do not invent a result"
          }
        }
      }
    }
  }
}
