# 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/tools/mta
- Handle: `@mta`
- Category: [Travel](https://fous.com/tools/category/travel)
- Source website: https://mta.info
- Last verified: Sep 29, 2026

## Methods

### Get service status

Operation `get_service_status`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

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

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_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.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

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=180) 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.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_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);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/mta`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `get_service_status`: Get service status. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-mta https://api.fous.com/mcp/tools/mta --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this MTA tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. 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. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

## Related

- [Transport for London API](https://fous.com/tools/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/tools/amtrak.md): Amtrak passenger train travel and status.
- [FlightAware API](https://fous.com/tools/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/tools/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/tools/deutsche-bahn.md): Train schedules, tickets and travel information in Germany.
- [Flightradar24 API](https://fous.com/tools/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/tools/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/tools/atlassian-statuspage.md): Public status pages for service health, incidents, and maintenance.
- [All Travel tools](https://fous.com/tools/category/travel)
