# Trainline station and city search API

Search Trainline stations and city groups by name and locale via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as output, q, raw, and retrieve structured data including source location reference, source short station code, source navigation slug, source location type, and source timezone for location picker, and navigation labels.

Documentation: https://openany.si/market/apis/trainline/trainline-station-and-city-search-api/?offering=6dc64d26-d486-4a37-9155-cf28f997507b
API ID: 6dc64d26-d486-4a37-9155-cf28f997507b
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/trainline/v1/locations
Page update time: 2026-12-03T02:46:56.626Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract. Price update time: not supplied.
Contract update time: 2026-12-03T02:46:55.340Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits consumed",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Trainline station and city search API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "description": "Station or city name (2+ characters)."
        },
        "locale": {
          "type": "string",
          "description": "Language of the names. Default `en-GB`.",
          "enum": [
            "en-GB",
            "en-US",
            "fr-FR",
            "de-DE",
            "it-IT",
            "es-ES",
            "nl-NL",
            "pt-PT",
            "pl-PL",
            "cs-CZ",
            "sv-SE",
            "da-DK"
          ]
        },
        "type": {
          "type": "string",
          "description": "Only one location type, e.g. `station` or `stationGroup`."
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. Omit output or use json; CSV and NDJSON are not supported.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      },
      "required": [
        "q"
      ]
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "locale": {
      "type": "string"
    },
    "locations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attributes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "code": {
            "type": "string"
          },
          "connections": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "country_code": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "score": {
            "type": "number"
          },
          "short_code": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "subtitle": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string"
              }
            ]
          },
          "time_zone": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      }
    },
    "q": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/trainline/v1/locations?output=json&q=manchester&raw=0' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "cached": false,
  "count": 17,
  "credits_used": 1,
  "fetched_at": "2026-11-19T12:25:30.813Z",
  "locale": "en-GB",
  "locations": [
    {
      "attributes": [
        "MainStation",
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:MAN2968gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Manchester Piccadilly",
      "score": 0.40811986,
      "short_code": "MAN",
      "slug": "manchester-piccadilly",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:point"
      ],
      "code": "urn:trainline:generic:loc:115gb",
      "connections": [
        "atoc",
        "distribusion",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Manchester",
      "score": 0.21027617,
      "short_code": "115",
      "slug": "manchester",
      "subtitle": "Any",
      "time_zone": "Europe/London",
      "type": "stationGroup"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:MCV2970gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Manchester Victoria",
      "score": 0.098572984,
      "short_code": "MCV",
      "slug": "manchester-victoria",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "Airport",
        "BusStation",
        "category:airport"
      ],
      "code": "urn:trainline:generic:loc:MIA2961gb",
      "connections": [
        "atoc",
        "distribusion",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Manchester Airport",
      "score": 0.079529606,
      "short_code": "MIA",
      "slug": "manchester-airport",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:MCO2966gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Manchester Oxford Road",
      "score": 0.067757465,
      "short_code": "MCO",
      "slug": "manchester-oxford-road",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:DGT2963gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Deansgate",
      "score": 0.018400094,
      "short_code": "DGT",
      "slug": "deansgate",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:BYM2549gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Burnley Manchester Road",
      "score": 0.011640855,
      "short_code": "BYM",
      "slug": "burnley-manchester-road",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:ECC2950gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Eccles (Manchester)",
      "score": 0.005212082,
      "short_code": "ECC",
      "slug": "eccles-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:MIH2920gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Mills Hill (Manchester)",
      "score": 0.004510977,
      "short_code": "MIH",
      "slug": "mills-hill-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:SNN2800gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Swinton (Manchester)",
      "score": 0.0033513077,
      "short_code": "SNN",
      "slug": "swinton-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:MSL2903gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Mossley (Manchester)",
      "score": 0.0031016893,
      "short_code": "MSL",
      "slug": "mossley-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:CAS2919gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Castleton (Manchester)",
      "score": 0.0020112034,
      "short_code": "CAS",
      "slug": "castleton-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:HAL2845gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Hale (Manchester)",
      "score": 0.0016560154,
      "short_code": "HAL",
      "slug": "hale-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:KSL2605gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Kearsley (Manchester)",
      "score": 0.0010937756,
      "short_code": "KSL",
      "slug": "kearsley-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:INC2236gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Ince (Manchester)",
      "score": 0.00065584667,
      "short_code": "INC",
      "slug": "ince-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:MCZ0451gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Manchester Central Zone",
      "score": 0.00017734477,
      "short_code": "MCZ",
      "slug": "manchester-central-zone",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    },
    {
      "attributes": [
        "BusStation",
        "category:train"
      ],
      "code": "urn:trainline:generic:loc:CLI2795gb",
      "connections": [
        "atoc",
        "nationalexpress"
      ],
      "country_code": "GB",
      "language": "en",
      "name": "Clifton (Manchester)",
      "score": 0.000055625846,
      "short_code": "CLI",
      "slug": "clifton-manchester",
      "subtitle": null,
      "time_zone": "Europe/London",
      "type": "station"
    }
  ],
  "q": "manchester"
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Available implementations
- apish: https://openany.si/market/apis/trainline/trainline-station-and-city-search-api/?offering=6dc64d26-d486-4a37-9155-cf28f997507b

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
