Trainline Railcards API Documentation List the UK railcards and discount cards with the name, the description, the carriers that accept them, the card number rules and whether the card runs out.
Run this endpoint
Endpoint
Response Schema
Example response fields are illustrative; inspect the JSON before integrating.
Example response fields
Scan these fields before integrating.
data
meta
success
{
"data": {
"cards": [
{
"code": "urn:trainline:atoc:card:G5O",
"name": "Club 50 Web - Greater Anglia",
"group": null,
"colour": null,
"carriers": [
"atoc"
],
"language": "en",
"operator": null,
"short_name": null,
"description": "Club 50 Web - Greater Anglia",
"business_only": false,
"number_pattern": null,
"is_loyalty_card": false,
"requires_number": false,
"has_expiration_date": false
},
{
"code": "urn:trainline:atoc:card:DCR",
"name": "Devon & Cornwall Railcard",
"group": null,
"colour": null,
"carriers": [
"atoc"
],
"language": "en",
"operator": null,
"short_name": null,
"description": "Devon & Cornwall Railcard",
"business_only": false,
"number_pattern": null,
"is_loyalty_card": false,
"requires_number": false,
"has_expiration_date": false
},
{
"code": "urn:trainline:atoc:card:FAM",
"name": "Family & Friends Railcard",
"group": null,
"colour": null,
"carriers": [
"atoc"
],
"language": "en",
"operator": null,
"short_name": null,
"description": "Family & Friends Railcard",
"business_only": false,
"number_pattern": null,
"is_loyalty_card": false,
"requires_number": false,
"has_expiration_date": false
},
{
"code": "urn:trainline:atoc:card:HRC",
"name": "Highland Railcard",
"group": null,
"colour": null,
"carriers": [
"atoc"
],
"language": "en",
"operator": null,
"short_name": null,
"description": "Highland Railcard",
"business_only": false,
"number_pattern": null,
"is_loyalty_card": false,
"requires_number": false,
"has_expiration_date": false
}
],
"card_count": 4
},
"meta": {
"billable": true,
"endpoint_family": "cards"
},
"success": true
}
Errors
Handle these documented responses before retrying or showing customer-facing failures.
Upstream Unavailable
Trainline did not answer in time. Scrappa retries on other exits first. This response is not billable. Retry after a few seconds.
{
"meta": {
"billable": false,
"retryable": true,
"endpoint_family": "cards"
},
"error": {
"code": "UPSTREAM_UNAVAILABLE",
"message": "The Trainline service is temporarily unavailable. Please retry."
},
"success": false
}Generate Code with AI
Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.
Try It Live
Test this endpoint in our interactive playground with real data.