511.org logo
511.org

get-traffic-alerts

Installation

Adds this website's skill for your agents

 

Summary

Retrieve active San Francisco Bay Area traffic alerts (incidents, construction, road closures, special events) via 511.org's unauthenticated map-UI proxy endpoint as structured Open511 JSON.

FIG. 01
FIG. 02
SKILL.md
153 lines

511.org Bay Area Traffic Alerts

Purpose

Retrieve the current list of active traffic alerts for the San Francisco Bay Area from 511.org — incidents, construction, road closures, and special events. This is a read-only task. The fastest and most reliable path is a single unauthenticated HTTP GET against the same proxy endpoint that powers the 511.org map/alerts UI (webapi.511.org/api-proxy/...), which returns all active events as structured JSON (Open511 schema). No browser automation, login, or API key is required.

When to Use

  • A user asks "what are the current traffic alerts / incidents on Bay Area freeways?"
  • You need active construction, lane/road closures, or special-event traffic impacts for a specific Bay Area highway (US-101, I-580, I-880, CA-4, etc.) or county (San Mateo, Alameda, Sonoma, Santa Clara, …).
  • You need each alert's headline, type, severity, affected road + direction + lane status, geographic coordinates, and last-updated timestamp.
  • You want to filter or count alerts by event_type (INCIDENT / CONSTRUCTION / SPECIAL_EVENT) or by severity (Severe / Major / Moderate / Minor).

Do not use this for transit service alerts (BART/Caltrain/Muni) or for the "Critical Alerts" banner — those come from different feeds (see Gotchas).

Workflow

Recommended method — direct fetch (no browser, no key):

  1. Issue a single HTTP GET to:
    https://webapi.511.org/api-proxy/api/v1/traffic/events/?extended=true
    
    This is the unauthenticated proxy the 511.org map UI itself calls. It returns HTTP 200 with Content-Type: application/json. Use browse cloud fetch "<url>" (residential path not required — this endpoint is not bot-protected) or any plain HTTP client.
  2. Parse the JSON. The top-level object has a single key Events — an array of active alert objects (typically ~60–75 entries). Every returned event has status: "ACTIVE"; there is no pagination.
  3. For each event, read the fields you need (see Expected Output). Key fields: headline, event_type, event_subtypes, severity, roads[] (name/direction/lane_status/road_advisory), areas.area.name (county), geography.coordinates ([lon, lat]), created, updated.
  4. Filter/sort client-side to match the user's request:
    • By type: event_type{INCIDENT, CONSTRUCTION, SPECIAL_EVENT}.
    • By severity: severity{Severe, Major, Moderate, Minor, Unknown} (the site's filter=major corresponds to higher-severity items).
    • By road: substring-match on roads[].name (e.g. US-101, I-580).
    • By area/county: areas.area.name.
  5. Return the filtered list as JSON (schema below). Do not re-fetch per event; the single call contains everything.

Companion feeds (optional, same host, unauthenticated, all HTTP 200):

  • https://webapi.511.org/api-proxy/api/v1/traffic/news/{ "News": [...] } — long-form construction/roadwork advisories (Caltrans).
  • https://webapi.511.org/api-proxy/api/v1/common/ticker/{ "Ticker": [...] } — the site-wide "Critical Alerts" ticker (mostly transit, links to /alerts/critical).

Browser fallback

Only needed if the proxy endpoint changes or you must screenshot the human-readable list:

  1. Open https://511.org/realtime/traffic?layers=traffic-tab-Traffic%20Incident%2Ctraffic-tab-Construction%20Alert%2Ctraffic-tab-Road%20Closure%2Ctraffic-tab-Event&filter=major with a bare session (no proxies, no verified — the site has no bot protection).
  2. Wait ~7s for the JS to render. The left "Traffic Alert Filters" panel lists checkbox layers (Traffic Incident, Construction Alert, Road Closure, Event, Construction and Event Info, Caltrans Message Sign); the main column shows "Showing N out of N active alerts" with each alert's badge, road heading, headline, and "Last updated" timestamp.
  3. Extract from the DOM list, or — better — capture the webapi.511.org/api-proxy/api/v1/traffic/events/?extended=true XHR the page fires and use its JSON. This XHR is the recommended endpoint above; the browser adds nothing.

Site-Specific Gotchas

  • The recorded Roadway_link_data_v3.geojson is NOT traffic alerts. https://511.org/libraries/mapui/build/assets/Roadway_link_data_v3.geojson is a static FeatureCollection of road-segment geometry (link descriptions + coordinate paths) used to draw the map. It contains zero incident/alert data and rarely changes. Ignore it — the live alerts come from webapi.511.org/api-proxy/api/v1/traffic/events/.
  • Use the api-proxy host, not the official open-data API, unless you have a token. https://api.511.org/traffic/events?format=json returns HTTP 401 "The API key is not provided." It requires a free registered token (?api_key=...). The webapi.511.org/api-proxy/... path used by the website needs no key and returns the same underlying data — prefer it for read-only extraction. Only fall back to the official API (with a user-supplied token) if you specifically need the documented/stable Open511 contract.
  • Response is { "Events": [...] }, not a bare array and not GeoJSON. Each event follows the Open511 event schema. Open511 extension fields (e.g. inside roads[].lane_status, source_type, source_id) are wrapped as { "@xmlns": "...", "#text": "value" } — read #text for the actual value.
  • areas can be an object or (in extended=true) sometimes a plain string. Defensive parse: areas?.area?.name ?? areas. County names come from GeoNames.
  • Coordinates are [longitude, latitude] (GeoJSON order), EPSG:4326. Some events use geometry.type: "Point", others "MultiPoint"/"LineString".
  • event_subtypes.event_subtype may be a string or an array of strings (e.g. ["Traffic Hazard","Severe traffic alert"]). Normalize to an array.
  • severity is frequently "Unknown" — especially for CONSTRUCTION (most events). Don't assume every alert has a graded severity; the site's filter=major URL param is a UI convenience, not a server filter.
  • Everything returned is currently ACTIVE; there's no pagination. The full set (~60–75 events at a time in observed runs) arrives in one response.
  • No anti-bot at all. Homepage probe and live runs showed no captcha/WAF. A bare Browserbase session (proxies off, verified off) loads the page and the endpoint fine; residential proxies are unnecessary.
  • The alert-list URL self-normalizes. Opening the filtered /realtime/traffic?... URL redirects to add action=shareTrafficAlert and an extra traffic-tab-Construction and Event Info layer — harmless; the same XHR fires regardless.

Expected Output

Return the active alerts as JSON. Recommended normalized shape:

{
  "source": "https://webapi.511.org/api-proxy/api/v1/traffic/events/?extended=true",
  "retrieved_at": "2026-09-16T17:15:00Z",
  "count": 63,
  "alerts": [
    {
      "event_type": "INCIDENT",
      "event_subtypes": ["Traffic Hazard", "Severe traffic alert"],
      "severity": "Severe",
      "headline": "CHP : Severe traffic alert and Traffic Hazard on US-101 Southbound exiting at Woodside Rd (Redwood City). Off Ramp blocked. Expect delays.",
      "roads": [
        {
          "name": "US-101 S",
          "from": "Woodside Rd",
          "direction": "Southbound",
          "state": "SOME_LANES_CLOSED",
          "lane_status": "blocked",
          "road_advisory": "Expect delays"
        }
      ],
      "area": "San Mateo",
      "coordinates": [-122.256, 37.484],
      "status": "ACTIVE",
      "created": "2026-09-16T14:00Z",
      "updated": "2026-09-16T17:10Z"
    },
    {
      "event_type": "CONSTRUCTION",
      "event_subtypes": ["Long-term construction"],
      "severity": "Unknown",
      "headline": "Caltrans : Long-term construction on CA-116 Eastbound and Westbound east of Bohemian Hwy (Monte Rio). Lane closed. One way traffic control in effect. From 9:00 PM Tue Sep 23 2025 to 9:00 AM Mon Nov 30 2026.",
      "roads": [
        {
          "name": "CA-116",
          "from": "Bohemian Hwy",
          "direction": "Eastbound and Westbound",
          "state": "SINGLE_LANE_ALTERNATING",
          "lane_status": "closed",
          "road_advisory": "One way traffic control in effect"
        }
      ],
      "area": "Sonoma",
      "coordinates": [-123.003077, 38.481584],
      "status": "ACTIVE",
      "created": "2025-09-24T05:00Z",
      "updated": "2026-09-16T12:26Z"
    }
  ]
}

Observed distributions in a single live pull (for sanity-checking your parse):

  • event_type: CONSTRUCTION ~49, INCIDENT ~13, SPECIAL_EVENT ~1.
  • severity: Unknown ~50, Moderate ~9, Minor ~2, Severe ~1, Major ~1.
  • status: ACTIVE for all.

If the endpoint is unreachable or returns non-200 / non-JSON, fail explicitly and report the status code — do not silently fall back to the static Roadway_link_data_v3.geojson, which does not contain alerts.