{
  "openapi": "3.1.1",
  "info": {
    "title": "Crime.uk API",
    "description": "Crime data powered by CrimeRate.co.uk\n\nREST endpoints are secured via API key; the MCP endpoint signs in with OAuth 2.1.",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.crime.uk/"
    }
  ],
  "paths": {
    "/v1/crimerate-insights-reports/postcode/{postcode}": {
      "get": {
        "tags": [
          "Crime Reports"
        ],
        "description": "Create a CrimeRate Insights PDF report for the given postcode. The report design can be customised to match your branding. Access granted on agreement, and extra charges may be incurred, discussed in advanced.",
        "operationId": "CreateCrimeReportForPostcode",
        "parameters": [
          {
            "name": "postcode",
            "in": "path",
            "description": "Accepts postcodes in upper- or lower-case, space is optional. For example RH161EL, rh16 1el, RH16 1el etc.",
            "required": true,
            "schema": {
              "maxLength": 8,
              "minLength": 5,
              "type": "string"
            }
          },
          {
            "name": "reportResponseType",
            "in": "query",
            "description": "Specify whether to return the raw PDF bytes (default) or upload the report PDF to S3 and return a signed S3 URL`",
            "schema": {
              "default": "PdfBytes",
              "$ref": "#/components/schemas/CrimeRateReportResponseType"
            }
          },
          {
            "name": "templateName",
            "in": "query",
            "description": "Optional PDF template name controlling cover, back cover, headers, footers, and font. Omit to use the API key's bound template, or the registry default if the key has none.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/crime-data/postcode/{postcode}": {
      "get": {
        "tags": [
          "Crime Data"
        ],
        "description": "Get crime data for a given postcode.",
        "operationId": "GetCrimeDataByPostcode",
        "parameters": [
          {
            "name": "postcode",
            "in": "path",
            "description": "Accepts postcodes in upper- or lower-case, space is optional. For example RH161EL, rh16 1el, RH16 1el etc.",
            "required": true,
            "schema": {
              "maxLength": 8,
              "minLength": 5,
              "type": "string"
            }
          },
          {
            "name": "crimeTypes",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfCrimeDataContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/crime-data/coordinates/{latitude}/{longitude}": {
      "get": {
        "tags": [
          "Crime Data"
        ],
        "description": "Get crime data for a given coordinate pair. Coordinates expected in WGS84 / EPSG:4326, for example: latitude 51.123456, longitude -0.123456",
        "operationId": "GetCrimeDataByCoordinatePair",
        "parameters": [
          {
            "name": "latitude",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number",
              "format": "decimal"
            }
          },
          {
            "name": "longitude",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number",
              "format": "decimal"
            }
          },
          {
            "name": "crimeTypes",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfCrimeDataContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/crime-data/place/{slug}": {
      "get": {
        "tags": [
          "Crime Data"
        ],
        "description": "Get crime data for a given place, typically a town, city, county and so on. For example: west-sussex/haywards-heath; england; sussex-police",
        "operationId": "GetCrimeDataByPlaceSlug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "default": "england"
            }
          },
          {
            "name": "crimeTypes",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfCrimeDataContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/crime-data/place/{slug}/{subSlug}": {
      "get": {
        "tags": [
          "Crime Data"
        ],
        "description": "Get crime data for a given place, typically a town, city, county and so on. For example: west-sussex/haywards-heath; england; sussex-police",
        "operationId": "GetCrimeDataByPlaceSubslug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "default": "england"
            }
          },
          {
            "name": "subSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "default": ""
            }
          },
          {
            "name": "crimeTypes",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfCrimeDataContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/top-crime-types/postcode/{postcode}": {
      "get": {
        "tags": [
          "Top Crime Types"
        ],
        "description": "Get the top three crime types for a given postcode, by CrimeRate Index. Each entry includes its rate, count, colour palette, and a human-readable writeup.",
        "operationId": "GetTopCrimeTypesByPostcode",
        "parameters": [
          {
            "name": "postcode",
            "in": "path",
            "description": "Accepts postcodes in upper- or lower-case, space is optional. For example RH161EL, rh16 1el, RH16 1el etc.",
            "required": true,
            "schema": {
              "maxLength": 8,
              "minLength": 5,
              "type": "string"
            }
          },
          {
            "name": "extraCrimeTypes",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfTopCrimeTypesContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/top-crime-types/coordinates/{latitude}/{longitude}": {
      "get": {
        "tags": [
          "Top Crime Types"
        ],
        "description": "Get the top three crime types for a given coordinate pair, by CrimeRate Index. Coordinates expected in WGS84 / EPSG:4326, for example: latitude 51.123456, longitude -0.123456. Each entry includes its rate, count, colour palette, and a human-readable writeup.",
        "operationId": "GetTopCrimeTypesByCoordinatePair",
        "parameters": [
          {
            "name": "latitude",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number",
              "format": "decimal"
            }
          },
          {
            "name": "longitude",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number",
              "format": "decimal"
            }
          },
          {
            "name": "extraCrimeTypes",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfTopCrimeTypesContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/places/towns-cities/{countyRegionSlug}": {
      "get": {
        "tags": [
          "Place lookups"
        ],
        "description": "",
        "operationId": "GetPlaceTownsCities",
        "parameters": [
          {
            "name": "countyRegionSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfIEnumerableOfTownCity"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/places/countries": {
      "get": {
        "tags": [
          "Place lookups"
        ],
        "description": "",
        "operationId": "GetPlacesCountries",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfIEnumerableOfCountry"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/places/counties-regions": {
      "get": {
        "tags": [
          "Place lookups"
        ],
        "description": "",
        "operationId": "GetPlacesCountiesRegions",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfIEnumerableOfCountyRegion"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/places/police-forces": {
      "get": {
        "tags": [
          "Place lookups"
        ],
        "description": "",
        "operationId": "GetPlacesPoliceForces",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfIEnumerableOfPoliceForce"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/crime-types/list": {
      "get": {
        "tags": [
          "Definitions"
        ],
        "description": "",
        "operationId": "GetCrimeTypes",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfIEnumerableOfCrimeTypeDescription"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "Usage"
        ],
        "description": "Returns this API key's usage over the last N days: summary counters, daily series, top routes, status code breakdown, and the most recent 100 calls. Suitable for rendering customer-facing dashboards.",
        "operationId": "GetUsageReport",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "description": "Number of days to summarise (1–90). Defaults to 30.",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32",
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfUsageReport"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfNoDataObject"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponseOfEmptyObject"
                }
              }
            }
          }
        },
        "security": [
          {
            "API Key": [ ]
          },
          {
            "Public key": [ ]
          }
        ]
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "OAuth discovery document",
        "description": "Protected Resource Metadata (RFC 9728): names the authorization server, supported scopes and bearer method for /mcp. Public — MCP clients fetch it unauthenticated to start the OAuth handshake.",
        "operationId": "GetOAuthProtectedResourceMetadata",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [ ]
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Send an MCP message",
        "description": "The Streamable HTTP transport's message channel: a JSON-RPC 2.0 request or notification (initialize, tools/list, tools/call, …). Responses arrive as JSON or as a text/event-stream, matching the Accept header. Tool calls are billed per call to the account's credit balance.",
        "operationId": "McpPost",
        "requestBody": {
          "description": "A JSON-RPC 2.0 message.",
          "content": {
            "application/json": { }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The JSON-RPC response, as application/json or text/event-stream.",
            "content": {
              "application/json": { },
              "text/event-stream": { }
            }
          },
          "202": {
            "description": "Notification accepted; no response body."
          },
          "401": {
            "description": "Missing or invalid access token. The WWW-Authenticate header names the protected-resource metadata document, which starts the OAuth discovery handshake."
          }
        },
        "security": [
          {
            "OAuth access token": [ ]
          }
        ]
      },
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "Open the server event stream",
        "description": "Opens the transport's server-to-client text/event-stream for notifications on an established session (Mcp-Session-Id header).",
        "operationId": "McpListen",
        "responses": {
          "200": {
            "description": "Server events.",
            "content": {
              "text/event-stream": { }
            }
          },
          "401": {
            "description": "Missing or invalid access token. The WWW-Authenticate header names the protected-resource metadata document, which starts the OAuth discovery handshake."
          }
        },
        "security": [
          {
            "OAuth access token": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "MCP"
        ],
        "summary": "End the MCP session",
        "description": "Terminates the session named by the Mcp-Session-Id header.",
        "operationId": "McpEndSession",
        "responses": {
          "200": {
            "description": "Session ended."
          },
          "401": {
            "description": "Missing or invalid access token. The WWW-Authenticate header names the protected-resource metadata document, which starts the OAuth discovery handshake."
          }
        },
        "security": [
          {
            "OAuth access token": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ApiResponseOfCrimeDataContainer": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/CrimeDataContainer"
          }
        }
      },
      "ApiResponseOfEmptyObject": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/EmptyObject"
          }
        }
      },
      "ApiResponseOfIEnumerableOfCountry": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Country"
            }
          }
        }
      },
      "ApiResponseOfIEnumerableOfCountyRegion": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CountyRegion"
            }
          }
        }
      },
      "ApiResponseOfIEnumerableOfCrimeTypeDescription": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CrimeTypeDescription"
            }
          }
        }
      },
      "ApiResponseOfIEnumerableOfPoliceForce": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PoliceForce"
            }
          }
        }
      },
      "ApiResponseOfIEnumerableOfTownCity": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TownCity"
            }
          }
        }
      },
      "ApiResponseOfNoDataObject": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/NoDataObject"
          }
        }
      },
      "ApiResponseOfTopCrimeTypesContainer": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/TopCrimeTypesContainer"
          }
        }
      },
      "ApiResponseOfUsageReport": {
        "required": [
          "error",
          "errorMessage",
          "content"
        ],
        "type": "object",
        "properties": {
          "error": {
            "type": "boolean",
            "default": false
          },
          "errorMessage": {
            "type": "string"
          },
          "content": {
            "$ref": "#/components/schemas/UsageReport"
          }
        }
      },
      "Country": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "CountyRegion": {
        "required": [
          "name",
          "slug",
          "ukRegionName",
          "ukRegionNameDefiniteArticle",
          "country"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "ukRegionName": {
            "type": "string"
          },
          "ukRegionNameDefiniteArticle": {
            "type": "string"
          },
          "country": {
            "type": "string"
          }
        }
      },
      "CrimeDataContainer": {
        "type": "object",
        "properties": {
          "metadata": {
            "$ref": "#/components/schemas/CrimeDataMetadata"
          },
          "walkingDistances": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CrimeDataWalkingDistancesContainer"
              }
            ]
          },
          "crimeData": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CrimeDataWalkingDistanceBaseContainer"
              }
            ]
          }
        }
      },
      "CrimeDataMetadata": {
        "type": "object",
        "properties": {
          "crimeRateImportDate": {
            "type": "string",
            "format": "date"
          },
          "latestCrimeDataDate": {
            "type": "string",
            "format": "date"
          },
          "previousYearCrimeDataDate": {
            "type": "string",
            "format": "date"
          },
          "latestYear": {
            "type": [
              "null",
              "string"
            ]
          },
          "latestMonth": {
            "type": [
              "null",
              "string"
            ]
          },
          "latestMonthName": {
            "type": [
              "null",
              "string"
            ]
          },
          "latestMonthKey": {
            "type": [
              "null",
              "string"
            ]
          },
          "previousYear": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "CrimeDataWalkingDistanceBaseContainer": {
        "required": [
          "latestTwelveMonths",
          "previousTwelveMonths",
          "latestRollingYear",
          "previousRollingYear"
        ],
        "type": "object",
        "properties": {
          "latestTwelveMonths": {
            "type": "object"
          },
          "previousTwelveMonths": {
            "type": "object"
          },
          "latestRollingYear": {
            "$ref": "#/components/schemas/FlatAreaCriByRollingYearApiItem"
          },
          "previousRollingYear": {
            "$ref": "#/components/schemas/FlatAreaCriByRollingYearApiItem"
          }
        }
      },
      "CrimeDataWalkingDistancesContainer": {
        "required": [
          "fiveMinutes",
          "tenMinutes",
          "fifteenMinutes"
        ],
        "type": "object",
        "properties": {
          "fiveMinutes": {
            "$ref": "#/components/schemas/CrimeDataWalkingDistanceBaseContainer"
          },
          "tenMinutes": {
            "$ref": "#/components/schemas/CrimeDataWalkingDistanceBaseContainer"
          },
          "fifteenMinutes": {
            "$ref": "#/components/schemas/CrimeDataWalkingDistanceBaseContainer"
          }
        }
      },
      "CrimeRateReportResponseType": {
        "enum": [
          "PdfBytes",
          "SignedS3Url"
        ]
      },
      "CrimeTypeDescription": {
        "required": [
          "name",
          "nameShort",
          "slug",
          "abbreviation"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "nameShort": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "abbreviation": {
            "type": "string"
          }
        }
      },
      "EmptyObject": {
        "type": "object"
      },
      "FlatAreaCriByRollingYearApiItem": { },
      "NoDataObject": {
        "required": [
          "reason",
          "area"
        ],
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          },
          "area": {
            "type": "string"
          }
        }
      },
      "PoliceForce": {
        "required": [
          "name",
          "nameInformal",
          "slug",
          "dataLimited"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "nameInformal": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "dataLimited": {
            "type": "boolean"
          }
        }
      },
      "TopCrimeTypeItem": {
        "required": [
          "rank",
          "name",
          "slug",
          "cri",
          "crimeRate",
          "crimeCount",
          "colors",
          "minutes",
          "writeup"
        ],
        "type": "object",
        "properties": {
          "rank": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "cri": {
            "type": "number",
            "format": "decimal"
          },
          "crimeRate": {
            "type": "number",
            "format": "decimal"
          },
          "crimeCount": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "colors": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "minutes": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "writeup": {
            "type": "string"
          }
        }
      },
      "TopCrimeTypesContainer": {
        "required": [
          "metadata",
          "location",
          "rollingYearEnding",
          "topCrimeTypes",
          "extraCrimeTypes"
        ],
        "type": "object",
        "properties": {
          "metadata": {
            "$ref": "#/components/schemas/CrimeDataMetadata"
          },
          "location": {
            "$ref": "#/components/schemas/TopCrimeTypesLocation"
          },
          "rollingYearEnding": {
            "$ref": "#/components/schemas/TopCrimeTypesRollingYearEnding"
          },
          "policeForce": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TopCrimeTypesPoliceForce"
              }
            ]
          },
          "topCrimeTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopCrimeTypeItem"
            }
          },
          "extraCrimeTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopCrimeTypeItem"
            }
          }
        }
      },
      "TopCrimeTypesLocation": {
        "required": [
          "name",
          "latitude",
          "longitude"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "latitude": {
            "type": "number",
            "format": "decimal"
          },
          "longitude": {
            "type": "number",
            "format": "decimal"
          }
        }
      },
      "TopCrimeTypesPoliceForce": {
        "required": [
          "name",
          "displayNameInformalDefinite"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "displayNameInformalDefinite": {
            "type": "string"
          }
        }
      },
      "TopCrimeTypesRollingYearEnding": {
        "required": [
          "year",
          "monthId",
          "monthName"
        ],
        "type": "object",
        "properties": {
          "year": {
            "type": "string"
          },
          "monthId": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "uint8"
          },
          "monthName": {
            "type": "string"
          }
        }
      },
      "TownCity": {
        "required": [
          "name",
          "slug",
          "populationSizeClassName"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "populationSizeClassName": {
            "type": "string"
          }
        }
      },
      "UsageDailyPoint": {
        "required": [
          "date",
          "total",
          "billable",
          "zeroRated",
          "errors"
        ],
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "billable": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "zeroRated": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "errors": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          }
        }
      },
      "UsageKeyInfo": {
        "required": [
          "prefix",
          "name",
          "scopes"
        ],
        "type": "object",
        "properties": {
          "prefix": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UsageRecentCall": {
        "required": [
          "createdAt",
          "routeTemplate",
          "method",
          "statusCode",
          "durationMs",
          "billingStatus",
          "zeroRatedReason"
        ],
        "type": "object",
        "properties": {
          "createdAt": {
            "type": "string"
          },
          "routeTemplate": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "statusCode": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "durationMs": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "billingStatus": {
            "type": "string"
          },
          "zeroRatedReason": {
            "type": [
              "null",
              "string"
            ]
          },
          "subOperation": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UsageReport": {
        "required": [
          "key",
          "window",
          "summary",
          "daily",
          "topRoutes",
          "statusCodes",
          "recentCalls"
        ],
        "type": "object",
        "properties": {
          "key": {
            "$ref": "#/components/schemas/UsageKeyInfo"
          },
          "window": {
            "$ref": "#/components/schemas/UsageWindow"
          },
          "summary": {
            "$ref": "#/components/schemas/UsageSummary"
          },
          "daily": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageDailyPoint"
            }
          },
          "topRoutes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageTopRoute"
            }
          },
          "statusCodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageStatusCode"
            }
          },
          "recentCalls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UsageRecentCall"
            }
          }
        }
      },
      "UsageStatusCode": {
        "required": [
          "statusCode",
          "count"
        ],
        "type": "object",
        "properties": {
          "statusCode": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "count": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          }
        }
      },
      "UsageSummary": {
        "required": [
          "totalCalls",
          "billableCalls",
          "zeroRatedCalls",
          "errorCalls",
          "avgDurationMs",
          "maxDurationMs"
        ],
        "type": "object",
        "properties": {
          "totalCalls": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "billableCalls": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "zeroRatedCalls": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "errorCalls": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "avgDurationMs": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "maxDurationMs": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "UsageTopRoute": {
        "required": [
          "routeTemplate",
          "count",
          "billableCount",
          "errorCount"
        ],
        "type": "object",
        "properties": {
          "routeTemplate": {
            "type": "string"
          },
          "count": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "billableCount": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "errorCount": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int64"
          },
          "subOperation": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "UsageWindow": {
        "required": [
          "from",
          "to",
          "days"
        ],
        "type": "object",
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "days": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      }
    },
    "securitySchemes": {
      "API Key": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      },
      "Public key": {
        "type": "apiKey",
        "name": "key",
        "in": "query"
      },
      "OAuth access token": {
        "type": "http",
        "description": "Issued by the crimerate.co.uk authorization server — MCP clients discover it via the protected-resource metadata document and authorise interactively. API keys do not work on /mcp.",
        "scheme": "bearer",
        "bearerFormat": "OAuth 2.1 access token"
      }
    }
  },
  "tags": [
    {
      "name": "Crime Reports"
    },
    {
      "name": "Crime Data"
    },
    {
      "name": "Top Crime Types"
    },
    {
      "name": "Place lookups"
    },
    {
      "name": "Definitions"
    },
    {
      "name": "Usage"
    },
    {
      "name": "MCP"
    }
  ]
}