SJ Train Tickets and Connections Scraper
Pricing
from $2.00 / 1,000 sj train connections
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 connections
Rating
0.0
(0)
Developer
Muhammad Afzal
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
6 days ago
Last modified
Categories
Security
Limited permissionsShare
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
| Field | Meaning |
|---|---|
connectionId | Stable hash for deduplicating the displayed connection |
origin, destination, travelDate | Requested route and Sweden-local travel date |
departureTime, arrivalTime | Local times displayed by SJ |
departureDateTime, arrivalDateTime | ISO 8601 timestamps with Sweden's current UTC offset |
durationMinutes, changes, direct | Journey duration and transfer count |
fromPriceSek, currency | Current one-adult from-price displayed by SJ, or null |
serviceSummary, services | Displayed train/operator summary and ordered segments |
trainNumbers | Train numbers visible in the journey card |
travelClasses | Classes shown as available, such as 2 class or 1 class |
amenities | Symbols such as bistro, wifi, level boarding, or wheelchair lift |
bookingUrl, sourceUrl, scrapedAt | Manual 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
| Field | Default | Notes |
|---|---|---|
origin | Stockholm Central | Full public SJ station name |
destination | Göteborg Central | Must differ from the origin |
travelDate | tomorrow | YYYY-MM-DD, interpreted in Europe/Stockholm |
travelTime | 08:00 | Earliest departure or latest arrival |
searchBy | departure | departure or arrival |
directOnly | false | Keep zero-change connections only |
requirePrice | false | Set true to exclude schedule cards whose price has not loaded |
maxResults | 5 | 1–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 loads SJ's public journey-selection page in a real browser and reads its accessible journey cards. It uses one coherent browser session, bounded retries, a 60-second navigation timeout, and a maximum of one journey-page request per run. The Actor connects directly because SJ currently 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.
requirePrice: true waits briefly for prices and excludes cards that still show a loading or unavailable price. Set it to false when schedules are more important than prices. 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 must match SJ's public URL routing. If a name is not recognized, use the exact suggestion shown by SJ's journey search, such as Stockholm Central, Göteborg Central, Malmö Central, Uppsala Central, or Oslo S.
FAQ
Why did my run return no connections?
Either SJ shows no trains for your filters (EMPTY, a successful run), or the page could not be read (BLOCKED or FAILED, a failed run). Failed runs save no records and charge no result events. On 2026-10-27 SJ removed the travel time from each card's accessible label; the Actor now reads it from the visible card text or computes it from the scheduled times.
Which station names work?
Use the exact names SJ suggests in its journey search, such as Stockholm Central, Göteborg Central or Malmö Central.
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:
| Event | Price (USD) | When it is charged |
|---|---|---|
train-connection | FREE: $0.005; BRONZE: $0.004; SILVER: $0.003; GOLD: $0.002; PLATINUM: $0.002; DIAMOND: $0.002 | SJ train connection — One validated SJ connection with schedule, changes, displayed price, classes, services, and amenities saved to the dataset. |
apify-actor-start | $0.005 | Actor 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-10-27