curl --request POST \
--url https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"limit": 5
}'import requests
url = "https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains"
payload = { "limit": 5 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({limit: 5})
};
fetch('https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains"
payload := strings.NewReader("{\n \"limit\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 5\n}"
response = http.request(request)
puts response.read_bodyLive trains
A snapshot of where trains are right now; use train_status for one train with its stop-by-stop times.
curl --request POST \
--url https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"limit": 5
}'import requests
url = "https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains"
payload = { "limit": 5 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({limit: 5})
};
fetch('https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains"
payload := strings.NewReader("{\n \"limit\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 5\n}"
response = http.request(request)
puts response.read_body请求规范
- 方法与路径: POST /apis/v1/amtrak-com/train-status/live-trains
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/amtrak-com/train-status/live-trains
{
"operationId": "amtrak-com.train-status.live-trains",
"method": "POST",
"path": "/apis/v1/amtrak-com/train-status/live-trains",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"examples": {
"provider": {
"summary": "Official provider example; checked against AIsa request constraints",
"value": {
"limit": 5
}
}
},
"schema": {
"additionalProperties": true,
"properties": {
"limit": {
"description": "Return at most this many trains (feed order). Default: all.\n\nProvider reference: minimum 1; maximum 500.",
"type": "number",
"x-alexandria-option-metadata": {
"in": "body",
"max": 500,
"min": 1
}
},
"route_name": {
"description": "Exact route name as the feed states it, e.g. 'Northeast Regional', 'Acela' (case-insensitive)",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
},
"state": {
"description": "Filter by feed state\n\nProvider reference: allowed values [\"Active\", \"Predeparture\", \"Completed\"].",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body",
"oneOf": [
"Active",
"Predeparture",
"Completed"
]
}
},
"train_number": {
"description": "Train number, e.g. 2151 Pattern: ^[0-9A-Za-z]{1,6}$.",
"type": "string",
"x-alexandria-option-metadata": {
"in": "body"
}
}
},
"type": "object"
}
}
},
"required": false
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
按实际用量收费。 默认请求预估费用:$0.0005 USD。 最终费用以实际用量为准。 账户适用价格可能不同;支持报价的接口可按实际请求获取报价。授权
请求体
响应
Live positions and status of every Amtrak train currently in the tracking feed (active, pre-departure and recently completed runs): coordinates, heading, speed, route, origin/destination and last event. Decrypts the public maps.amtrak.com feed the Track Your Train map uses. Optional filters by route name, train number or state; limit caps the list (the output then says it is partial).
The response contains the tool result directly.
The provider identifies trains as the primary payload key.
| Documented field | Provider type | Description |
|---|---|---|
aliases | string[] | |
cms_id | string | Route CMS id, joins RoutesList.json |
destination_code | string | |
heading | string | Compass heading, e.g. NW; null when blank |
id | number | Feed object id for this train run (unique per run) |
last_event_code | string | Station code of the last event; null when blank |
last_valid_at | string | Last GPS fix time as the feed states it; null when blank |
lat | number | |
lng | number | |
origin_code | string | |
origin_scheduled_departure | string | Local time at the origin, 'M/D/YYYY h:mm:ss AM/PM' as the feed states it |
origin_timezone | string | |
route_name | string | |
state | string | Active, Predeparture or Completed as stated by the feed |
status_message | string | Service message; null when blank |
train_number | string | |
updated_at | string | Feed record update time as the feed states it |
velocity_mph | number | Speed reported by the feed (mph); null when blank |
These are the provider's documented fields. Field requiredness, nullability and nested object structures are specified only where the descriptions explicitly say so.