Comprehensive API Documentation for the Diana API

This document provides all the details necessary for a developer to integrate the Diana API into applications. It includes endpoints for travel connections, address autocomplete, and journey sharing functionality.

PDF available under: Diana_API_Docs.pdf Markdown version available under: Diana_API_Docs.md OpenAPI 3.0 schema available under: openapi.yaml (generated from this document; import it into Swagger UI, Postman or a client generator)


Table of Contents

  1. Overview
  2. Quota System
  3. Endpoint Details
  4. Request Parameters
  5. Guide: Using Activity Time Parameters
  6. Loading Earlier / Later Connections (Scrolling)
  7. Bundled Mode: Replaying a Shared Journey
  8. Understanding the Response
  9. Errors and Codes
  10. Example Usage
  11. Troubleshooting & Edge Cases

Overview

The Diana API provides:

  1. Detailed, real-time travel information to and from specified activities (/connections).
  2. Simple A-to-B route planning (/journey).
  3. Address autocomplete functionality for location searches (/address-autocomplete).
  4. Reverse geocoding capabilities (/reverse-geocode).
  5. Customer quota and add-on status (/quota).
  6. On-demand ticketshop link generation for specific journeys (/generate-ticketshop-link).
  7. The ability to create and retrieve shareable journey links (/share/...).

All timestamps sent to or received from the API are in UTC. Activity time parameters (activity_earliest_start_time, etc.) must be sent as UTC — the widget converts the activity's local times to UTC using the timezone parameter before sending. API usage may be subject to a monthly and/or yearly quota depending on the customer's plan.


Quota System

Searches on /connections, /journey and the MCP tool get_connections count towards the request quota agreed with your account. A search counts when it was answered: with connections, or with "no connections found". Rejected requests (invalid input, quota exceeded, not authorised) and server errors do not count. Months and years are calendar periods in Europe/Vienna time; usage figures are updated about once a minute.

Depending on your agreement, reaching the limit either rejects further searches (codes below), or searches keep being served and the additional ones are billed.

A search whose answer contains Austrian realtime data (Realtime Addon) counts as a realtime search instead of a normal one.

Quota Types

Type Field Description
Monthly quota monthly_quota Maximum requests allowed per calendar month. Always enforced.
Yearly quota yearly_quota Maximum requests allowed per calendar year. null = no yearly cap.
Soft quota soft_quota_overstep Extra requests permitted beyond each hard limit before rejection. 0 = disabled.

Evaluation Order and Revenue Safety

When a request arrives the system evaluates the limits in this fixed order:

  1. Monthly check – if requests_this_month >= monthly_quota + soft_quota_overstep → reject with code 6001.
  2. Yearly check (only when yearly_quota is set) – if requests_this_year >= yearly_quota + soft_quota_overstep → reject with code 6002.

These checks reject only for accounts that are blocked at the limit. Accounts with overage billing may have an agreed monthly hard cap instead; reaching it rejects with code 6001.

The monthly limit is always checked first. Even if the yearly quota has not been reached, a monthly-ceiling breach immediately stops the request. This guarantees that peak-month revenue risk is bounded regardless of the yearly setting.

The soft-quota overstep (soft_quota_overstep) is applied independently to both the monthly and the yearly hard limit. For example, with monthly_quota = 100, yearly_quota = 1000, and soft_quota_overstep = 50:

Limit Hard quota Soft ceiling Rejection code
Monthly 100 150 6001
Yearly 1000 1050 6002

Warning Emails

When quota_warning_enabled is set to true for a customer an email is automatically dispatched to the team (and, if configured, to the customer) once per period (month/year) the first time their usage reaches the respective hard quota. The email is sent regardless of whether a soft quota is configured.


Endpoint Details

Connections

HTTP Method: GET

URL: /connections

Authentication:

Calculates optimal travel journeys to and from a dynamically defined activity. The activity's details (locations, times, duration) are passed directly as request parameters. Implements fallback logic to find the latest possible return journey if the initially calculated timeline yields no results. All time parameters must be sent in UTC.

Note on time parameters: Highly flexible — see the Guide: Using Activity Time Parameters section.

Note on scrolling: The initial response returns a scored batch centred around the activity window. Use the optional to_connections_before / to_connections_after / from_connections_before / from_connections_after parameters to fetch earlier or later batches without reloading everything. See Loading Earlier / Later Connections (Scrolling).

Note on bundled mode: Instead of the parameters above you may pass a single share_id, and the endpoint reads everything it needs from that shared journey — no separate /share/<hash_key>/ call required. See Bundled Mode: Replaying a Shared Journey.

Quota

Requests count towards your monthly (and optionally yearly) request quota (see Quota System).

Realtime requests are automatically made, when possible, and if the user has a Realtime Addon.

For more information see Diana GreenConnect Info Page

Journey

HTTP Method: GET

URL: /journey

Authentication:

Calculates simple A-to-B public transport connections. This endpoint is designed for straightforward routing from a starting point to a destination at a specific time.

Quota

This endpoint shares the same monthly (and optional yearly) quota as the /connections endpoint. Each request counts as 1 towards both quota counters.

Address Autocomplete

HTTP Method: GET

URL: /address-autocomplete

Authentication:

Reverse geocoding

HTTP Method: GET

URL: /reverse-geocode

Authentication:

Quota Check

HTTP Method: GET

URL: /quota

Authentication:

Provides an endpoint for customers to check their current quota usage and active plan details.

HTTP Method: POST

Authentication:

Generates ticketshop deeplinks for a single, specific connection on-demand. The client sends the connection_elements array of the desired journey, and the API returns the corresponding ticketshop URL(s) if available.

Supported Ticketshop Providers

The API automatically selects the appropriate ticketshop provider based on the connection's origin country:

Provider Countries Covered Supports All Transport Types?
OEBB Austria ✅ Yes (trains, buses, etc.)
SBB Switzerland ✅ Yes (trains, buses, etc.)
TRAIVELLING All other European countries (Germany, France, Italy, Spain, Netherlands, Belgium, Czech Republic, Poland, etc.) ❌ No (trains only, no buses)

Important: Because Traivelling does not support bus routes, connections with bus legs may be split into multiple ticket segments. However, transfers (walk/transfer legs) do NOT break segment continuity - multiple train legs separated only by transfers are booked as a single ticket. For example:

The response includes a connection_ticketshop_segments array that clearly indicates which legs are covered by which provider. See Ticketshop Segment for details.

Share Journey

HTTP Method: POST

URL: /share/

Authentication:

Creates a unique, shareable link for a specified journey by saving its data. Returns a unique hash ID.

Retrieve Shared Journey

HTTP Method: GET

URL: /share/<uuid:hash_key>/

Authentication:

Retrieves the data for a previously shared journey using its unique hash key.


Request Parameters

Connections Parameters

The activity is defined directly via query parameters.

Parameter Type Required Default Description
id integer No -1 Activity ID. Defaults to -1, indicating a dynamically defined activity via the parameters below.
user_start_location string Yes - The user's starting location. Can be an address, station name, or coordinates (format: lat,lon).
date string No Current date (UTC) The travel date in YYYY-MM-DD format (interpreted as UTC).
user_start_location_type string No address Specifies the type of user_start_location. Values: address, station, coordinates, coord, coords.
user_start_location_display_name string No null Human-readable display name for the user's starting location, as selected from autocomplete (e.g. "Wien Hauptbahnhof, Wien"). Used to detect and remove the spurious walk that the routing engine inserts from the user's coordinate to the nearest platform node. When provided, the walk is removed if it is ≤10 min, <200 m, and the platform name roughly matches this value. Without it, removal falls back to a conservative ≤5 min distance-only check. Strongly recommended when user_start_location_type is coordinates.
activity_name string Yes - A name for the activity.
activity_start_location string Yes - The starting location of the activity. Can be an address, station name, or coordinates.
activity_start_location_type string No address Specifies the type of activity_start_location. Values: address, station, coordinates, coord, coords.
activity_end_location string Yes - The ending location of the activity. Can be an address, station name, or coordinates.
activity_end_location_type string No address Specifies the type of activity_end_location. Values: address, station, coordinates, coord, coords.
activity_earliest_start_time time Yes - The earliest start time of the activity in HH:MM:SS format (UTC).
activity_latest_start_time time Yes - The latest start time of the activity in HH:MM or HH:MM:SS format (UTC).
activity_earliest_end_time time Yes - The earliest end time of the activity in HH:MM or HH:MM:SS format (UTC).
activity_latest_end_time time Yes - The latest end time of the activity in HH:MM:SS format (UTC).
activity_duration_minutes integer Yes - The duration of the activity in minutes.
activity_duration_days integer No 1 The duration of the activity in days. Minimum value is 1.
activity_start_location_display_name string No null Custom display name for the activity start location. If omitted, the backend resolves a name via geocoding.
activity_end_location_display_name string No null Custom display name for the activity end location. If omitted, the backend resolves a name via geocoding.
activity_start_time_label string No null Custom label for the activity start time displayed in results (e.g. "Check-in").
activity_end_time_label string No null Custom label for the activity end time displayed in results (e.g. "Check-out").
timezone string No Europe/Vienna IANA timezone identifier for the activity (e.g. "Europe/Vienna", "America/New_York"). Used to interpret activity times on the client side and is echoed back in the response. Invalid values silently fall back to "Europe/Vienna".
to_connections_before datetime No null Scroll: return to-connections with connection_start_timestamp before this UTC datetime. Used to load earlier departures. Mutually exclusive with to_connections_after. ISO 8601 UTC (e.g. 2026-05-10T06:30:00Z).
to_connections_after datetime No null Scroll: return to-connections with connection_start_timestamp after this UTC datetime. Used to load later departures. Mutually exclusive with to_connections_before.
from_connections_before datetime No null Scroll: return from-connections with connection_start_timestamp before this UTC datetime. Mutually exclusive with from_connections_after.
from_connections_after datetime No null Scroll: return from-connections with connection_start_timestamp after this UTC datetime. Mutually exclusive with from_connections_before.
use_flex boolean No false Whether to allow FLEX (on-demand / flexible) transit services for first- and last-mile legs. When true, it may route via FLEX services (e.g. Rufbus, on-demand shuttles) to reach or leave the nearest fixed-schedule stop, and a direct FLEX ride from origin to destination is offered as an ordinary connection when one lies within the service's pickup/drop-off window. When false (default), only walking is used for first- and last-mile legs and FLEX services are excluded entirely.
include_past boolean No false Whether to keep connections that have already departed. When false (default), connections departing before the current time are dropped in both directions. When true, the whole day is searchable: past connections are returned, and the scroll parameters reach back to midnight of the activity date. The recommended connection is the best-scored one that has not departed yet; only when every connection in the batch has departed is the best departed one recommended. Clients should mark departed connections themselves by comparing connection_start_timestamp with the current time. Intended for searches for today; for later dates it has no effect. See Searching Today, Including Departed Connections.
lang string No null Preferred language for user-facing texts from the routing provider, as a BCP-47 tag (e.g. de, en, it; case-insensitive, _ is accepted for -). Service alerts and booking information are returned in this language when the feed provides a translation, otherwise in the feed's default language. When replaying a share (share_id), the lang of the current request is used.
share_id uuid No null Bundled mode. The shareId of a previously created shared journey. When present, every parameter above is filled in from the stored share, so none of the otherwise-required parameters need to be sent. See Bundled Mode: Replaying a Shared Journey.

Note on timezones: activity_*_start_time and activity_*_end_time must be sent as UTC. Clients using the widget convert the activity's local times to UTC using the timezone parameter before sending.

Note on scroll parameters: These are for pagination only — all standard activity parameters must still be included in every scroll request. See Loading Earlier / Later Connections (Scrolling).

Journey Parameters

Parameter Type Required Default Description
from_location string Yes - The starting location. Can be an address, station name, or coordinates (format: lat,lon).
from_location_type string No address Specifies the type of from_location. Values: address, station, coordinates, coord, coords.
to_location string Yes - The destination location. Can be an address, station name, or coordinates.
to_location_type string No address Specifies the type of to_location. Values: address, station, coordinates, coord, coords.
date string No Current date The travel date in YYYY-MM-DD format (interpreted as UTC). Defaults to today.
time time No Current time The travel time in HH:MM or HH:MM:SS format (UTC). Defaults to now.
is_arrival boolean No false If true, the time parameter specifies the desired arrival time. If false (default), it specifies the departure time.
use_flex boolean No false Whether to allow FLEX (on-demand / flexible) transit services for first- and last-mile legs. When true, it may route via FLEX services (e.g. Rufbus, on-demand shuttles) to reach or leave the nearest fixed-schedule stop, and a direct FLEX ride from origin to destination is offered as an ordinary connection when one lies within the service's pickup/drop-off window. When false (default), only walking is used for first- and last-mile legs and FLEX services are excluded entirely.
lang string No null Preferred language for alert and booking texts (BCP-47, e.g. de, en). See /connections.

Address Autocomplete Parameters

Parameter Type Required Description
q string Yes Search query for address autocomplete (e.g., "Wien Step")
limit integer No Maximum number of results to return (default: 5)
hint_lat float No Latitude hint for location bias
hint_lon float No Longitude hint for location bias
lang string No Language preference for results (en, de, fr). Defaults to default.
global_search boolean No If true, performs a global search without location bias.

Reverse Geocoding Parameters

Parameter Type Required Description
lat float Yes Latitude of the location to reverse geocode
lon float Yes Longitude of the location to reverse geocode
Parameter Type Required Description
connection_elements array Yes An array of Connection Element objects, exactly as received from the /connections or /journey endpoint for a journey.
segment_index integer No (Optional) Index into connection_ticketshop_segments (0-based). If provided, generates a link only for the specified segment. If omitted, generates links for all segments with a provider (see response format below). Use this when you need a specific ticket for a leg range.

Share Journey Parameters (Request Body)

Parameter Type Required Description
origin string Yes The starting location name for the shared journey (the raw text the user typed).
origin_display_name string No The human-readable display name for the user's start location, as selected from autocomplete (e.g. "Wien Hauptbahnhof, Wien"). Stored alongside the share data and returned on retrieval.
origin_lat float No The latitude of the origin.
origin_lon float No The longitude of the origin.
date date Yes The start date of the journey (YYYY-MM-DD).
dateEnd date No The end date of the journey (YYYY-MM-DD), if it spans multiple days.
to_connection_start_time datetime No The full start timestamp of the journey to the activity (ISO 8601).
to_connection_end_time datetime No The full end timestamp of the journey to the activity (ISO 8601).
from_connection_start_time datetime No The full start timestamp of the journey from the activity (ISO 8601).
from_connection_end_time datetime No The full end timestamp of the journey from the activity (ISO 8601).
shareURLPrefix url No The base URL of the client application where the share was initiated.
activity object No The full activity object from the /connections response. Stored and returned with the shared journey so recipients see the same activity context as the original viewer. Required if you intend to replay the share via /connections?share_id=... — see Bundled Mode.
payload object No Client-defined metadata. Any JSON object you like — a booking reference, a tenant id, an internal tour id, UI state. Stored and returned verbatim; DianaProxy never inspects or interprets it. See the limits and the security note below.
use_flex boolean No Whether to allow FLEX (on-demand / flexible) transit modes for first- and last-mile legs. Defaults to false when omitted. Saved with the share and automatically applied when the share is replayed via /connections?share_id=....

The payload field

payload lets you attach your own data to a share instead of keeping a side table keyed by share hash. It is returned unchanged by GET /share/<hash_key>/ and in the shared_journey block of a bundled /connections request.

⚠️ payload is not confidential. It is stored unencrypted and is returned to anyone who presents the share hash with a valid token — exactly like every other field on a share. Do not put access tokens, credentials, personal data, or anything else you would not put in a shareable URL into it.

The value must be a JSON object (not an array, string, or number), or null. These limits are enforced and a violation returns 400:

Limit Default
Total serialized size 16 KiB
Nesting depth 8
Total number of keys 200
Key length 128 characters
String value length 4096 characters
NUL (U+0000) in any key or string value Not permitted

Shares created without a payload return "payload": null.

Retrieve Shared Journey Parameters (URL)

Parameter Type Required Description
hash_key uuid Yes The unique UUID identifying the shared journey.

Guide: Using Activity Time Parameters

To help you find the perfect journey, our API asks for four key time parameters for your activity.

Think of these not as exact times, but as the flexible windows you are available. This guide will show you how to set them and how our API uses them to find the best recommended journey for you.

The four parameters are:

1. The "To Activity" Journey (Your Arrival Window)

This journey is defined by earliest_start_time and latest_start_time.

How We Find Your "Best" Arrival

Our API searches for all connections that arrive within your window. The "best" (recommended) connection is not the one that arrives at the last possible second.

Instead, we find a "sweet spot" that gives you a comfortable buffer without making you wait too long. We generally aim for a time about one-third of the way into your arrival window, but later options are also considered.

Example:

The API will recommend the journey that arrives closest to 09:20.

Visualization: Your Arrival Window

          [ YOUR ARRIVAL WINDOW ]
|---------------------------------------------|
|                                             |
09:00                                       10:00
(earliest_start_time)                     (latest_start_time)
      |
      |
    09:20
  (Our "Sweet Spot"
  Target for the
  best recommendation)

2. The "From Activity" Journey (Your Departure Window)

This journey is defined by earliest_end_time and latest_end_time and is linked to your arrival.

How We Find Your "Best" Departure (The Smart Part)

This is where our API's logic really helps. The "best" departure time isn't just a random time in your window; it depends on your recommended arrival time and your activity's duration.

Our API automatically calculates your actual finish time from the recommended arrival and finds the best departure to match.

Example:

Calculation:

  1. Actual Finish Time: 09:20 (Arrival) + 3 hours (Duration) = 12:20
  2. Compare to Earliest End: Your actual finish time of 12:20 is after your earliest_end_time of 12:00, so it's valid.
  3. Find Departure: The API will now search for the best departure connection starting at or around 12:20.

This creates a seamless itinerary where your departure journey is perfectly timed to your arrival.

Visualization: Your Connected Itinerary

|------------------[ ARRIVAL ]------------------|-----------------|-----------------[ DEPARTURE WINDOW ]-----------------|
09:00             09:20                       10:00               12:00                                                14:00
(Earliest Start)  (Recommended                                (Earliest End)                                        (Latest End)
                   Arrival)
                      |
                      +------------- 3 Hour Activity Duration -------------+
                                                                           |
                                                                         12:20
                                                                       (Calculated
                                                                        Departure Time)

Because your calculated departure of 12:20 is inside your [12:00 - 14:00] window, the API will find the best connection leaving around 12:20.

3. Smart Fallback: What If No Return Journey is Found?

What happens if your activity runs so late that no return journeys are available based on your "actual finish time"?

Our API has a smart fallback plan.

  1. Find Last Chance: The API will re-scan your "From Activity" window and find the absolute latest departure connection available before your latest_end_time.
  2. Work Backwards: It will then take that journey's departure time (e.g., 16:30) and subtract your activity duration (e.g., 3 hours). This gives a new mandatory arrival time (e.g., 13:30).
  3. Re-Filter Arrival: The API will re-filter your "To Activity" connections. It will now only show you arrivals that get you to the activity before 13:30, ensuring you can make that last train home.

This ensures that if a valid round-trip is at all possible within your windows, our API will find it.


Loading Earlier / Later Connections (Scrolling)

The initial /connections response returns a scored and filtered batch of journeys centred around the activity's time window. Because the routing engine searches a fixed window per call, there are always more valid connections earlier and later that were not included. The four optional scroll parameters let you fetch additional batches on demand — for example, when the user taps "Show earlier connections" or "Show later connections" — without reloading the full response.

The has_more_* Flags

Every /connections response (including the initial load) includes four booleans in the connections object that tell you whether more connections exist outside the current batch:

Field When true When false When null
has_more_before_to_activity Earlier to-connections exist → show "Load earlier" button Batch already starts at the window boundary Not determinable this request — keep the last known value (direction skipped, or scroll-after returned empty)
has_more_after_to_activity Later to-connections exist → show "Load later" button Batch already ends at the window boundary Not determinable this request — keep the last known value (direction skipped, or scroll-before returned empty)
has_more_before_from_activity Earlier from-connections exist → show "Load earlier" button Batch starts at the window boundary Not determinable this request — keep the last known value (direction skipped, or scroll-after returned empty)
has_more_after_from_activity Later from-connections exist → show "Load later" button Batch ends at the window boundary Not determinable this request — keep the last known value (direction skipped, or scroll-before returned empty)

null is the signal to preserve the flag value from your previous response — it always means "we did not search this side in this request, so we cannot say whether connections exist there."

Use these flags to show or hide your scroll buttons after every response.

Scroll Parameters

Send exactly one scroll anchor per request, for one direction. The anchor is the connection_start_timestamp of the boundary connection in the current displayed list.

Scenario Parameter to add Value
Load earlier to-connections to_connections_before connection_start_timestamp of the first item in the current to_activity list
Load later to-connections to_connections_after connection_start_timestamp of the last item in the current to_activity list
Load earlier from-connections from_connections_before connection_start_timestamp of the first item in the current from_activity list
Load later from-connections from_connections_after connection_start_timestamp of the last item in the current from_activity list

All scroll parameters are ISO 8601 UTC datetimes (e.g. 2026-05-10T06:30:00Z).

Constraint (within a direction): to_connections_before and to_connections_after are mutually exclusive — sending both returns HTTP 400. Same rule applies to the from_connections_* pair.

Constraint (across directions): scrolling works on one direction at a time. Do not send a to_connections_* parameter and a from_connections_* parameter in the same request — the API does not scroll both directions. Such a request is treated as an ordinary initial load and both scroll anchors are silently ignored: you get the default batch for both directions with no error, which is almost certainly not what you intended. To scroll both lists, issue two separate requests.

Direction Skipping

When only one direction's scroll param is provided, the API does not call the routing provider for the other direction at all. The response will therefore have:

This is intentional and efficient. Your client should keep the connections it already has from the previous response and only append / replace the new batch for the scrolled direction.

Searching Today, Including Departed Connections

By default, /connections only returns connections that have not departed yet. A search for today whose activity window is already over therefore fails (typically with code 2024 or 2022-1), and "Load earlier" stops at the current time.

Send include_past=true to browse the whole day instead:

Without include_past, a scroll-after request whose anchor lies in the past starts its search at the current time, so it returns the next upcoming connections instead of an empty batch.

Realtime: realtime data for trips that ran earlier in the day is often no longer available from the feeds. Departed connections then carry scheduled times with realtime: false.

Absolute Time Windows

Scroll requests are not restricted by the activity time window (activity_earliest_start_time, activity_latest_start_time, etc.). The only bounds enforced during scrolling are:

This lets users scroll all the way to the first or last connection of the day, even if it falls far outside the original activity time window. On initial load (no scroll params), the standard activity-window filtering still applies.

The has_more_* flags are computed against these day-wide bounds during scrolling: has_more_before = false when the earliest arrival/departure in the batch is at or before midnight, and has_more_after = false when the latest is at or after the following midnight. In practice both flags are true for any non-empty batch mid-day; you will reach false only when the batch includes the very first or last service of the day.

Note that an empty scroll result sets the flag for the searched direction to false and the opposite direction to null (unknown — do not overwrite).

End-to-End Example

Step 1 — Initial load (no scroll params):

GET /connections?user_start_location=Wien+Meidling&...&activity_latest_start_time=14:00&...
Authorization: Bearer <token>

Response excerpt:

{
  "connections": {
    "to_activity": [
      { "connection_id": 1, "connection_start_timestamp": "2026-05-10T06:40:00Z", ... },
      { "connection_id": 2, "connection_start_timestamp": "2026-05-10T07:10:00Z", ... },
      { "connection_id": 3, "connection_start_timestamp": "2026-05-10T07:55:00Z", ... }
    ],
    "recommended_to_activity_connection": 2,
    "has_more_before_to_activity": true,
    "has_more_after_to_activity": false,
    "from_activity": [ ... ],
    "recommended_from_activity_connection": 5,
    "has_more_before_from_activity": false,
    "has_more_after_from_activity": true
  }
}

UI state: show "Load earlier" for to-connections (before 06:40), hide "Load later"; show "Load later" for from-connections, hide "Load earlier".

Step 2 — User taps "Load earlier to-connections"

Send the anchor as the departure of the first item in the current list (06:40):

GET /connections?user_start_location=Wien+Meidling&...&to_connections_before=2026-05-10T06:40:00Z
Authorization: Bearer <token>

Response excerpt:

{
  "connections": {
    "to_activity": [
      { "connection_id": 10, "connection_start_timestamp": "2026-05-10T05:55:00Z", ... },
      { "connection_id": 11, "connection_start_timestamp": "2026-05-10T06:25:00Z", ... }
    ],
    "recommended_to_activity_connection": 10,
    "has_more_before_to_activity": false,
    "has_more_after_to_activity": true,
    "from_activity": [],
    "recommended_from_activity_connection": null,
    "has_more_before_from_activity": null,
    "has_more_after_from_activity": null
  }
}

Bundled Mode: Replaying a Shared Journey

Opening a shared link normally takes two requests: fetch the share, then rebuild roughly twenty /connections query parameters from what it contains. Bundled mode collapses that into one.

GET /connections?share_id=a1b2c3d4-e5f6-7890-1234-567890abcdef
Authorization: Bearer <token>

That is the entire request. Every parameter is filled in from the stored share, the connections are calculated, and the response is a normal /connections body plus a shared_journey block describing the share itself.

What the share supplies

/connections parameter Taken from the share
user_start_location, user_start_location_type origin_lat / origin_lon when both are present (as coordinates), otherwise origin (as an address)
user_start_location_display_name origin_display_name, falling back to origin
date activity.date, falling back to the share's date
activity_name, activity_*_location, activity_*_location_type, activity_*_location_display_name the corresponding activity.* fields
activity_earliest_start_time, activity_latest_start_time, activity_earliest_end_time, activity_latest_end_time the time-of-day of the corresponding activity.* timestamps
activity_duration_minutes, activity_duration_days activity.duration_minutes, activity.duration_days (null is treated as 1)
activity_start_time_label, activity_end_time_label, timezone the corresponding activity.* fields

The share must therefore have been created with an activity object. Shares created before that field existed return 400 with code 5004; keep using the two-call flow for those.

Overriding stored values

Any parameter you send alongside share_id wins over the stored share. Two things this enables:

The shared_journey block

Present only when share_id was used. It contains everything GET /share/<hash_key>/ returns — including your payload — plus four fields locating the shared connections within the lists above:

Field Meaning
to_connection_id connection_id of the shared outbound connection in connections.to_activity, or null
to_connection_found true if it is in the response, false if it could not be recovered, null if the share never named an outbound connection
from_connection_id as above, for connections.from_activity
from_connection_found as above

When a shared connection is found, recommended_to_activity_connection / recommended_from_activity_connection are repointed at it, so rendering the recommendation highlights the connection that was actually shared. (Ordinary /connections requests are unaffected and keep the score-based recommendation.)

Connections that were found by scrolling

If the user scrolled past the activity time window to find a connection and then shared it, that connection is not in a default /connections result. Bundled mode detects this and automatically fetches it back, in both directions if needed, within the same request. The recovered connection is added to the normal result — the lists remain a superset of what a plain request returns, so the recipient still sees the surrounding alternatives.

Matching tolerates up to two minutes of drift, so a departure that has shifted slightly since the share was created is still recognised.

When recovery is not possible the request still returns 200. The most common cause is a connection that has already departed: /connections never returns connections departing in the past, so no amount of searching brings it back. You get:

"shared_journey": {
    "to_connection_start_time": "2026-08-07T08:30:00Z",
    "to_connection_id": null,
    "to_connection_found": false,
    "from_connection_id": 12,
    "from_connection_found": true
}

Render this as "the shared departure is no longer available" and offer the rest of the list, which is a normal, usable set of connections.

Quota

A bundled request counts exactly like the equivalent /connections request: 1 against the quota, or 0.5 if you also pass scroll parameters. The internal fetches used to recover a shared connection are not counted separately.


Understanding the Response

Connections Response

Root Object

The response is a JSON object containing the following keys:

activity Object

Field Type Description
name string Name of the activity.
start_location string Resolved coordinates of the activity start location ("lat,lon").
start_location_type string Type of the start location (always "coordinates" after geocoding).
start_location_display_name string / null Human-readable name for the start location. Provided by the caller or resolved via geocoding.
end_location string Resolved coordinates of the activity end location ("lat,lon").
end_location_type string Type of the end location (always "coordinates" after geocoding).
end_location_display_name string / null Human-readable name for the end location. Provided by the caller or resolved via geocoding.
timezone string IANA timezone identifier for the activity (e.g. "Europe/Vienna").
date string Activity date in YYYY-MM-DD format.
date_end string / null Last day of a multi-day activity in YYYY-MM-DD format. null for single-day activities.
duration_minutes integer Activity duration in minutes.
duration_days integer / null Activity duration in days for multi-day activities. null for single-day activities.
earliest_start_time string Earliest arrival time at the activity as ISO 8601 UTC datetime (e.g. "2026-05-10T06:00:00Z").
latest_start_time string Latest arrival time at the activity as ISO 8601 UTC datetime.
earliest_end_time string Earliest departure time from the activity as ISO 8601 UTC datetime.
latest_end_time string Latest departure time from the activity as ISO 8601 UTC datetime.
start_time_label string / null Custom label for the activity start time (e.g. "Check-in"). null if not provided.
end_time_label string / null Custom label for the activity end time (e.g. "Check-out"). null if not provided.

connections Object

Field Type Description
to_activity array Array of journeys leading to the activity. Empty ([]) when the to-activity direction was skipped (scroll requests targeting only from-connections).
recommended_to_activity_connection integer / null Connection ID of the recommended to-activity connection. null when the to-activity direction was skipped in a scroll request.
has_more_before_to_activity boolean / null true if earlier to-connections exist (earliest arrival in batch is above the window floor). false means the window floor has been reached. null means not determinable this request — keep the last known value.
has_more_after_to_activity boolean / null true if later to-connections exist (latest arrival in batch is below the arrival deadline). false means the arrival deadline has been reached. null means not determinable this request — keep the last known value.
from_activity array Array of journeys from the activity back to the user's start. Empty ([]) when the from-activity direction was skipped.
recommended_from_activity_connection integer / null Connection ID of the recommended from-activity connection. null when skipped.
has_more_before_from_activity boolean / null true if earlier from-connections exist (earliest departure in batch is above the window floor). false means the floor has been reached. null means not determinable this request — keep the last known value.
has_more_after_from_activity boolean / null true if later from-connections exist (latest departure in batch is below the window ceiling). false means the ceiling has been reached. null means not determinable this request — keep the last known value.

Journey Object

Each journey in to_activity, from_activity (from /connections), or connections (from /journey) contains the following fields:

Field Type Description
connection_id integer Unique identifier for this connection within the list.
connection_start_timestamp string The actual start time of the journey in ISO 8601 format (UTC): the first leg's departure_time, so it includes realtime delays. Clients can show it as-is; the timetable time is only on the legs (departure_time_scheduled).
connection_end_timestamp string The actual end time of the journey in ISO 8601 format (UTC): the last leg's arrival_time, so it includes realtime delays. Clients can show it as-is; the timetable time is only on the legs (arrival_time_scheduled).
connection_transfers integer The number of transfers in the journey.
connection_elements array Array of Connection Element objects representing each step in the journey.
connection_anytime boolean Indicates if the leg is time-independent (e.g., a walk).
connection_ticketshop_provider string (Optional) Name of the primary ticketshop provider (e.g., "OEBB", "SBB", "TRAIVELLING"). This is the first available provider from connection_ticketshop_segments. null if no provider is available. For backward compatibility, always check segments first.
connection_ticketshop_segments array (Optional) Array of Ticketshop Segment objects defining which provider covers which leg ranges. Only present when a ticketshop provider is available. See Ticketshop Segment below.
connection_score float Calculated score indicating the suitability of the connection (higher is better).

Connection Element

A Connection Element represents a single step (e.g., train, bus, or transfer) in the journey. It contains the following:

Field Type Description
realtime boolean true when the routing provider has live data for this leg (see Realtime Data). Always false for walks and transfers.
from_location string The departure location name for this leg. Always a human-readable string — raw coordinate strings are never returned (the backend resolves display names from geocoding).
from_location_coordinates object Coordinates of the departure location: {"lat": float, "lon": float}.
to_location string The arrival location name for this leg. Always human-readable.
to_location_coordinates object Coordinates of the arrival location: {"lat": float, "lon": float}.
departure_time string The actual departure time in ISO 8601 format (UTC). Includes realtime delays when realtime is true.
arrival_time string The actual arrival time in ISO 8601 format (UTC). Includes realtime delays when realtime is true.
duration integer Duration of this leg in minutes.
type string The type of transport: JNY (transit journey), WALK (walking), TRSF (transfer).
vehicle_name string Optional. The name/number of the vehicle (e.g., "RJX 560", "U1").
vehicle_type integer Optional. The vehicle type returned as ID (see Vehicle Type Table below).
n_intermediate_stops integer Optional. Number of intermediate stops during this leg.
direction string Optional. End stop of this vehicle's trip (headsign/direction).
platform_orig string Optional. Departure platform at the origin stop.
platform_dest string Optional. Arrival platform at the destination stop.
alerts array Optional. Array of service alerts for this leg (see Alert Object below).
flex object Optional. Only for on-demand (FLEX) legs: service name and availability windows (see Flex Object below).
booking object Optional. Booking requirements for this leg, present only when the routing provider supplies booking rules (see Booking Object below).
ticket_urls object Optional. The leg's own ticket link if supplied by routing engine: web (the link) and, when known, name, a display label (route name, else agency name, else line name). See Ticketshop Segment for how web is used.
departure_time_scheduled string Optional. Timetable departure (ISO 8601, UTC). Only present when realtime is true.
arrival_time_scheduled string Optional. Timetable arrival (ISO 8601, UTC). Only present when realtime is true.
departure_delay integer Optional. Departure delay in minutes, negative when early. Only present when realtime is true.
arrival_delay integer Optional. Arrival delay in minutes, negative when early. Only present when realtime is true.
platform_orig_scheduled string Optional. Timetable departure platform; only present when the live platform_orig differs.
platform_dest_scheduled string Optional. Timetable arrival platform; only present when the live platform_dest differs.
cancelled boolean Optional. true when the trip is cancelled. Omitted otherwise.
additional_service boolean Optional. true for an extra trip that is not in the timetable. Omitted otherwise.
Realtime Data

realtime is reported per leg; there is no connection-level realtime flag. A leg is realtime as soon as the provider holds a live update for that trip, even when it runs on time. departure_time / arrival_time and platform_orig / platform_dest always hold the actual values. Walk, transfer and on-demand legs are never realtime, but their times shift along with delayed transit legs. Connection results are cached for up to the configured schedule cache duration (default 15 minutes). Results in which a leg actually deviates from the timetable (a delay, a platform change, a cancellation or an added trip) are only cached for 1 minute, so live data on disrupted connections lags by at most about a minute. On-time realtime legs use the normal duration.

With Austrian realtime access, a trip with exactly one end in Austria may combine several routing sources in one connection: Austrian realtime data inside Austria, the regular timetable abroad and for the last mile (e.g. a cable car or shuttle). Such connections use the same leg format; a train that runs across the transfer station is shown as one leg.

The connection-level connection_start_timestamp / connection_end_timestamp are actual times as well: they match the first leg's departure_time and the last leg's arrival_time, delays included. A client that shows a connection's overall times (e.g. in a list of departures) can use them directly and does not need to apply departure_delay / arrival_delay itself. To show how far a connection deviates from the timetable, compare with departure_time_scheduled of the first transit leg and arrival_time_scheduled of the last transit leg (walk legs carry no scheduled times).

Note on ghost walks: Multi-modal routing injects a short WALK leg from the user's provided coordinate to the nearest platform node. Because the user is already at that station (they selected it from autocomplete and sent coordinates), this walk is spurious and is removed server-side. Removal applies only at the user's position:

The activity-side ends (last leg of to_activity, first leg of from_activity) are never modified. connection_start_timestamp / connection_end_timestamp are adjusted after removal.

Vehicle Type Table

All Vehicle Types are returned as a ID. Each ID corresponds to a specific vehicle type. The following table provides the mapping:

ID de en sl it fr
1 Zug Train Vlak Treno Train
2 Bus Bus Avtobus Bus Bus
3 Straßenbahn Tram Tramvaj Tram Tramway
4 U-Bahn Subway Metro Metro Métro
5 Einschienenbahn Monorail Monorail Monorotaia Monorail
6 Zahnradbahn Cog Train Zobna železnica Cremagliera Crémaillère
7 Standseil-/Zahnradbahn Funicular / rack railway Vzpenjača / zobata železnica Funicolare / cremagliera Funiculaire / crémaillère
8 Seilbahn Aerial Lift Žičnica Funivia Téléporté
9 Fähre Ferry Trajekt Traghetto Ferry
10 Bedarfsverkehr On-demand Prevoz na klic Servizio a chiamata Transport à la demande
20 Verschiedenes Miscellaneous Raznovrsten Misto Différents
30 Haus House Hiša Casa Maison
31 Straße Street Ulica Strada Rue
32 Platz Square Trg Piazza Place
33 Park Park Park Parco Parc
Alert Object

Service alerts provide information about disruptions, delays, or other important notices for a leg. Alerts are based on the GTFS Realtime specification. Not every leg has alerts; they are only present when there is relevant service information. Alerts referring to the leg's trip/route and to its boarding and alighting stop are combined; identical alerts are reported once.

Field Type Description
severity string Display severity: info, warning or severe. Taken from the feed's severity level when set, otherwise derived from effect: severe for NO_SERVICE; warning for REDUCED_SERVICE, SIGNIFICANT_DELAYS, DETOUR, MODIFIED_SERVICE, STOP_MOVED, ACCESSIBILITY_ISSUE; info otherwise.
scope string What the alert refers to: trip (the trip/route of this leg), departure_stop or arrival_stop.
stop_name string Optional. Name of the affected stop, for departure_stop / arrival_stop alerts.
cause string The cause of the alert. Possible values include: UNKNOWN_CAUSE, OTHER_CAUSE, TECHNICAL_PROBLEM, STRIKE, DEMONSTRATION, ACCIDENT, HOLIDAY, WEATHER, MAINTENANCE, CONSTRUCTION, POLICE_ACTIVITY, MEDICAL_EMERGENCY, SPECIAL_EVENT. May be null.
effect string The effect of the alert. Possible values include: NO_SERVICE, REDUCED_SERVICE, SIGNIFICANT_DELAYS, DETOUR, ADDITIONAL_SERVICE, MODIFIED_SERVICE, OTHER_EFFECT, UNKNOWN_EFFECT, STOP_MOVED, NO_EFFECT, ACCESSIBILITY_ISSUE. May be null.
header_text string Brief header/title text for the alert. May be empty.
description_text string Detailed description (plain text; may contain line breaks, URLs and phone numbers). May be empty.
url string Optional. URL with additional information.
cause_detail string Optional. Agency-specific description of the cause.
effect_detail string Optional. Agency-specific description of the effect.
code string Optional. Attribute/notice code (e.g. from HRDF or NeTEx timetables).
impact_period array Optional. When the service is affected: list of {"start": datetime or null, "end": datetime or null} (UTC; null = open-ended).
communication_period array Optional. When the alert should be shown, same format.
image_url, image_media_type, image_alternative_text string Optional. Image belonging to the alert.

Texts are returned in the requested lang when the feed contains a translation for it.

Example Alert:

{
  "cause": "UNKNOWN_CAUSE",
  "effect": "OTHER_EFFECT",
  "severity": "info",
  "scope": "trip",
  "header_text": "",
  "description_text": "Buchung und mehr Infos unter https://blaguss.com/reiseangebot/mit-dem-bus-zum-schnee#c4628"
}
Flex Object

Present only on on-demand (GTFS-Flex) legs (vehicle_type 10). All fields are optional.

Field Type Description
name string Name of the on-demand service or service area (e.g. "RUDI").
pickup_window_start string Start of the pickup availability window at the boarding location (ISO 8601, UTC).
pickup_window_end string End of the pickup availability window at the boarding location.
drop_off_window_start string Start of the drop-off availability window at the alighting location.
drop_off_window_end string End of the drop-off availability window at the alighting location.
Booking Object

Booking requirements following GTFS-Flex booking_rules.txt. Present only when the routing provider supplies booking rules for the leg; absent otherwise. Contains pickup (rule for boarding) and/or drop_off (rule for alighting), each a Booking Rule. All fields are optional.

Field Type Description
booking_type string real_time (bookable until departure), same_day (with advance notice on the same day) or prior_days (up to a number of days before travel).
message string General booking instructions.
pickup_message string Booking instructions specific to pickup.
drop_off_message string Booking instructions specific to drop-off.
phone_number string Phone number for booking.
info_url string URL with information about booking.
booking_url string URL to book online.
prior_notice_duration_min integer same_day: minimum notice in minutes before departure.
prior_notice_duration_max integer same_day: maximum notice in minutes before departure.
earliest_booking_time string Earliest time this leg can be booked (ISO 8601, UTC).
latest_booking_time string Booking deadline for this leg (ISO 8601, UTC). For real_time this is the departure time.

Booking times are absolute for this leg and come from the routing provider: for same_day the departure minus the notice duration, for prior_days the local time in the agency timezone on the given number of days before the day of travel.

Example Booking:

{
  "pickup": {
    "booking_type": "prior_days",
    "message": "Bitte bis 17:00 am Vortag anmelden.",
    "phone_number": "+43 50 422 422",
    "booking_url": "https://example.org/book",
    "latest_booking_time": "2026-10-18T15:00:00Z"
  }
}

Ticketshop Segment

A Ticketshop Segment defines which ticketshop provider covers a specific range of legs within a connection. This is particularly useful when a single connection requires multiple tickets from different providers, or when some legs (e.g., buses) are not covered by the available provider.

Key Insight: Some ticketshop providers (e.g., Traivelling) only support train journeys and do not cover buses. In such cases, a connection might be split into multiple segments:

segment_index always refers to the segments returned for that connection, so take it from connection_ticketshop_segments instead of assuming a fixed index.

The client application must handle this by:

  1. Showing which legs are covered by which provider
  2. Informing users when certain legs (e.g., buses) have no ticket booking available
  3. Calling /generate-ticketshop-link with the appropriate segment_index to get separate ticket links
Field Type Description
leg_from integer Inclusive start index of the leg range in connection_elements (0-based).
leg_to integer Inclusive end index of the leg range in connection_elements (0-based).
provider string Name of the ticketshop provider for this segment (e.g., "TRAIVELLING", "OEBB"), the link's display name for a single leg with its own ticket link (e.g. "Postbus"), or null if no provider covers these legs.
url string Optional. Only on segments using a leg's own ticket link. Ticketshop providers' links come from /generate-ticketshop-link.

Example with Multiple Segments (Traivelling, Train + Bus + Train):

{
  "connection_ticketshop_provider": "TRAIVELLING",
  "connection_ticketshop_segments": [
    {
      "leg_from": 0,
      "leg_to": 1,
      "provider": "TRAIVELLING"
    },
    {
      "leg_from": 3,
      "leg_to": 3,
      "provider": null
    },
    {
      "leg_from": 5,
      "leg_to": 6,
      "provider": "TRAIVELLING"
    }
  ]
}

Same connection, where the routing engine supplied a ticket link for the bus (leg 3):

{
  "connection_ticketshop_provider": "TRAIVELLING",
  "connection_ticketshop_segments": [
    { "leg_from": 0, "leg_to": 1, "provider": "TRAIVELLING" },
    { "leg_from": 3, "leg_to": 3, "provider": "Postbus", "url": "https://shop.example-bus.at/ticket?trip=123" },
    { "leg_from": 5, "leg_to": 6, "provider": "TRAIVELLING" }
  ]
}

Example with Single Provider (OEBB, supports all legs):

{
  "connection_ticketshop_provider": "OEBB",
  "connection_ticketshop_segments": [
    {
      "leg_from": 0,
      "leg_to": 5,
      "provider": "OEBB"
    }
  ]
}

Journey Response

Root Object

The response is a JSON object containing the following keys:

journey_request Object

This object echoes the parameters sent in the request, with defaults applied. See Journey Parameters for fields.

connections Array

This is an array of Journey Objects. See the Journey Object definition under the "Connections Response" section for the full structure.


Address Autocomplete Response

The response is a GeoJSON FeatureCollection with enhanced properties in a new diana_properties object. If no matches are found for the query, the response will be an empty array. Each feature contains:

Feature Object Structure

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [lon, lat]
  },
  "properties": {
    // Original Photon properties (see below)
  },
  "diana_properties": {
    // Enhanced properties (see below)
  }
}

Properties Object

Field Type Description
name string Display name of the location
street string Street name (when applicable)
city string City name
district string District/neighborhood
postcode string Postal code
country string Country name
countrycode string 2-letter country code
type string Location type (house, street, locality, etc.)
osm_id integer OpenStreetMap ID
osm_type string OSM element type (N=node, W=way, R=relation)
osm_key string OSM primary tag key
osm_value string OSM primary tag value
extent array [Optional] Bounding box coordinates [minlon, minlat, maxlon, maxlat]

Enhanced Properties (diana_properties object)

Field Type Description
original_name string Preserves the original OSM name
display_name string Optimized display format (e.g., "Stephansplatz 1, Vienna")
short_display string Compact version of display_name (currently identical)
location_type string Either "address" or "station"
type_hint integer ID representing the location type (see Vehicle Type Table below)

Display Name Logic

Type Hint IDs (Vehicle Type Table)

Matches the same IDs used in Connections API (see above):

ID Description Examples
1 Train Railway stations
2 Bus Bus stops
3 Tram Tram stops
4 Subway U-Bahn stations
... ... ...
30 House Addresses with housenumber
31 Street Street segments
32 Square Public squares
33 Park Parks/leisure areas
20 Miscellaneous All other types

Reverse Geocoding Response

The response is the same as the Address Autocomplete response. Only one feature is returned, representing the reverse geocoded location. See Address Autocomplete Response for details.


Quota Check Response

The response is a JSON object containing the customer's quota configuration and current usage.

Field Type Description
requests_this_month integer Requests made by the customer in the current calendar month.
monthly_quota integer Monthly hard quota limit. Requests are rejected after monthly_quota + soft_quota_overstep requests per month.
requests_this_year integer Requests made by the customer in the current calendar year.
yearly_quota integer / null Yearly hard quota limit. null means no yearly cap is configured.
soft_quota_overstep integer Extra requests permitted beyond each hard quota before rejection. 0 = disabled (hard limit is strictly enforced).
current_plans object Add-ons active for the account and their descriptions, e.g. realtime_at (Realtime Addon). Empty when none.

Example (with yearly quota and soft quota):

{
  "requests_this_month": 95,
  "monthly_quota": 100,
  "requests_this_year": 850,
  "yearly_quota": 1000,
  "soft_quota_overstep": 20,
  "current_plans": {
    "realtime_at": "Access to realtime data in Austria"
  }
}

In this example the customer may still make up to 25 more requests this month (100 hard + 20 soft − 95 used) and up to 170 more requests this year (1000 hard + 20 soft − 850 used) before being rejected.


On success, the response is a JSON object containing one or more generated deeplinks.

Response Fields

Field Type Description
ticketshop_url string (Backward Compatible) The primary ticket shop URL. This is the first valid URL from ticketshop_links. Use this if you only need a single link and don't care about multi-segment scenarios.
ticketshop_links array Array of Ticketshop Link objects, one per segment. Each object contains the leg_from, leg_to, provider, and url for a ticket segment. This is the recommended field for handling multi-segment journeys.
Field Type Description
leg_from integer Inclusive start index of the leg range in connection_elements (0-based).
leg_to integer Inclusive end index of the leg range in connection_elements (0-based).
provider string Name of the ticketshop provider (e.g., "TRAIVELLING", "OEBB"). null if these legs have no ticket coverage.
url string The fully formed URL to the ticket shop for this segment. null if no provider covers these legs.

Response Behavior

Example 1: Single Provider (OEBB)

All legs are covered by a single provider.

Request:

POST /generate-ticketshop-link
{
  "connection_elements": [ /* OEBB connection */ ]
}

Response:

{
  "ticketshop_url": "https://shop.oebbtickets.at/en/ticket?stationOrigName=Wien%20Hbf&...",
  "ticketshop_links": [
    {
      "leg_from": 0,
      "leg_to": 5,
      "provider": "OEBB",
      "url": "https://shop.oebbtickets.at/en/ticket?stationOrigName=Wien%20Hbf&..."
    }
  ]
}

Example 2: Multi-Segment (Traivelling, Train + Bus + Train)

Traivelling does not support buses, so the connection is split into multiple segments.

Request:

POST /generate-ticketshop-link
{
  "connection_elements": [ /* Traivelling connection with bus leg */ ]
}

Response:

{
  "ticketshop_url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Berlin%20Hbf&...",
  "ticketshop_links": [
    {
      "leg_from": 0,
      "leg_to": 1,
      "provider": "TRAIVELLING",
      "url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Berlin%20Hbf&..."
    },
    {
      "leg_from": 3,
      "leg_to": 3,
      "provider": null,
      "url": null
    },
    {
      "leg_from": 5,
      "leg_to": 6,
      "provider": "TRAIVELLING",
      "url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Hamburg%20Hbf&..."
    }
  ]
}

Interpretation:

Example 3: Train + Transfer + Train (Single Segment)

When multiple train legs are separated only by transfers, they are combined into a single ticket segment:

Request:

POST /generate-ticketshop-link
{
  "connection_elements": [
    { "type": "JNY", "vehicle_type": 1, ... },  // Leg 0: Train (Vienna → Linz)
    { "type": "TRSF", ... },                     // Leg 1: Transfer (5 min walk)
    { "type": "JNY", "vehicle_type": 1, ... }   // Leg 2: Train (Linz → Salzburg)
  ]
}

Response:

{
  "ticketshop_url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Vienna%20Hbf&destinationName=Salzburg%20Hbf&...",
  "ticketshop_links": [
    {
      "leg_from": 0,
      "leg_to": 2,
      "provider": "TRAIVELLING",
      "url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Vienna%20Hbf&destinationName=Salzburg%20Hbf&..."
    }
  ]
}

Interpretation:

Example 4: Requesting a Specific Segment

To get a link for only the second train segment (legs 5-6):

Request:

POST /generate-ticketshop-link
{
  "connection_elements": [ /* Same as Example 2 */ ],
  "segment_index": 2
}

Response:

{
  "ticketshop_url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Hamburg%20Hbf&...",
  "ticketshop_links": [
    {
      "leg_from": 5,
      "leg_to": 6,
      "provider": "TRAIVELLING",
      "url": "https://traivelling.com/connections?ref=ZUUG260113&originName=Hamburg%20Hbf&..."
    }
  ]
}

Share Journey Response

The response is a JSON object containing the unique ID for the created share link.

Field Type Description
shareId string The unique hash key for the shared journey.

Example:

{
  "shareId": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
}

Retrieve Shared Journey Response

The response is a JSON object containing the originally saved journey data. The structure mirrors the request body of the Share Journey endpoint.

Example (new share record with all fields):

{
    "origin": "Wien Stephansplatz",
    "origin_display_name": "Stephansplatz (U), Wien",
    "origin_lat": 48.2084,
    "origin_lon": 16.3731,
    "date": "2024-09-15",
    "dateEnd": null,
    "to_connection_start_time": "2024-09-15T08:30:00Z",
    "to_connection_end_time": "2024-09-15T09:15:00Z",
    "from_connection_start_time": "2024-09-15T17:00:00Z",
    "from_connection_end_time": "2024-09-15T17:45:00Z",
    "shareURLPrefix": "https://example.com/planner",
    "activity": {
        "name": "Alpinpark Wiener Neustadt",
        "start_location": "47.7262,13.0422",
        "start_location_type": "coordinates",
        "start_location_display_name": "Alpinpark Wiener Neustadt",
        "end_location": "47.7049,13.0387",
        "end_location_type": "coordinates",
        "end_location_display_name": "Wiener Neustadt Hbf, Wiener Neustadt",
        "timezone": "Europe/Vienna",
        "date": "2024-09-15",
        "date_end": null,
        "duration_minutes": 480,
        "duration_days": null,
        "earliest_start_time": "2024-09-15T07:00:00Z",
        "latest_start_time": "2024-09-15T09:00:00Z",
        "earliest_end_time": "2024-09-15T15:00:00Z",
        "latest_end_time": "2024-09-15T18:00:00Z",
        "start_time_label": null,
        "end_time_label": null
    },
    "payload": {
        "bookingRef": "XY123",
        "tenant": "acme"
    }
}

Example (old share record, activity and origin_display_name absent):

{
    "origin": "Wien Stephansplatz",
    "origin_display_name": null,
    "origin_lat": 48.2084,
    "origin_lon": 16.3731,
    "date": "2024-09-15",
    "dateEnd": null,
    "to_connection_start_time": "2024-09-15T08:30:00Z",
    "to_connection_end_time": "2024-09-15T09:15:00Z",
    "from_connection_start_time": "2024-09-15T17:00:00Z",
    "from_connection_end_time": "2024-09-15T17:45:00Z",
    "shareURLPrefix": null,
    "activity": null,
    "payload": null
}

Errors and Codes

Errors are generally returned with a relevant HTTP status code (e.g., 400, 401, 404, 429, 500, 502, 503, 504).

When a routing provider does not answer in time, the provider error codes 3001, 3002 and 8010 are returned with HTTP 504 Gateway Timeout instead of 500; when it cannot be reached at all (e.g. while it restarts), with HTTP 503 Service Unavailable. The error code and message are unchanged; a retry after a short delay usually succeeds.

7005 (/generate-ticketshop-link) is returned with HTTP 502 Bad Gateway: the ticketshop's lookup returned nothing. It is not a server error; a retry may succeed in some cases.

7009 (/generate-ticketshop-link) is returned with HTTP 503 Service Unavailable and a Retry-After header: the lookup that picks the ticketshop is briefly unavailable. Retry after the given delay.

Standard Error Response Format

For errors identified by the application (typically 4xx status codes), the response body follows this JSON format:

{
  "error": "[ERROR_MESSAGE]",
  "code": "[ERROR_CODE]"
}

Error Code Table

Code Text Log Error into Table
1001 Query parameter 'q' is missing No
1002 Invalid limit parameter No
1003 Failed to fetch autocomplete results. Yes
2001 Invalid coordinates format for user_start_location. Please use 'lat,lon' No
2002 Could not geocode user_start_location '[USER_START_LOCATION]' No
2003 Failed to geocode user_start_location. Yes
2004 Unsupported user_start_location_type: '[USER_START_LOCATION_TYPE]' No
2005 Invalid coordinates format for activity_start_location. Please use 'lat,lon' No
2006 Could not geocode activity_start_location '[ACTIVITY_START_LOCATION]' No
2007 Failed to geocode activity_start_location. Yes
2008 Unsupported activity_start_location_type: '[ACTIVITY_START_LOCATION_TYPE]' No
2009 Invalid coordinates format for activity_end_location. Please use 'lat,lon' No
2010 Could not geocode activity_end_location '[ACTIVITY_END_LOCATION]' No
2011 Failed to geocode activity_end_location. Yes
2012 Unsupported activity_end_location_type: '[ACTIVITY_END_LOCATION_TYPE]' No
2017-1 No suitable connections found TO the activity. No
2017-2F No suitable connections found FROM the activity today, even after fallback. No
2017-2F-1 No suitable connections found FROM the activity, even after fallback. No
2018-1 Connections found TO activity, but none met scoring criteria. No
2020-1 No suitable connections found TO the activity. (No TA connections found or merging failed) No
2021-1 No suitable connections found TO the activity within the specified time window. No
2022-1 No suitable connections found TO the activity departing after current time. No
2023-1 No suitable connections found TO the activity. (All filtered out by duration) No
2024 Found return connections, but no incoming connection arrives early enough to make the latest return. Try adjusting activity duration or times. No
2026-1 Internal error finding recommended 'to activity' connection. Yes
2027 No suitable public transport stations could be found near the specified address. No
3001 Internal error calculating connections to activity. (Error while fetching connections from provider) Yes
3002 Internal error calculating connections from activity. (Error while fetching connections from provider) Yes
3004 Internal error processing fallback results. Yes
4001 Latitude and longitude parameters are required No
4002 Failed to fetch reverse geocode results. Yes
5001 This shared link is invalid or has expired. (also returned for an unknown share_id on /connections) No
5002 An unexpected error occurred while retrieving the shared journey. Yes
5003 Invalid share_id format. (the share_id passed to /connections is not a UUID) No
5004 This shared journey does not contain the activity data required to calculate connections. (share created before the activity field existed) No
6001 Monthly quota exceeded No
6002 Yearly quota exceeded No
7001 Field connection_elements cannot be empty. No
7002 Missing coordinates in connection elements. No
7003 No ticketshop provider available for this connection. No
7004 Could not extract necessary details from connection elements. No
7005 Failed to generate ticketshop URL. Yes
7006 An unexpected error occurred during link generation. Yes
7007 segment_index [INDEX] is out of range (0-[MAX]). No
7008 The requested segment has no ticketshop provider. No
7009 Ticketshop lookup is temporarily unavailable, please retry later. (temporary; HTTP 503 with Retry-After) No
8001 Invalid coordinates format for from_location. Please use 'lat,lon' No
8002 Could not geocode from_location '[FROM_LOCATION]' No
8003 Failed to geocode from_location. Yes
8004 Unsupported from_location_type: '[FROM_LOCATION_TYPE]' No
8005 Invalid coordinates format for to_location. Please use 'lat,lon' No
8006 Could not geocode to_location '[TO_LOCATION]' No
8007 Failed to geocode to_location. Yes
8008 Unsupported to_location_type: '[TO_LOCATION_TYPE]' No
8010 Internal error calculating connections. Yes
8011 No connections found for the specified route and time. No
8012 No connections found departing in the future. No

Example Usage

Connections Example (Initial Load)

GET /connections?user_start_location=48.2004,16.3697&user_start_location_type=coordinates&user_start_location_display_name=Wien%20Karlsplatz%20(U)%2C%20Wien&activity_name=Hiking%20Rax&activity_start_location=47.715575,15.804045&activity_start_location_type=coordinates&activity_end_location=47.682191,15.644807&activity_end_location_type=coordinates&activity_earliest_start_time=08:00&activity_latest_start_time=10:00&activity_earliest_end_time=16:00&activity_latest_end_time=18:00&activity_duration_minutes=210&timezone=Europe%2FVienna
Authorization: Bearer [token]

user_start_location_display_name and timezone are strongly recommended. user_start_location_display_name should be the diana_properties.display_name of the autocomplete result the user selected.

Connections Example (Scroll — Load Earlier To-Connections)

All standard parameters must be repeated. Add to_connections_before anchored to the earliest connection_start_timestamp in the current to-connections list.

GET /connections?user_start_location=48.2004,16.3697&user_start_location_type=coordinates&user_start_location_display_name=Wien%20Karlsplatz%20(U)%2C%20Wien&activity_name=Hiking%20Rax&activity_start_location=47.715575,15.804045&activity_start_location_type=coordinates&activity_end_location=47.682191,15.644807&activity_end_location_type=coordinates&activity_earliest_start_time=08:00&activity_latest_start_time=10:00&activity_earliest_end_time=16:00&activity_latest_end_time=18:00&activity_duration_minutes=210&timezone=Europe%2FVienna&to_connections_before=2026-05-10T06:40:00Z
Authorization: Bearer [token]

The response will have from_activity: [] and all has_more_*_from_* fields null. Keep the from-connections from the previous response unchanged.

Journey Example

GET /journey?from_location=Stephansplatz, Wien&to_location=Wien Hauptbahnhof&date=2025-11-20&time=14:30:00&is_arrival=false
Authorization: Bearer [token]

Address Autocomplete Example

GET /address-autocomplete?q=Wien%20Step&hint_lat=48.208&hint_lon=16.373
Authorization: Bearer [token]
POST /generate-ticketshop-link
Authorization: Bearer [token]
Content-Type: application/json

{
    "connection_elements": [
        {
            "realtime": true,
            "from_location": "Wien Karlsplatz (U)",
            "from_location_coordinates": {"lat": 48.2004, "lon": 16.3697},
            "to_location": "Wien Hbf",
            "to_location_coordinates": {"lat": 48.1852, "lon": 16.3757},
            "departure_time": "2024-09-15T08:30:00Z",
            "arrival_time": "2024-09-15T08:35:00Z",
            "duration": 5,
            "vehicle_name": "U1",
            "type": "JNY"
        },
        {
            "realtime": false,
            "from_location": "Wien Hbf",
            "from_location_coordinates": {"lat": 48.1852, "lon": 16.3757},
            "to_location": "Payerbach-Reichenau Bahnhof",
            "to_location_coordinates": {"lat": 47.694, "lon": 15.861},
            "departure_time": "2024-09-15T08:55:00Z",
            "arrival_time": "2024-09-15T09:58:00Z",
            "duration": 63,
            "vehicle_name": "RJ 557",
            "type": "JNY"
        }
    ]
}

Share Journey Example

POST /share/
Authorization: Bearer [token]
Content-Type: application/json

{
    "origin": "Wien Karlsplatz",
    "origin_display_name": "Wien Karlsplatz (U), Wien",
    "origin_lat": 48.2004,
    "origin_lon": 16.3697,
    "date": "2024-09-15",
    "to_connection_start_time": "2024-09-15T08:30:00Z",
    "to_connection_end_time": "2024-09-15T09:15:00Z",
    "from_connection_start_time": "2024-09-15T17:00:00Z",
    "from_connection_end_time": "2024-09-15T17:45:00Z",
    "activity": {
        "name": "Hiking Rax",
        "start_location": "47.7156,15.804",
        "start_location_type": "coordinates",
        "start_location_display_name": "Rax Seilbahn Talstation",
        "end_location": "47.6822,15.6448",
        "end_location_type": "coordinates",
        "end_location_display_name": "Reichenau an der Rax Bahnhof, Reichenau an der Rax",
        "timezone": "Europe/Vienna",
        "date": "2024-09-15",
        "date_end": null,
        "duration_minutes": 210,
        "duration_days": null,
        "earliest_start_time": "2024-09-15T06:00:00Z",
        "latest_start_time": "2024-09-15T08:00:00Z",
        "earliest_end_time": "2024-09-15T14:00:00Z",
        "latest_end_time": "2024-09-15T16:00:00Z",
        "start_time_label": null,
        "end_time_label": null
    },
    "payload": {
        "bookingRef": "XY123",
        "tenant": "acme"
    }
}

Retrieve Shared Journey Example

GET /share/a1b2c3d4-e5f6-7890-1234-567890abcdef/
Authorization: Bearer [token]

Bundled Connections Example (replay a share in one request)

GET /connections?share_id=a1b2c3d4-e5f6-7890-1234-567890abcdef
Authorization: Bearer [token]

Response (abridged):

{
    "activity": { "name": "Hiking Rax", "...": "..." },
    "connections": {
        "to_activity": [ { "connection_id": 7, "...": "..." } ],
        "recommended_to_activity_connection": 7,
        "from_activity": [ { "connection_id": 12, "...": "..." } ],
        "recommended_from_activity_connection": 12
    },
    "realtime_provider_used": false,
    "shared_journey": {
        "origin": "Wien Karlsplatz",
        "date": "2024-09-15",
        "to_connection_start_time": "2024-09-15T08:30:00Z",
        "from_connection_start_time": "2024-09-15T17:00:00Z",
        "activity": { "...": "..." },
        "payload": { "bookingRef": "XY123", "tenant": "acme" },
        "to_connection_id": 7,
        "to_connection_found": true,
        "from_connection_id": 12,
        "from_connection_found": true
    }
}

Re-plan the same shared activity for a different day by overriding a parameter:

GET /connections?share_id=a1b2c3d4-e5f6-7890-1234-567890abcdef&date=2024-10-01
Authorization: Bearer [token]

For complete examples, see the Postman collection at Diana API Postman Collection.


Troubleshooting & Edge Cases

  1. Invalid Coordinates:

    • Returns 400 error with message: Invalid coordinates format for [location]. Please use lat,lon (Code: 2001, 2005, 2009, 8001, 8005)
  2. No Connections Found:

    • Returns 404 error with relevant message (Codes: 2017-1, 2017-2F, 2017-2F-1, 2018-1, 2020-1, 2021-1, 2022-1, 2023-1, 2024, 8011, 8012)
    • Maybe due to:
      • No connections fitting the time windows (EST-LST, EET-LET).
      • Calculated duration preventing a valid return journey even with fallback logic.
      • Check activity times, duration, and date.
  3. Authentication Errors:

    • Returns 401 Unauthorized for missing, invalid, expired or revoked authentication tokens, and for tokens of a deactivated customer account ("detail": "Customer account is disabled.").
    • Ensure the Authorization header includes a valid Bearer [token].
  4. Quota Exceeded:

    • Monthly quota exceeded – returns 429 Too Many Requests with error code 6001.
    • Yearly quota exceeded – returns 429 Too Many Requests with error code 6002.
    • The monthly limit is always evaluated first. If both limits are set and the monthly ceiling is hit first, the response will carry code 6001 even if the yearly ceiling has not yet been reached.
    • A soft-quota overstep (soft_quota_overstep > 0) extends the effective ceiling above the hard quota for both limits. Requests are still allowed within the soft window; only after the soft ceiling is surpassed is the request rejected.
    • These codes apply to the /connections and /journey endpoints of accounts that are blocked at the limit, and to the agreed monthly hard cap of accounts with overage billing.
  5. Location Not Found / Geocoding Failed:

    • Returns 400 error if a provided location name cannot be geocoded (Codes: 2002, 2006, 2010, 8002, 8006).
    • Returns 500 error if the geocoding service itself fails (Codes: 2003, 2007, 2011, 8003, 8007).
    • Returns 400 error if no public transport stop lies near a location (Code: 2027).
  6. Shared Link Invalid or Expired:

    • Returns 404 error with message: This shared link is invalid or has expired. (Code: 5001)
    • The same code is returned when an unknown share_id is passed to /connections.
  7. Bundled Mode Problems (/connections?share_id=...):

    • share_id is not a UUID → 400 with code 5003.
    • The share has no activity object (created before that field existed) → 400 with code 5004. Fall back to the two-call flow for those records.
    • The shared connection cannot be brought back (most often: it has already departed) → still 200, with to_connection_found / from_connection_found set to false and the corresponding id null. Treat this as "the shared departure is no longer available" and show the rest of the list.
    • to_connection_found / from_connection_found are null (not false) when the share never named a connection for that leg.
  8. Incomplete Data in Response:

    • Missing optional fields in the response (e.g., vehicle_name) might be returned as null or omitted.
    • Client applications should handle null/missing values gracefully (e.g., display "N/A").
  9. Scroll Parameter Combinations:

    • Sending both to_connections_before and to_connections_after in the same request returns HTTP 400.
    • The same applies to from_connections_before + from_connections_after.
    • Combining a to-param with a from-param (e.g. to_connections_before + from_connections_after) does not scroll both directions and does not return an error. The request is handled as an ordinary initial load and both anchors are silently ignored — you receive the default batch for both directions. Scroll one direction per request.
  10. null on has_more_* flags — two causes:

  1. Date Handling:
    • If date is not provided for a connection search, the current date (UTC) is used.
    • Date must be in YYYY-MM-DD format.
    • All times sent and received are UTC. The timezone parameter carries the activity's IANA timezone identifier and is echoed back in the activity object for display-layer use. The widget converts local activity times to UTC using this timezone before sending them to the API.