Samtrafiken ACCESS API - Sample catalogue

Samtrafiken ACCESS API - Sample catalogue

Introduction

The examples in this document should be considered as examples and any external references, names etc should not be used for implementation.

Booking flow

Single carrier - 1 passenger no age, 1 passenger age 16, 1 passenger age 5

Result in TRAID

 

image-20241029-131108.png

Samples

Authentication

Please find information on our open API document Samtrafiken ACCESS and DISTRIBUTION API - Integration Handbook | API Authentication

Offers

The Offers Search API searches over 55 carrier to find available trains and buses for a given date and or a given itinerary. The API lets you search journey between two cities. For each itinerary, the API provides a list of available offers with prices, fare details, carrier name, flexibility, travel class, product description, seat reservation information, ancillary offers and fulfillment options.

This API forms the first step in the booking flow.

Offer search - tripSpecification

Search with tripSpecification if you use your own journey planner.
Beyond mandatory elements listed in osdm.io, the following elements are mandatory to add to the request:

  • ptMode

  • productCategory

  • anonymousPassengerSpecifications.externalRef

  • tripSpecifications.externalRef

  • legs.externalRef

  • offerSearchCriteria.offerMode

  • currency: SEK

Departure/Arrival time are always in local time.

Multi carrier (Resplus) - 1 pensioner age 50, 1 student age 25

POST offer request.txt

POST offer response.txt

Multi carrier (Resplus) - 2 passenger no age, SJ loyalty card, SJ annual card

POST offer request.txt

POST offer response.txt

Single carrier - Discount - Corporate agreement - 1 passenger no age

POST offer request.txt

POST offer response.txt

Single carrier - Night train - 2 passenger no age

POST offer request.txt

POST offer response.txt

Wheelchair

POST offer request

Offer search - tripSearchCriteria

Use tripSearchCriteria to get a list of journeys with offer.

Hafas - 1 passenger no age - Uppsala to Stockholm

POST offer request.txt

POST offer response.txt

Wheelchair

POST offer request

POST offer response

 

Booking

The Booking API performs the booking for a chosen departure. The API provides a unique booking ID from Samtrafiken ACCESS API. The booking is in a provisional state until the Fulfillment is completed. The API is used for adding passenger and purchaser details. It is mandatory to add passenger first and last name and email address. It is mandatory to add purchaser first and last name, email and phone number. Some carrier might have other mandatory information not known at time of writing.

It is possible to make a provisional booking without passenger and purchaser details and update the booking with PATCH booking, see examples in Booking flow.

Multi carrier (Resplus) - 1 pensioner age 50, 1 student age 25

POST booking request.txt

POST booking response.txt

Multi carrier (Resplus) - 2 passenger no age, SJ loyalty card, SJ annual card

POST bookings request.txt

POST booking response.txt

Single carrier - Discount - Corporate agreement - 1 passenger no age

POST booking request.txt

POST booking response.txt

Single carrier - Night train - 2 passenger no age

POST booking request.txt

POST booking response.txt

Fulfillment

The Fulfillment API confirms the booking and triggers the fulfillment of the booking.

Multi carrier (Resplus) - 1 pensioner age 50, 1 student age 25

POST fulfillments response.txt

Multi carrier (Resplus) - 2 passenger no age, SJ loyalty card, SJ annual card

POST fulfillment response.txt

Single carrier - Discount - Corporate agreement - 1 passenger no age

POST fulfillment response.txt

Single carrier - Night train - 2 passenger no age

POST fulfillments response.txt

Release (Cancel)

The Release API cancel the admission, ancillary and reservation. No financial transactions are performed with this API.

Single carrier - 1 passenger no age, 1 passenger age 16, 1 passenger age Partial passenger release

GET booking response.txt

POST release offer request.txt

POST release offer response.txt

PATCH release offer request.txt

PATCH release offer response.txt

Result TRAID

image-20241031-154252.png

 

Refund

The Refund API canel the admission, ancillary and reservation and refund the amount according to the flexibility rule of the ticket.

Single carrier - 1 passenger no age, 1 passenger age 16, 1 passenger age 5

GET booking response.txt

POST refund offer request.txt

POST refund offer response.txt

PATCH refund offer request.txt

PATCH refund offer response.txt

Result in TRAID

 

image-20241101-072718.png

On hold

This end point ask the system if it is possible to extend the TTL time for all bookedOffers in a booking. Input parameter is increaseTTL in minutes and return the new possible TTL-time for the booking. If it is not possible to extend TTL-time, the IMS simply return the existing TTL-time.

POST on hold request.txt

POST on hold reponse.txt

POST on hold reponse.txt

Postman collections

Booking flow