Open Rail Corpus · Version 1.0.0

API

A thin, read-only HTTP interface over the v1 corpus bundles.

Every object in the Open Rail Corpus is already a static file at a stable URL — a JSON bundle, a CSV, a schema. The API is a convenience layer over those files: it lets you filter, subset, and discover without downloading the whole bundle. It does not give you anything the static files do not already give you.

If you prefer files, they are at bundle.json, bundle.csv, and schema.json. You do not need this page.

Base URL and versioning

https://kerne.systems/corpus/transport/rail/v1/api.php

The path /corpus/transport/rail/v1/ is the version commitment. Any breaking change will be released as /v2/. Non-breaking additions arrive in place.

Endpoints

GET api.php

Discovery document. Returns the list of scenarios, their status, links to static bundles, and the full endpoint catalogue. Start here when you first meet the API.

curl https://kerne.systems/corpus/transport/rail/v1/api.php
GET api.php?scenario={id}

Returns the full bundle for a scenario. Equivalent to curl-ing {slug}/bundle.json directly. Scenarios are a, b, c.

curl https://kerne.systems/corpus/transport/rail/v1/api.php?scenario=a
GET api.php?scenario={id}&format=csv

Streams the bundle as CSV. Excel-safe UTF-8. Useful for spreadsheet users and for piping to awk, mlr, or jq -r equivalents.

curl "https://kerne.systems/corpus/transport/rail/v1/api.php?scenario=a&format=csv" > scenario-a.csv
GET api.php?scenario={id}&section={entity|regulatory|failure_modes|meta}

Extracts one sub-structure from the bundle. entity gives the asset record. regulatory gives the chapter anchors with bilingual section titles. failure_modes gives the list. meta gives a lightweight summary with title, version, catalog citations, counts.

curl "https://kerne.systems/corpus/transport/rail/v1/api.php?scenario=a&section=meta"
GET api.php?scenario=a&fm={FM-xxxxxxxxxxxx}

Fetches a single failure-mode record by its stable fm_uid. Returns 404 if not present in that scenario's bundle.

curl "https://kerne.systems/corpus/transport/rail/v1/api.php?scenario=a&fm=FM-a75edc98ea12"
GET api.php?scenario=a&chapter={1|2|3|4|5|6|7|10}

Filters Scenario A's failure modes by BAV chapter — Laufwerk (1), Federung (2), Bremse (3), Wagenuntergestell und Drehgestellrahmen (4), Zug- und Stosseinrichtungen (5), Wagenkasten (6), Ladungen und Ladeeinheiten (7), Verschiedene Fehler (10).

curl "https://kerne.systems/corpus/transport/rail/v1/api.php?scenario=a&chapter=3"
GET api.php?scenario=a&risk={Low|Medium|High|Critical}

Filters by the risk_index assigned during enrichment. May be combined with chapter — they AND together.

curl "https://kerne.systems/corpus/transport/rail/v1/api.php?scenario=a&chapter=3&risk=Critical"
GET api.php?health

Health indicator. Confirms each scenario bundle is readable on disk, returns file sizes and modification times. Suitable for uptime monitors.

curl https://kerne.systems/corpus/transport/rail/v1/api.php?health

Identifiers

Every object in the bundle carries two identifiers. The kerne.systems identifier is permanent — it does not change when hosting, versioning, or organisational structure changes. The resolver URL is where the object can currently be fetched; resolvers may migrate.

KindPattern
Entity (asset)kerne.systems/earth/entity/ASSET-{12hex}
Failure modekerne.systems/earth/fm/FM-{12hex}
Current resolver hostkerne.systems (canonical); openrxm.org (legacy)

Caching and civility

Responses are served with Cache-Control: public, max-age=300. CORS is open (Access-Control-Allow-Origin: *). There is no rate limit today; be courteous. If you want to walk the corpus at scale, pull the static bundle.json files directly and filter client-side rather than hammering api.php with thousands of requests.

Provenance and editions

The regulatory citation carries both the edition the failure modes were structured against (BAV-FK-V12-2021) and the currently in-force edition (BAV-FK-V18-2026). Neither claim supersedes the Swiss Federal Office of Transport's own publication at bav.admin.ch. When the two are in tension, trust the source.

The broader question of failure-mode identity across regulatory editions is tracked as WI-163 and scheduled for v1.1. Feedback welcome at the Rail SIG.

Not in this version