# Trainline Price Prediction API Documentation

<p><strong>Trainline Price Prediction API Documentation</strong> Read how the advance fare of a journey changes as the date of travel comes closer. Each tier has the fare name, the price, the period in which it is sold and the tickets left when known. The selected tier is the one you can buy now. Standard and first class are listed on their own.</p>

- **Documentation:** [https://scrappa.co/docs/trainline-api/trainline_price_prediction](https://scrappa.co/docs/trainline-api/trainline_price_prediction)
- **API group:** Trainline API
- **Endpoint:** `GET https://scrappa.co/api/trainline/journeys/price-prediction`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `search_id` | string | Yes | search_id of a journey search answer. |
| `journey_id` | string | Yes | id of the outward journey. |
| `currency` | string | No | GBP or EUR. Use the same value as in the search. |

## Example response

```json
{
    "data": {
        "first": {
            "price_tiers": [
                {
                    "price": {
                        "amount": 125,
                        "currency": "GBP"
                    },
                    "selected": true,
                    "fare_name": "Advance Single (1st Class)",
                    "available_to": "2026-10-29T00:00:00+00:00",
                    "day_of_travel": false,
                    "available_from": "2026-10-20T00:00:00+00:00",
                    "tickets_remaining": null
                },
                {
                    "price": {
                        "amount": 135,
                        "currency": "GBP"
                    },
                    "selected": false,
                    "fare_name": "Advance Single (1st Class)",
                    "available_to": "2026-10-29T00:00:00+00:00",
                    "day_of_travel": false,
                    "available_from": "2026-10-29T00:00:00+00:00",
                    "tickets_remaining": null
                },
                {
                    "price": {
                        "amount": 231,
                        "currency": "GBP"
                    },
                    "selected": false,
                    "fare_name": "Advance Single (1st Class)",
                    "available_to": "2026-10-31T00:00:00+00:00",
                    "day_of_travel": false,
                    "available_from": "2026-10-29T00:00:00+00:00",
                    "tickets_remaining": null
                }
            ],
            "selected_alternative_id": "fc270a65-1f63-4bda-91dc-1d338c09751c"
        },
        "standard": {
            "price_tiers": [
                {
                    "price": {
                        "amount": 43.5,
                        "currency": "GBP"
                    },
                    "selected": true,
                    "fare_name": "Advance Single",
                    "available_to": "2026-10-27T00:00:00+00:00",
                    "day_of_travel": false,
                    "available_from": "2026-10-20T00:00:00+00:00",
                    "tickets_remaining": null
                },
                {
                    "price": {
                        "amount": 45.5,
                        "currency": "GBP"
                    },
                    "selected": false,
                    "fare_name": "Advance Single",
                    "available_to": "2026-10-27T00:00:00+00:00",
                    "day_of_travel": false,
                    "available_from": "2026-10-27T00:00:00+00:00",
                    "tickets_remaining": null
                },
                {
                    "price": {
                        "amount": 46,
                        "currency": "GBP"
                    },
                    "selected": false,
                    "fare_name": "Advance Single",
                    "available_to": "2026-10-27T00:00:00+00:00",
                    "day_of_travel": false,
                    "available_from": "2026-10-27T00:00:00+00:00",
                    "tickets_remaining": null
                }
            ],
            "selected_alternative_id": "6f3c35e3-7877-42a1-a1c9-72f338b722bc"
        },
        "search_id": "1ab6ab81-b316-4f2e-ba21-df3055a8e3cc",
        "journey_id": "785924f2-9819-4468-9ca7-eee4855546bd"
    },
    "meta": {
        "billable": true,
        "endpoint_family": "journeys_price_prediction"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | A required parameter is missing or invalid. This response is not billable. |
| 404 | Resource Not Found | The search id or the journey id is unknown or has expired. This response is not billable. |
| 503 | Upstream Unavailable | Trainline did not answer in time. Scrappa retries on other exits first. This response is not billable. Retry after a few seconds. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
