Get service alerts for a route or an operator

GET /v1/alerts
Base URL: https://capi.busmaps.com:8443

Return current service alerts (disruptions) filtered to a single route or a single operator. Lightweight alternative to fetching the whole /v1/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 /v1/line and /v1/nextDepartures.

Response fields and units

FieldFormat / unitMeaning
alerts[].validFrom, alerts[].validUntil ISO 8601 Alert validity interval; an empty value means open-ended
processingTimeMs milliseconds Server processing time

Parameters

ParameterTypeRequiredDescriptionExample
routeId string No Route identifier without the country prefix, taken from the routeId field of a /v1/stopsInRadius or /v1/nextDepartures response. Mutually exclusive with operatorId; exactly one of the two is required 656716379-1251475361
operatorId string No 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 Yes Region name that selects the backend, taken from the regionName field of the /v1/stopsInRadius or /v1/nextDepartures response that gave you the id uk_ireland
countryIso string Yes ISO 3166-1 alpha-3 country code from the same response, used to rebuild the prefixed upstream id GBR
lang string No Language code for translated alert text (IETF BCP 47 format) en

Try It Out

Mode 1: Alerts for a route

curl -H "capi-key: Bearer YOUR_API_KEY" \
     -H "capi-host: busmaps.com" \
     "https://capi.busmaps.com:8443/v1/alerts?routeId=656716379-1251475361&regionName=uk_ireland&countryIso=GBR"

Mode 2: Alerts for an operator

curl -H "capi-key: Bearer YOUR_API_KEY" \
     -H "capi-host: busmaps.com" \
     "https://capi.busmaps.com:8443/v1/alerts?operatorId=999439309-3050404026&regionName=uk_ireland&countryIso=GBR"

Response Example

{
    "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": "3843378925-2667377543",
                    "countryIso": "GBR",
                    "countryUrl": "uk"
                },
                {
                    "routeId": "997937558-3812588401",
                    "countryIso": "GBR",
                    "countryUrl": "uk"
                },
                {
                    "routeId": "656716379-1251475361",
                    "countryIso": "GBR",
                    "countryUrl": "uk"
                }
            ]
        }
    ],
    "regionName": "uk_ireland",
    "processingTimeMs": 57.19
}

Response Schema

View 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

200 List of service alerts (empty when there are none, or on wikiroutes)
400 Invalid parameters / unknown regionName / not exactly one of routeId or operatorId
404 Unknown route or operator id
500 Internal server error