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


Table of Contents

  1. Overview
  2. Endpoint Details
  3. Request Parameters
  4. Guide: Using Activity Time Parameters
  5. Understanding the Response
  6. Errors and Codes
  7. Example Usage
  8. 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 plan 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. API usage may be subject to a monthly quota.


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: The time parameters for this endpoint are highly flexible. See the "Guide: Using Activity Time Parameters" section for a detailed explanation of how they work.

Monthly Quota

Starter-Plan users are limited to a monthly request quota on this endpoint.

Pro-Plan users are not affected by a request quota.

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.

Monthly Quota

This endpoint shares the same monthly quota as the /connections endpoint for Starter-Plan users. Each request counts as 1 towards the quota.

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 a ticketshop deeplink 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 if one can be generated.

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/<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.
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.

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.

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 endpoint for a journey.

Share Journey Parameters (Request Body)

Parameter Type Required Description
origin string Yes The starting location name for the shared journey.
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.

Retrieve Shared Journey Parameters (URL)

Parameter Type Required Description
hash_key string Yes The unique hash 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.


Understanding the Response

Connections Response

Root Object

The response is a JSON object containing the following keys:

activity Object

Field Type Description
activity_id integer Unique identifier for the activity
activity_name string Name of the activity
activity_start_location string Starting location of the activity
activity_start_location_display_name string Display name for the starting location (if applicable)
activity_start_location_type string Type of the starting location (e.g., "address", "coordinates")
activity_end_location string Ending location of the activity
activity_end_location_display_name string Display name for the ending location (if applicable)
activity_end_location_type string Type of the ending location (e.g., "address", "coordinates")
activity_earliest_start_time time The earliest start time of the activity in HH:MM:SS format (UTC).
activity_latest_start_time time The latest start time of the activity in HH:MM or HH:MM:SS format (UTC).
activity_earliest_end_time time The earliest end time of the activity in HH:MM or HH:MM:SS format (UTC).
activity_latest_end_time time The latest end time of the activity in HH:MM:SS format (UTC).
activity_duration_minutes integer Duration of the activity in minutes
activity_duration_days integer Duration of the activity in days.
activity_start_time_label string Custom label for the start time (if applicable), e.g. for hotel check-in
activity_end_time_label string Custom label for the end time (if applicable), e.g. for hotel check-out

connections Object

Field Type Description
to_activity array Array of journeys leading to the activity.
recommended_to_activity_connection integer Connection ID of the recommended connection in to_activity array.
from_activity array Array of journeys leading back from the activity to the starting location.
recommended_from_activity_connection integer Connection ID of the recommended connection in from_activity array.

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 start time of the journey in ISO 8601 format (UTC).
connection_end_timestamp string The end time of the journey in ISO 8601 format (UTC).
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 Name of the ticketshop provider (e.g., "OEBB", "SBB"). null if no provider is available.
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
provider string Defines if a realtime data provider was used for this leg
from_location string The departure location for this Connection Element.
to_location string The arrival location for this Connection Element.
departure_time string The scheduled departure time in ISO 8601 format (UTC).
arrival_time string The scheduled arrival time in ISO 8601 format (UTC).
type string The type of transport (e.g., JNY for journey, TRSF for transfer).
vehicle_name string Optional. The name of the vehicle (e.g., REX64).
vehicle_type integer Optional. The vehicle type returned as ID (see below for mapping).
n_intermediate_stops integer Optional. Number of stops between origin and destination
direction string Optional. End stop of this vehicle's trip (headsign/direction)
platform_orig string Optional. Platform where this vehicle is departing from at origin
platform_dest string Optional. Platform where this vehicle will be arriving at the destination
alerts array Optional. Array of service alerts for this leg (see Alert Object below)
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 Standseilbahn Funicular Funicular Funicolare Funiculaire
8 Seilbahn Aerial Lift Žičnica Funivia Téléporté
9 Fähre Ferry Trajekt Traghetto Ferry
10 Taxi Taxi Taksi Taxi Taxi
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.

Field Type Description
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.
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.
header_text string Brief header/title text for the alert. May be empty if no header is provided.
description_text string Detailed description of the alert with additional information (e.g., booking URLs, instructions).

Example Alert:

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

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 and plan status.

Field Type Description
requests_this_month integer Number of requests made by the customer in the current month.
monthly_quota integer Total monthly quota allocated to the customer.
current_plans object Dictionary of active plans/scopes and their descriptions.

Example:

{
  "requests_this_month": 50,
  "monthly_quota": 100,
  "current_plans": {
    "starter_plan": "Starter-Plan: Free access to the Diana API",
    "realtime_at": "Access to realtime data in Austria"
  }
}

On success, the response is a JSON object containing the generated deeplink.

Field Type Description
ticketshop_url string The fully formed URL to the ticket shop.

Example:

{
  "ticketshop_url": "https://shop.oebbtickets.at/en/ticket?stationOrigName=Wien%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 matches the request body of the Share Journey endpoint.

Example:

{
    "origin": "Stephansplatz, Vienna",
    "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](https://example.com/planner)"
}

Errors and Codes

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

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-2 No suitable connections found FROM 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
2018-2 Connections found FROM activity, but none met scoring criteria. No
2019-1 No suitable connections found TO the activity (No connections found for TA segment; Merging might fail) No
2019-2 No suitable connections found FROM the activity (No connections found for TA segment; Merging might fail) No
2020-1 No suitable connections found TO the activity (No TA connections found or merging failed) No
2020-2 No suitable connections found FROM 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
2021-2 No suitable connections found FROM 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
2023-2 No suitable connections found FROM 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
2025-1 Error calculating connections to activity. Yes
2025-2 Error calculating connections from activity. Yes
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
3003 Internal error calculating connections from activity. (Error while fetching connections from provider, but inside fallback) 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. No
5002 An unexpected error occurred while retrieving the shared journey. Yes
6001 Monthly quota exceeded No
7001 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
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

GET /connections?user_start_location=Karlsplatz, Wien&activity_name=Hiking Rax&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
Authorization: Bearer [token]

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": [
        {
            "provider": "VAO",
            "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"
        },
        {
            "provider": "VAO",
            "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": "Stephansplatz, Vienna",
    "date": "2024-09-15",
    "to_connection_start_time": "2024-09-15T08:30:00Z",
    "to_connection_end_time": "2024-09-15T09:15:00Z"
}

Retrieve Shared Journey Example

GET /share/a1b2c3d4-e5f6-7890-1234-567890abcdef
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, 2018, 2019, 2022, 2023, 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, or expired authentication tokens.
    • Ensure the Authorization header includes a valid Bearer [token].
  4. Monthly Quota Exceeded:

    • Returns 429 Too Many Requests with error code 6001.
    • This applies to free-tier users on the /connections and /journey endpoints.
  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).
  6. Shared Link Invalid or Expired:

    • Returns 404 error with message: This shared link is invalid or has expired. (Code: 5001)
  7. 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").
  8. 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. Client applications are responsible for converting to/from local timezones for display.