{
  "openapi": "3.0.1",
  "info": {
    "title": "MBTA Boston: Bus & Train Arrivals, Timetables, Alerts",
    "description": "Next departures at any MBTA stop or station as rows: minutes away, headsign, direction, live flag and delay against the timetable. Slots the source does not predict are filled from the schedule. Other modes: timetable by date, service alerts, live vehicles, stop and route dictionaries.",
    "version": "0.1",
    "x-build-id": "HWqLUBywlKzOwxlgw"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yadroo~mbta-arrivals/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yadroo-mbta-arrivals",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/yadroo~mbta-arrivals/runs": {
      "post": {
        "operationId": "runs-sync-yadroo-mbta-arrivals",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/yadroo~mbta-arrivals/run-sync": {
      "post": {
        "operationId": "run-sync-yadroo-mbta-arrivals",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "What to return",
            "enum": [
              "arrivals",
              "schedule",
              "alerts",
              "vehicles",
              "stops",
              "routes"
            ],
            "type": "string",
            "description": "`arrivals` answers 'when does the next one leave here': predictions first, and for every slot the source does not predict (late night, a trip hours ahead, a stop without realtime) the published timetable is used, so a run at 03:00 still writes rows. `schedule` ignores realtime and writes the whole timetable of a service date. `alerts` writes the disruptions the agency publishes. `vehicles` writes one row per vehicle in service with its position. `stops` and `routes` are the two dictionaries: run them once to learn the ids the filters below accept.",
            "default": "arrivals"
          },
          "stopQuery": {
            "title": "Stop or station name",
            "type": "string",
            "description": "A station or stop name as riders say it: `Park Street`, `South Station`, `Porter`, `Harvard`, `Nubian`. The actor resolves it against the source's own stop list — stations first, then platforms and bus stops — and reports the id it picked in the run log. Ambiguous names resolve to the busiest match; write the exact name or use *Stop IDs* to be precise. A name nothing matches yields one row with `found: false`, never a silent empty run."
          },
          "stopIds": {
            "title": "Stop IDs",
            "type": "array",
            "description": "Source ids instead of a name, several allowed: `place-pktrm` (Park Street), `place-sstat` (South Station), `70075` (one subway platform), `1936` (a bus stop pole). A station id covers every platform under it. Run mode `stops` to get the ids for your area or line.",
            "items": {
              "type": "string"
            }
          },
          "routeIds": {
            "title": "Route IDs",
            "type": "array",
            "description": "Keep only these routes: `Red`, `Orange`, `Blue`, `Mattapan`, `Green-B`…`Green-E` for rapid transit, a bus number such as `1`, `66`, `111`, `SL1`, or a commuter rail line such as `CR-Fitchburg`, `CR-Providence`, `CR-Newburyport`. Without a stop filter this returns arrivals, alerts or vehicles for the whole route. Mode `routes` writes the full list of ids.",
            "items": {
              "type": "string"
            }
          },
          "routeTypes": {
            "title": "Modes of transport",
            "type": "array",
            "description": "Keep only these modes. Useful at a stop several modes share: South Station has commuter rail, subway and buses, so `commuter-rail` alone gives a departure board a station screen can show. Empty = every mode.",
            "items": {
              "type": "string",
              "enum": [
                "light-rail",
                "subway",
                "commuter-rail",
                "bus",
                "ferry"
              ],
              "enumTitles": [
                "Light rail — Green Line and Mattapan trolley",
                "Subway — Red, Orange and Blue lines",
                "Commuter rail",
                "Bus (including Silver Line)",
                "Ferry"
              ]
            }
          },
          "latitude": {
            "title": "Latitude",
            "minimum": -90,
            "maximum": 90,
            "type": "number",
            "description": "Search stops around a point instead of naming one. Give latitude and longitude together, e.g. 42.3601 / -71.0589 for downtown Boston. Every row then carries `distanceMeters`, the real distance from your point, and rows are written nearest first."
          },
          "longitude": {
            "title": "Longitude",
            "minimum": -180,
            "maximum": 180,
            "type": "number",
            "description": "The other half of the coordinate. Boston longitudes are negative (about -71)."
          },
          "radiusMeters": {
            "title": "Search radius (metres)",
            "minimum": 50,
            "maximum": 5000,
            "type": "integer",
            "description": "How far around the coordinate to look, in metres. 300 is one block, 600 a short walk, 1500 a long one. The source's own radius filter works in degrees, so the actor converts, asks for slightly more and then measures each stop, which is why `distanceMeters` never exceeds what you asked for.",
            "default": 600
          },
          "directionId": {
            "title": "Direction",
            "enum": [
              "any",
              "0",
              "1"
            ],
            "type": "string",
            "description": "Every route names its two directions itself; the row shows the name (`Inbound`, `Southbound`, `Alewife`) next to the number. A platform display normally wants one direction only. Mode `routes` lists the direction names and destinations per route.",
            "default": "any"
          },
          "minutesAhead": {
            "title": "Look ahead (minutes)",
            "minimum": 5,
            "maximum": 1440,
            "type": "integer",
            "description": "Mode `arrivals` only: how far into the future departures may lie. 30 for a stop display, 120 for a planning board, 720 for the rest of the day. If nothing at all runs inside the window — after the last trip of the night — the actor falls back to the first departures of the next service day rather than returning nothing, and those rows are marked `source: schedule`.",
            "default": 120
          },
          "serviceDate": {
            "title": "Service date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "YYYY-MM-DD, used by mode `schedule` (and by `arrivals` when you want another day). Empty = today in Boston local time. A service date runs past midnight: trips after 00:00 belong to the day before, and the actor writes the date the agency counts them under. The published feed covers roughly the current quarter, so a date far in the past or future has no trips."
          },
          "startTime": {
            "title": "Start of the day window",
            "pattern": "^\\d{1,2}:\\d{2}$",
            "type": "string",
            "description": "HH:MM in Boston local time, mode `schedule` only. Empty = the whole service day from its first trip. Values past midnight are written as 24:xx or 25:xx, the way the timetable counts them, so `25:00` means 1 a.m. of the next calendar day."
          },
          "includeScheduled": {
            "title": "Fill gaps from the timetable",
            "type": "boolean",
            "description": "On (the default) mode `arrivals` adds scheduled departures for every slot without a live prediction, marks them `source: schedule` and, where both exist for the same trip, writes `delaySeconds` — the prediction minus the timetable. Off, only what the source predicts right now is written, which is closer to a raw realtime feed and can be empty outside service hours.",
            "default": true
          },
          "alertEffects": {
            "title": "Alert effects",
            "type": "array",
            "description": "Keep only alerts of these kinds. The accessibility set (`ELEVATOR_CLOSURE`, `ESCALATOR_CLOSURE`, `ACCESS_ISSUE`, `STATION_ISSUE`) is what a step-free routing tool needs; `DELAY`, `SHUTTLE`, `SUSPENSION` and `DETOUR` are what a status board shows. Filtering happens on the `effect` field of the rows, so an effect nobody published today simply yields fewer rows. Empty = every kind.",
            "items": {
              "type": "string",
              "enum": [
                "DELAY",
                "SHUTTLE",
                "DETOUR",
                "SUSPENSION",
                "CANCELLATION",
                "STATION_CLOSURE",
                "STOP_CLOSURE",
                "STOP_MOVE",
                "TRACK_CHANGE",
                "SCHEDULE_CHANGE",
                "SERVICE_CHANGE",
                "STATION_ISSUE",
                "ACCESS_ISSUE",
                "ELEVATOR_CLOSURE",
                "ESCALATOR_CLOSURE",
                "SNOW_ROUTE",
                "NO_SERVICE",
                "POLICY_CHANGE",
                "NOTICE",
                "SUMMARY"
              ],
              "enumTitles": [
                "Delay",
                "Shuttle buses",
                "Detour",
                "Suspension",
                "Cancelled trip",
                "Station closed",
                "Stop closed",
                "Stop moved",
                "Track change",
                "Schedule change",
                "Service change",
                "Station issue",
                "Accessibility issue",
                "Elevator out of service",
                "Escalator out of service",
                "Snow route",
                "No service",
                "Policy change",
                "Notice",
                "Summary"
              ]
            }
          },
          "alertSeverityMin": {
            "title": "Minimum severity",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "The source grades each alert from 0 to 10; in practice 1 is an information notice, 3–5 a real disruption, 7 and above a line-wide event. Set 3 to drop the elevator and signage notices from a status board. Empty = keep all."
          },
          "alertLifecycles": {
            "title": "Alert lifecycle",
            "type": "array",
            "description": "Where the alert stands in its life. `NEW` plus `UPCOMING` is the feed for 'what has been announced since yesterday'; `ONGOING` is what riders are living with now. Empty = every lifecycle.",
            "items": {
              "type": "string",
              "enum": [
                "NEW",
                "ONGOING",
                "ONGOING_UPCOMING",
                "UPCOMING"
              ],
              "enumTitles": [
                "New — published recently",
                "Ongoing — in effect now",
                "Ongoing and upcoming again",
                "Upcoming — announced for later"
              ]
            }
          },
          "activeOnly": {
            "title": "Only alerts in effect now",
            "type": "boolean",
            "description": "On (the default) only alerts whose active period covers this moment are written and `active` is true. Off, planned and past ones come too, each with its `activePeriodStart` and `activePeriodEnd`, which is how you export next weekend's shuttle plan.",
            "default": true
          },
          "sinceHours": {
            "title": "Changed in the last N hours",
            "minimum": 1,
            "maximum": 720,
            "type": "integer",
            "description": "Keep only alerts the source updated inside this many hours, counted in UTC from the start of the run. 24 on a daily task is the honest 'what is new since yesterday' feed. Empty = no time filter."
          },
          "onlyNew": {
            "title": "Only rows not seen before",
            "type": "boolean",
            "description": "Remember each row's key in this actor's key-value store (alert id and update time, or trip plus stop plus scheduled time) and write only keys that were not there on the previous run. The first run writes everything it finds, later runs write what appeared since — a watch that does not pay for the same alert twice. Leave it off for a departure board, where you want the full picture each run.",
            "default": false
          },
          "maxItems": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Stop after this many rows. A stop display needs 5–20, a station board 50, a whole-line timetable export a few hundred. The source is polite but rate-limited for anonymous callers, so large exports are paced and take longer.",
            "default": 50
          },
          "fields": {
            "title": "Output fields",
            "type": "array",
            "description": "Keep only these fields, in this order, e.g. [\"stopName\", \"routeName\", \"headsign\", \"minutesAway\"]. Empty = every field the mode fills.",
            "items": {
              "type": "string"
            }
          },
          "apiKey": {
            "title": "Your own API key (optional)",
            "type": "string",
            "description": "Not required: the actor reads the source anonymously. The agency also hands out free keys that raise the request limit from 20 to 1000 per minute; paste one here and big exports run faster. It is sent as a header, never logged and never written to the dataset."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}