{
 "openapi": "3.1.0",
 "info": {
  "title": "ScannerScope API",
  "version": "1.1.0",
  "description": "Police, fire and EMS radio as structured incidents, statistics and written updates. See https://scannerscope.com/developers"
 },
 "servers": [
  {
   "url": "https://scannerscope.com/api/v1"
  }
 ],
 "security": [
  {
   "bearer": []
  },
  {
   "basic": []
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   },
   "basic": {
    "type": "http",
    "scheme": "basic",
    "description": "Any username, API key as the password."
   }
  }
 },
 "paths": {
  "/feeds": {
   "get": {
    "operationId": "listFeeds",
    "summary": "Feeds, live links and freshness",
    "responses": {
     "200": {
      "description": "Feeds",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  },
  "/events": {
   "get": {
    "operationId": "listEvents",
    "summary": "Radio events for a period (up to 31 days)",
    "parameters": [
     {
      "name": "feed",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated feed slugs. Default: every feed your key can read."
     },
     {
      "name": "minutes",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "The last N minutes."
     },
     {
      "name": "since",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "From this time until now: unix seconds, ISO datetime or YYYY-MM-DD."
     },
     {
      "name": "date",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "One local day, YYYY-MM-DD."
     },
     {
      "name": "from",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Period start."
     },
     {
      "name": "to",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Period end. A bare date includes that whole day."
     },
     {
      "name": "type",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated incident types."
     },
     {
      "name": "urgency",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Minimum urgency: routine, elevated, urgent, emergency."
     },
     {
      "name": "min_score",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Minimum importance, 1-10."
     },
     {
      "name": "road",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Road name; tolerant of Rd, Rt 23 and similar."
     },
     {
      "name": "q",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Every word must appear."
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "open or closed"
     },
     {
      "name": "incident",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "All updates on one incident"
     },
     {
      "name": "group",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "incident groups events into incidents"
     },
     {
      "name": "include",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "lines adds transcript lines"
     },
     {
      "name": "compact",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "1 drops transcripts"
     },
     {
      "name": "order",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "asc or desc"
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Up to 1000"
     },
     {
      "name": "sensitive",
      "in": "query",
      "description": "only or exclude events labelled sensitive",
      "schema": {
       "type": "string",
       "enum": [
        "only",
        "exclude"
       ]
      }
     },
     {
      "name": "near",
      "in": "query",
      "description": "lat,lon,km: located incidents within km of a point",
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Events",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  },
  "/events/{feed}/{id}": {
   "get": {
    "operationId": "getEvent",
    "summary": "One event with its transcript lines",
    "parameters": [
     {
      "name": "feed",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Event",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  },
  "/live": {
   "get": {
    "operationId": "getLive",
    "summary": "Right-now summary and latest activity",
    "parameters": [
     {
      "name": "feed",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated feed slugs. Default: every feed your key can read."
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Recent events per feed, up to 100"
     }
    ],
    "responses": {
     "200": {
      "description": "Live state",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  },
  "/changes": {
   "get": {
    "operationId": "getChanges",
    "summary": "Events created or changed since a cursor (last 24 hours)",
    "parameters": [
     {
      "name": "feed",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated feed slugs. Default: every feed your key can read."
     },
     {
      "name": "since",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "The cursor from your previous response"
     },
     {
      "name": "type",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated types"
     },
     {
      "name": "urgency",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Minimum urgency"
     },
     {
      "name": "min_score",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Minimum importance"
     },
     {
      "name": "sensitive",
      "in": "query",
      "description": "only or exclude events labelled sensitive",
      "schema": {
       "type": "string",
       "enum": [
        "only",
        "exclude"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Changes and the next cursor",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  },
  "/stats": {
   "get": {
    "operationId": "getStats",
    "summary": "Incident counts over any period, across all history",
    "parameters": [
     {
      "name": "feed",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated feed slugs. Default: every feed your key can read."
     },
     {
      "name": "minutes",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "The last N minutes."
     },
     {
      "name": "since",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "From this time until now: unix seconds, ISO datetime or YYYY-MM-DD."
     },
     {
      "name": "date",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "One local day, YYYY-MM-DD."
     },
     {
      "name": "from",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Period start."
     },
     {
      "name": "to",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Period end. A bare date includes that whole day."
     },
     {
      "name": "days",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "The last N days"
     },
     {
      "name": "type",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated incident types."
     },
     {
      "name": "urgency",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Minimum urgency: routine, elevated, urgent, emergency."
     },
     {
      "name": "min_score",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Minimum importance, 1-10."
     },
     {
      "name": "road",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Road name; tolerant of Rd, Rt 23 and similar."
     },
     {
      "name": "category",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "fire, medical, roads, police, other"
     },
     {
      "name": "unit",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Unit name contains this"
     },
     {
      "name": "group_by",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "One or two of: hour, day, week, month, hour_of_day, weekday, type, category, urgency, road, unit, feed"
     },
     {
      "name": "metric",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "incidents or updates"
     },
     {
      "name": "compare",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "previous adds the prior period of equal length"
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Groups to return, up to 1000"
     }
    ],
    "responses": {
     "200": {
      "description": "Totals and groups",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  },
  "/reports": {
   "get": {
    "operationId": "getReports",
    "summary": "Written hourly, daily and weekly updates",
    "parameters": [
     {
      "name": "feed",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Comma-separated feed slugs. Default: every feed your key can read."
     },
     {
      "name": "period",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "hourly, daily or weekly"
     },
     {
      "name": "latest",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "1 returns the newest per feed"
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer"
      },
      "description": "Up to 400"
     },
     {
      "name": "since",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "From this time until now: unix seconds, ISO datetime or YYYY-MM-DD."
     },
     {
      "name": "date",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "One local day, YYYY-MM-DD."
     },
     {
      "name": "from",
      "in": "query",
      "schema": {
       "type": "string"
      },
      "description": "Period start."
     }
    ],
    "responses": {
     "200": {
      "description": "Reports",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "401": {
      "description": "Missing or invalid key"
     },
     "429": {
      "description": "Rate limit exceeded; see Retry-After"
     }
    }
   }
  }
 }
}