This folder exposes a small HTTP JSON API that reads tickets already bought on one RegioJet customer account.
There is no browser UI for the tickets themselves — only this documentation page and mcp.php.
The RegioJet calls and the ticket fields follow regiojet-mcp (list_my_tickets and get_my_ticket). Search, booking, payment, and cancellation from that package are not implemented here.
Every call to mcp.php must present API_KEY from .env. Send it as the X-Api-Key header, as Authorization: Bearer …, or as api_key inside the JSON body. Leave it out of the query string.
While API_KEY is empty, the API answers 503 and does not call RegioJet. A wrong key answers 401.
RegioJet login lives in the same .env: REGIOJET_ACCOUNT_CODE and REGIOJET_PASSWORD. Each call logs in with those two values and sends the returned token as Bearer for that request only. The token is what regiojet-mcp calls REGIOJET_API_KEY. It is not stored in .env. Login returns an opaque token and no expiry, so this API does not reuse one across requests. Responses never include the password or the token.
.env)API_KEY — secret that protects mcp.phpREGIOJET_ACCOUNT_CODE — customer account codeREGIOJET_PASSWORD — customer account passwordREGIOJET_BASE_URL — optional, default https://brn-ybus-pubapi.sa.cz/restapiREGIOJET_LANG — optional, default csREGIOJET_CURRENCY — optional, default CZKREGIOJET_TIMEOUT — optional seconds, default 20mcp.php (JSON API)Use POST with a JSON body. Every request must include "action".
GET is supported for the same two actions. Put the API key in a header on GET, because the query string is not accepted as a key.
This API only reads. list and get are the only actions.
list — active tickets on the account, newest first. Canceled, deleted, and already used tickets are left out. Optional:
states — VALID, UNPAID, or both. Omitted means both. A JSON array, or a comma-separated string on GET.limit — 1 to 100, default 20.offset — default 0.from and to — calendar dates YYYY-MM-DD, inclusive, compared to the first section’s departure date. The server walks later pages (up to 10 pages of 20) so a date window is not limited to the first page. truncated: true means that walk stopped early.{"action":"list","api_key":"YOUR_API_KEY"}
{"action":"list","states":["VALID"],"from":"2026-05-01","to":"2026-05-31"}
{"action":"list","limit":20,"offset":0}
get — one active ticket by its numeric id. A canceled, deleted, or used id answers 404.
{"action":"get","id":123456789}
Each ticket is a short record: id, ticket_code, state, seat_class, price, currency, unpaid, expiration_date, passenger tariffs, and sections (line, stations, times, platform, seats). The field names match the trimmed ticket from regiojet-mcp.
When the train is already on its way, each section gains the current lateness from the public station board. The API matches the train number and the scheduled time on departures at the boarding station, then on arrivals at the alighting station if the train has already left. delay_minutes is that lateness (0 means the board currently reports on time). delay is the same value as HH:MM h (00:40 h is 40 minutes). arrival_time stays the scheduled time, and estimated_arrival_time is the scheduled arrival plus delay_minutes. A delay already printed on the ticket is kept when the board has no match. A section with no delay is not currently reporting one — the train has not started, or it is no longer on the board. That is not the same as confirmed on time.
JSON includes "ok": true. Errors return HTTP 4xx/5xx with "ok": false and an error field.