Get available train trips
Returns a list of available train trips between the specified origin and destination stations on the given date, and allows for filtering by bicycle and dog allowances.
Query parameters
-
page integer
The page number to return
Minimum value is
1
. Default value is1
. -
limit integer
The number of items to return per page
Minimum value is
1
, maximum value is100
. Default value is10
. -
The ID of the origin station
-
The ID of the destination station
-
The date and time of the trip in ISO 8601 format in origin station's timezone.
-
bicycles boolean
Only return trips where bicycles are known to be allowed
Default value is
false
. -
dogs boolean
Only return trips where dogs are known to be allowed
Default value is
false
.
GET /trips
curl \
-X GET https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01T09%3A00%3A00Z \
-H "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
"data": [
{
"id": "ea399ba1-6d95-433f-92d1-83f67b775594",
"price": 50,
"origin": "efdbb9d1-02c2-4bc3-afb7-6788d8782b1e",
"operator": "Deutsche Bahn",
"destination": "b2e783e1-c824-4d63-b37a-d8d698862f1d",
"arrival_time": "2024-02-01T16:00:00Z",
"dogs_allowed": true,
"departure_time": "2024-02-01T10:00:00Z",
"bicycles_allowed": true
},
{
"id": "4d67459c-af07-40bb-bb12-178dbb88e09f",
"price": 50,
"origin": "b2e783e1-c824-4d63-b37a-d8d698862f1d",
"operator": "SNCF",
"destination": "efdbb9d1-02c2-4bc3-afb7-6788d8782b1e",
"arrival_time": "2024-02-01T18:00:00Z",
"dogs_allowed": true,
"departure_time": "2024-02-01T12:00:00Z",
"bicycles_allowed": true
}
],
"links": {
"next": "https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01&page=2",
"self": "https://api.example.com/trips?origin=efdbb9d1-02c2-4bc3-afb7-6788d8782b1e&destination=b2e783e1-c824-4d63-b37a-d8d698862f1d&date=2024-02-01"
}
}
Response examples (200)
# Headers
Cache-Control: max-age=3600
RateLimit: limit=10, remaining=0, reset=10
# Payload
<?xml version="1.0" encoding="UTF-8"?>
<root>
<data type="array">
<datum>
<id>4f4e4e1-c824-4d63-b37a-d8d698862f1d</id>
<origin>Berlin Hauptbahnhof</origin>
<destination>Paris Gare du Nord</destination>
<departure-time>2024-02-01T10:00:00Z</departure-time>
<arrival-time>2024-02-01T16:00:00Z</arrival-time>
<operator>Deutsche Bahn</operator>
<price type="integer">50</price>
<bicycles-allowed type="boolean">true</bicycles-allowed>
<dogs-allowed type="boolean">true</dogs-allowed>
</datum>
</data>
<links>
<self>https://example.com</self>
<next>https://example.com</next>
<prev>https://example.com</prev>
</links>
</root>
Response examples (400)
{
"type": "https://example.com/errors/bad-request",
"title": "Bad Request",
"detail": "The request is invalid or missing required parameters.",
"status": 400
}
Response examples (400)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<type>https://example.com/errors/bad-request</type>
<title>Bad Request</title>
<detail>The request is invalid or missing required parameters.</detail>
<status type="integer">400</status>
</root>
Response examples (401)
{
"type": "https://example.com/errors/unauthorized",
"title": "Unauthorized",
"detail": "You do not have the necessary permissions.",
"status": 401
}
Response examples (401)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<type>https://example.com/errors/unauthorized</type>
<title>Unauthorized</title>
<detail>You do not have the necessary permissions.</detail>
<status type="integer">401</status>
</root>
Response examples (403)
{
"type": "https://example.com/errors/forbidden",
"title": "Forbidden",
"detail": "Access is forbidden with the provided credentials.",
"status": 403
}
Response examples (403)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<type>https://example.com/errors/forbidden</type>
<title>Forbidden</title>
<detail>Access is forbidden with the provided credentials.</detail>
<status type="integer">403</status>
</root>
Response examples (429)
{
"type": "https://example.com/errors/too-many-requests",
"title": "Too Many Requests",
"detail": "You have exceeded the rate limit.",
"status": 429
}
Response examples (429)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<type>https://example.com/errors/too-many-requests</type>
<title>Too Many Requests</title>
<detail>You have exceeded the rate limit.</detail>
<status type="integer">429</status>
</root>
Response examples (500)
{
"type": "https://example.com/errors/internal-server-error",
"title": "Internal Server Error",
"detail": "An unexpected error occurred.",
"status": 500
}
Response examples (500)
<?xml version="1.0" encoding="UTF-8"?>
<root>
<type>https://example.com/errors/internal-server-error</type>
<title>Internal Server Error</title>
<detail>An unexpected error occurred.</detail>
<status type="integer">500</status>
</root>