Get service alerts for a route or an operator

GET /alerts

Return current service alerts (disruptions) filtered to a single route or a single operator. Lightweight alternative to fetching the whole /line card just for its alerts: call it in parallel with the route/operator screen. Pass exactly one of routeId or operatorId. Alerts are a busmaps.com feature only - wikiroutes.info has none, so there is no reason to call this endpoint there. The alert objects are identical to the alerts[] embedded in /line and /nextDepartures.

Parameters

Parameter Type Required Description Example
routeId string Route identifier without the country prefix, taken from the routeId field of a /stopsInRadius or /nextDepartures response. Mutually exclusive with operatorId; exactly one of the two is required 656716379-1251475361
operatorId string Operator identifier without the country prefix, taken from the operator field of an alert or route. Mutually exclusive with routeId; exactly one of the two is required 999439309-3050404026
regionName string Region name that selects the backend, taken from the regionName field of the /stopsInRadius or /nextDepartures response that gave you the id uk_ireland
countryIso string ISO 3166-1 alpha-3 country code from the same response, used to rebuild the prefixed upstream id GBR
lang string Language code for translated alert text (IETF BCP 47 format, e.g. en, ru, es, zh-CN). If no translation is available, the original text is returned en

Try It Out

Base URL: https://capi.busmaps.com:8443
Example Requests:
Alerts for a route
curl -H "capi-key: Bearer YOUR_API_KEY" -H "capi-host: busmaps.com" "https://capi.busmaps.com:8443/alerts?routeId=656716379-1251475361&regionName=uk_ireland&countryIso=GBR"
Alerts for an operator
curl -H "capi-key: Bearer YOUR_API_KEY" -H "capi-host: busmaps.com" "https://capi.busmaps.com:8443/alerts?operatorId=999439309-3050404026&regionName=uk_ireland&countryIso=GBR"

Response Example

HTTP 200 - Success
{
  "alerts": [
    {
      "id": "4333d12c5ff3",
      "origin": "API",
      "cause": "CONSTRUCTION",
      "effect": "DETOUR",
      "header": "CE26/82401Currey Road UB6  Routes 92  395",
      "description": "Road will be closed due to water works on 29 June 08:00-17:00. Buses will be diverted and will miss stops Carr Road/Wadham Gardens.",
      "url": "https://tfl.gov.uk/bus/status/",
      "validFrom": "",
      "validUntil": "",
      "operator": "912608471-1585141307",
      "countryIso": "GBR",
      "countryUrl": "uk",
      "informedEntity": [
        {
          "routeId": "2583145640-3852985814",
          "countryIso": "GBR",
          "countryUrl": "uk"
        },
        {
          "routeId": "656716379-1251475361",
          "countryIso": "GBR",
          "countryUrl": "uk"
        }
      ]
    }
  ],
  "regionName": "uk_ireland",
  "processingTimeMs": 57.19
}
Response Schema

Title: Alerts Response

View Full JSON Schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Alerts Response",
  "type": "object",
  "properties": {
    "regionName": {
      "type": "string",
      "description": "Transit data region that served the request"
    },
    "alerts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "validUntil": {
            "type": "string",
            "description": "End of the alert validity period (empty if open-ended)"
          },
          "countryIso": {
            "type": "string",
            "description": "ISO 3166-1 alpha-3 country code (e.g. 'GBR')"
          },
          "validFrom": {
            "type": "string",
            "description": "Start of the alert validity period (empty if open-ended)"
          },
          "cause": {
            "type": "string",
            "description": "GTFS-RT cause (e.g. CONSTRUCTION, MAINTENANCE, ACCIDENT)"
          },
          "id": {
            "type": "string",
            "description": "Stable alert identifier (hash of header + description)"
          },
          "operator": {
            "type": "string",
            "description": "Operator id of the alert (stripped, pass as operatorId to re-query)"
          },
          "description": {
            "type": "string",
            "description": "Full alert text"
          },
          "header": {
            "type": "string",
            "description": "Short alert title"
          },
          "countryUrl": {
            "type": "string",
            "description": "Country URL slug (e.g. 'uk')"
          },
          "informedEntity": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "countryIso": {
                  "type": "string",
                  "description": "ISO 3166-1 alpha-3 country code (e.g. 'GBR')"
                },
                "countryUrl": {
                  "type": "string",
                  "description": "Country URL slug (e.g. 'uk')"
                },
                "routeId": {
                  "type": "string",
                  "description": "Internal route identifier"
                }
              },
              "required": [
                "countryIso",
                "routeId",
                "countryUrl"
              ]
            },
            "description": "Routes and/or stops affected by the alert"
          },
          "url": {
            "type": "string",
            "description": "Link with more information about the disruption"
          },
          "effect": {
            "type": "string",
            "description": "GTFS-RT effect (e.g. DETOUR, REDUCED_SERVICE, NO_SERVICE)"
          },
          "origin": {
            "type": "string",
            "description": "Source of the alert (e.g. 'API')"
          }
        },
        "required": [
          "origin",
          "id",
          "countryUrl",
          "operator",
          "description",
          "header",
          "informedEntity",
          "url",
          "effect",
          "countryIso",
          "cause"
        ]
      },
      "description": "Array of service alerts matching the route or operator (empty when there are none)"
    },
    "processingTimeMs": {
      "type": "number",
      "description": "Server processing time in milliseconds"
    }
  },
  "required": [
    "regionName",
    "alerts",
    "processingTimeMs"
  ]
}
Response Codes
HTTP 200

List of service alerts (empty when there are none, or on wikiroutes)

HTTP 400

Invalid parameters / unknown regionName / not exactly one of routeId or operatorId

HTTP 404

Unknown route or operator id

HTTP 500

Internal server error