# MTA API

> MTA workflow and API: service status. Returns lines, mode, alerts and status as JSON.

MTA data from mta.info: service status.

- Page: https://fous.com/workflows/mta
- Handle: `@mta`
- Category: [Travel](https://fous.com/workflows/category/travel)
- Source website: https://mta.info
- Last verified: Sep 29, 2026
- Fous is not affiliated with MTA.

## Methods

### Get service status

Operation `get_service_status`, version 1. 1 credit per call.

Get current MTA line statuses and active alerts for subway, bus, Long Island Rail Road, or Metro-North. Bus and rail status reflects published alerts; no alert means Good service.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `line` | string | no | `"A"` | Line or route name, such as A, M15, or Hudson Line. |
| `mode` | string | no | `"subway"` | Transit mode, such as subway or lirr. |

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "line": {
      "type": "string",
      "description": "Line or route name, such as A, M15, or Hudson Line.",
      "examples": [
        "A",
        "M15",
        "Hudson Line"
      ]
    },
    "mode": {
      "enum": [
        "subway",
        "bus",
        "lirr",
        "metro_north",
        "all"
      ],
      "type": "string",
      "default": "subway",
      "description": "Transit mode, such as subway or lirr.",
      "examples": [
        "subway",
        "bus",
        "metro_north"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "line": "A",
      "mode": "subway"
    },
    {},
    {
      "line": "M15",
      "mode": "bus"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `lines` | array |  |  |
| `lines[].mode` | string | `"subway"` |  |
| `lines[].alerts` | array |  |  |
| `lines[].status` | string | `"Delays"` |  |
| `lines[].line_name` | string | `"A"` |  |
| `lines[].page_link` | string | `"https://www.mta.info/schedules/subway/a-train"` |  |
| `status_page_link` | string | `"https://www.mta.info/"` |  |

**Example input**

```json
{
  "line": "A",
  "mode": "subway"
}
```

**Example output**

```json
{
  "lines": [
    {
      "mode": "subway",
      "alerts": [
        {
          "alert_id": "lmm:alert:269468:26",
          "headline": "[A] [S] trains are delayed in both directions while the South Channel Bridge opens for marine traffic to pass.",
          "active_to": null,
          "active_from": "2026-09-29T00:56:04-04:00",
          "description": null,
          "affected_stations": []
        },
        {
          "alert_id": "lmm:planned_work:34339",
          "headline": "[A] is rerouted in Manhattan and Downtown Brooklyn",
          "active_to": "2026-09-29T05:00:00-04:00",
          "active_from": "2026-09-28T21:30:00-04:00",
          "description": "No [A] service in both directions at 50 St, 42 St-Port Authority, 34 St-Penn Station, 23 St, 14 St, Spring St, Canal St, Chambers St, World Trade Center, Fulton St and High St [A] runs local between 1…",
          "affected_stations": [
            "59 St-Columbus Circle",
            "50 St",
            "42 St-Port Authority Bus Terminal"
          ]
        }
      ],
      "status": "Delays",
      "line_name": "A",
      "page_link": "https://www.mta.info/schedules/subway/a-train"
    }
  ],
  "status_page_link": "https://www.mta.info/"
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@mta",
  "visibility": "public",
  "operation": "get_service_status",
  "version": 1,
  "input": {
    "line": "A",
    "mode": "subway"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@mta\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_service_status\",\n  \"version\": 1,\n  \"input\": {\n    \"line\": \"A\",\n    \"mode\": \"subway\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@mta",
  "visibility": "public",
  "operation": "get_service_status",
  "version": 1,
  "input": {
    "line": "A",
    "mode": "subway"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@mta","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## FAQ

### Is Fous affiliated with MTA?

No. Fous is not affiliated with MTA. This workflow reads the public mta.info website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a MTA account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from mta.info when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

## Related

- [Transport for London API](https://fous.com/workflows/transport-for-london.md): Transport for London reports current or currently published future-day service status and ordered journey options with directions and adult pay-as-you-go fares when available.
- [Amtrak API](https://fous.com/workflows/amtrak.md): Amtrak passenger train travel and status.
- [FlightAware API](https://fous.com/workflows/flightaware.md): FlightAware provides public flight status and dated flight details, airport arrivals and departures limited to displayed history and 20 flights per direction, plus today’s delays and cancellations when shown.
- [The New York Times API](https://fous.com/workflows/the-new-york-times.md): The New York Times provides current section headlines and summaries, keyword-matched public listings with dates, authors, sections and links, and Best Sellers lists for the latest issue or dates within a week.
- [Deutsche Bahn API](https://fous.com/workflows/deutsche-bahn.md): Train schedules, tickets and travel information in Germany.
- [Flightradar24 API](https://fous.com/workflows/flightradar24.md): Flightradar24 provides live flight tracking, recent history, flight status and times, plus upcoming airport departures and arrivals; history and schedules are limited to recent and upcoming flights.
- [National Park Service API](https://fous.com/workflows/national-park-service.md): The National Park Service provides official park and site information, visiting details, and current alerts; schedules and booking rules can change, and alert update dates may be unavailable.
- [Atlassian Statuspage API](https://fous.com/workflows/atlassian-statuspage.md): Public status pages for service health, incidents, and maintenance.
- [All Travel workflows](https://fous.com/workflows/category/travel)
