Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/samgutentag/bcycle-map/llms.txt

Use this file to discover all available pages before exploring further.

The /current endpoint returns the most recent snapshot that the poller wrote to Cloudflare KV for the requested system. This is the primary data source for the live map’s station pins, stats card, and sparkline widget — it contains everything the frontend needs in a single request.

Endpoint

GET /api/systems/:systemId/current

Path parameters

systemId
string
required
The unique system identifier. Must match a system registered in the systems index.Example: bcycle_santabarbara

Response

On success the worker reads system:<systemId>:latest from KV and returns the raw JSON blob with Content-Type: application/json and Cache-Control: max-age=60.

Top-level fields

system
object
required
Static metadata about the system sourced from the GBFS system_information feed.
snapshot_ts
number
required
Unix timestamp (seconds) of the poll tick that produced this snapshot.
stations
array
required
Array of station objects combining static info (location, name) with live counts.
max_bikes_ever
number
Highest total sum(num_bikes_available) the poller has ever observed. A proxy for total fleet size. Grows monotonically; converges within a day or two of first polling.
recent24h
array
Rolling 24-element window of per-hour min/max bikes-available stats. Used by the sparkline widget.
last_total_changed_ts
number
Unix seconds when the system-wide bike count last changed. Used to render a “changed X min ago” badge.

Error responses

StatusBodyMeaning
404not foundNo KV data exists for this systemId. The system may not be registered or the poller has not run yet.

Example request

curl https://bcycle-map-read-api.developer-95b.workers.dev/api/systems/bcycle_santabarbara/current

Example response

{
  "system": {
    "system_id": "bcycle_santabarbara",
    "name": "Santa Barbara BCycle",
    "timezone": "America/Los_Angeles",
    "language": "en"
  },
  "snapshot_ts": 1747144500,
  "max_bikes_ever": 47,
  "last_total_changed_ts": 1747144200,
  "recent24h": [
    { "hour_ts": 1747101600, "bikes_max": 42, "bikes_min": 31 }
  ],
  "stations": [
    {
      "station_id": "station_001",
      "name": "Stearns Wharf",
      "lat": 34.4094,
      "lon": -119.6857,
      "address": "Stearns Wharf, Santa Barbara, CA",
      "num_bikes_available": 4,
      "num_docks_available": 7,
      "bikes_electric": 2,
      "bikes_classic": 2,
      "bikes_smart": 0,
      "is_installed": true,
      "is_renting": true,
      "is_returning": true,
      "last_reported": 1747144480,
      "first_seen_ts": 1700000000
    }
  ]
}
The poller writes a new KV snapshot approximately every 5 minutes. Combined with the 60-second edge cache, data you receive may be up to 65 seconds behind the most recent poll tick. For near-real-time activity (bike departures/arrivals), use the lower-latency /activity endpoint (max-age=20).

Build docs developers (and LLMs) love