SJ Train Tickets and Connections Scraper avatar

SJ Train Tickets and Connections Scraper

Pricing

from $2.00 / 1,000 sj train connection

Go to Apify Store
SJ Train Tickets and Connections Scraper

SJ Train Tickets and Connections Scraper

Scrape public SJ train connections, departure and arrival times, changes, live from-prices, travel classes, train services, numbers, and onboard amenities.

Pricing

from $2.00 / 1,000 sj train connection

Rating

0.0

(0)

Developer

Muhammad Afzal

Muhammad Afzal

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

11 days ago

Last modified

Features

Limited permissions

Share

Search public SJ journey pages and export train connections with departure and arrival times, durations, changes, live one-adult from-prices, travel classes, services, train numbers, and onboard amenities.

The Actor is read-only. It does not log in, reserve seats, hold fares, or buy tickets. Prices and availability can change after a run, so users should confirm them on SJ before travel or purchase.

What it extracts

FieldMeaning
connectionIdStable hash for deduplicating the displayed connection
origin, destination, travelDateRequested route and Sweden-local travel date
departureTime, arrivalTimeLocal times displayed by SJ
departureDateTime, arrivalDateTimeISO 8601 timestamps with Sweden's current UTC offset
durationMinutes, changes, directJourney duration and transfer count
fromPriceSek, currencyCurrent one-adult from-price displayed by SJ, or null
serviceSummary, servicesDisplayed train/operator summary and ordered segments
trainNumbersTrain numbers visible in the journey card
travelClassesClasses shown as available, such as 2 class or 1 class
amenitiesSymbols such as bistro, wifi, level boarding, or wheelchair lift
bookingUrl, sourceUrl, scrapedAtManual continuation link and provenance

When to use it

Use this Actor for fare monitoring, route comparison, travel research, schedule analysis, and feeding current SJ options into an automation or AI agent. It works with public stations represented in SJ's journey planner, including routes that contain services run by partner operators.

Do not use it to automate checkout, reserve inventory, guarantee a fare, collect account data, or represent SJ's full retail ticket conditions. The result is a journey-card snapshot for one adult, not a purchased ticket or binding offer.

Input

FieldDefaultNotes
originStockholm CentralSJ station name; close spellings are matched to SJ's name
destinationGöteborg CentralMust differ from the origin
travelDatetomorrowYYYY-MM-DD, interpreted in Europe/Stockholm
travelTime08:00Earliest departure, or latest arrival on travelDate
searchBydeparturedeparture or arrival
directOnlyfalseKeep zero-change connections only
requirePricefalseSet true to exclude schedule cards whose price has not loaded
maxResults51–20 dataset records and result charges

Evergreen input:

{
"origin": "Stockholm Central",
"destination": "Göteborg Central",
"travelTime": "08:00",
"searchBy": "departure",
"directOnly": false,
"requirePrice": false,
"maxResults": 5
}

Specific arrive-by search:

{
"origin": "Malmö Central",
"destination": "Stockholm Central",
"travelDate": "2026-10-15",
"travelTime": "18:00",
"searchBy": "arrival",
"maxResults": 10
}

Run through the Apify API:

curl -X POST "https://api.apify.com/v2/acts/USERNAME~sj-train-tickets-connections-scraper/runs?token=APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"origin":"Stockholm Central","destination":"Göteborg Central","maxResults":5}'

For production automation, send the token in an Authorization header rather than a URL.

Output example

{
"connectionId": "da32fbb2e75481ec9c2a",
"origin": "Stockholm Central",
"destination": "Göteborg Central",
"travelDate": "2026-10-15",
"departureTime": "08:17",
"arrivalTime": "11:47",
"departureDateTime": "2026-10-15T08:17:00+02:00",
"arrivalDateTime": "2026-10-15T11:47:00+02:00",
"durationMinutes": 210,
"changes": 0,
"direct": true,
"fromPriceSek": 445,
"currency": "SEK",
"serviceSummary": "SJ High-speed train, X 2000, train 425",
"services": ["SJ High-speed train, X 2000, train 425"],
"trainNumbers": ["425"],
"travelClasses": ["2 class", "2 class Calm", "1 class"],
"amenities": ["bistro", "wheelchair lift", "wifi"],
"bookingUrl": "https://www.sj.se/en/search-journey/choose-journey/Stockholm%20Central/G%C3%B6teborg%20Central/2026-10-15",
"sourceUrl": "https://www.sj.se/en/search-journey/choose-journey/Stockholm%20Central/G%C3%B6teborg%20Central/2026-10-15",
"scrapedAt": "2026-09-10T03:30:00.000Z"
}

The default dataset contains only connection records. OUTPUT in the default key-value store reports DATA, EMPTY, BLOCKED, REJECTED, or FAILED, along with delivered records, charged events, route, source URL, and warnings.

Reliability and limitations

The Actor opens SJ's public journey-selection page in a lightweight browser and reads the departure list and from-prices that the page itself loads, so every delivered connection gets its price, not only the ones that would be on screen. If that page read fails, it retries once and then uses a full browser. A run loads one journey page (two when a station name needed SJ's exact spelling) and connects directly, because SJ serves the public journey page to Apify Cloud. If SJ returns 403 or 429, the run ends as failed with BLOCKED in OUTPUT and no result charges.

searchBy: "arrival" returns journeys that arrive at or before travelTime on travelDate, latest arrival first. Journeys that arrive after midnight never count as arriving by an earlier time, and overnight journeys that leave on the day before are not included. Night trains are included, with seat, couchette and sleeping-compartment classes when SJ offers them.

requirePrice: true keeps only connections with a from-price; journeys SJ marks as unavailable have fromPriceSek: null. An empty filtered search returns zero dataset records plus a truthful OUTPUT summary; the Actor never fabricates fallback connections. Invalid route combinations and dates are rejected before billable result work.

Station names are matched to SJ's own station list. Exact names such as Stockholm Central, Göteborg Central, Malmö Central, Uppsala Central, or Oslo S are used as given; other spellings and SJ's alternative names (for example stockholm central, Goteborg C or Copenhagen Central) are matched to SJ's name, which then appears in the records and in OUTPUT. An unknown name ends the run as REJECTED within seconds, with up to five suggested SJ station names and no result charges.

FAQ

Why did my run return no connections?

Either SJ lists no journeys that match your filters (EMPTY, a successful run), a station name is unknown (REJECTED, with suggestions), or the page could not be read (BLOCKED or FAILED, a failed run). Rejected and failed runs save no records and charge no result events.

Which station names work?

Any station in SJ's journey planner, such as Stockholm Central, Göteborg Central, Malmö Central or Köpenhamn H. Close spellings and SJ's alternative names are matched automatically; an unknown name is rejected with suggestions.

Can I book tickets with it?

No. It only reads the public journey list; it never signs in, books or pays.

Responsible use

Use the data in accordance with SJ's terms, applicable transport-data rules, and privacy law. Keep request volume modest, cache results when appropriate, and do not use the Actor to interfere with purchasing, access controls, or service availability. This independent Actor is not affiliated with or endorsed by SJ AB.

For a suspected parser or source-page change, include the run ID, redacted input, and expected route in a support report. Do not send account credentials or payment information.

Pricing

This Actor uses pay-per-event pricing. These are the current Apify Store event prices:

EventPrice (USD)When it is charged
train-connectionFREE: $0.005; BRONZE: $0.004; SILVER: $0.003; GOLD: $0.002; PLATINUM: $0.002; DIAMOND: $0.002SJ train connection — One validated SJ connection with schedule, changes, displayed price, classes, services, and amenities saved to the dataset.
apify-actor-start$0.005Actor Start — Charged when the Actor starts running. Number of events charged depends on Actor memory (one event per GB, minimum one event; the default 1024 MB is one event). — Charged once per run.

On the Free plan a five-result run costs at most $0.03 in events ($0.005 + 5 × $0.005) and a one-result run $0.01. Delivered and charged counts are recorded separately in OUTPUT.

Apify platform usage for this Actor run is included alongside the event prices above; no separate per-run platform-usage fee is passed to users.

This covers Apify platform usage for this Actor run. Other Apify products or usage outside this Actor run may still follow your account plan.

Last verified: 2026-11-20