This is the public API documentation, used by our iOS, Android and web apps.

This is the documentation for version 1.0 of the API. Last update on Apr 30, 2020.

Base URL
http://api.mycompany.com/v1

Book a trip

Book a trip.

Body
Responses
  • 200 object

    Booked trip

    • id string(uuid)
    • trip_id string(uuid)
    • cents string
    • status string

      Values are booked, canceled, and paid.

POST /books
curl \
 -X POST http://api.mycompany.com/v1/books \
 -H "Content-Type: application/json" \
 -d '{"trip_id":"string","voucher_code":"string"}'
Request example
{
  "trip_id": "string",
  "voucher_code": "string"
}
Response example (200)
{
  "id": "string",
  "trip_id": "string",
  "cents": "string",
  "status": "booked"
}

Body
Responses
POST /payments
curl \
 -X POST http://api.mycompany.com/v1/payments \
 -H "Content-Type: application/json" \
 -d '{"book_id":"string","payment_token":"string","cents":"string"}'
Request example
{
  "book_id": "string",
  "payment_token": "string",
  "cents": "string"
}
Response example (200)
{
  "id": "string",
  "book_id": "string",
  "cents": "string",
  "status": "string",
  "": "string"
}

Search for a train trip

Search for an available train trip between 2 stations, around a given departure date & time.

Body
Responses
POST /search
curl \
 -X POST http://api.mycompany.com/v1/search \
 -H "Content-Type: application/json" \
 -d '{"departure_station":"string","destination_station":"string","departure_around":"2021-05-04T09:42:00+00:00"}'
Request example
{
  "departure_station": "string",
  "destination_station": "string",
  "departure_around": "2021-05-04T09:42:00+00:00"
}
Response example (200)
[
  {
    "id": "string",
    "departure_station": "string",
    "arrival_station": "string",
    "departure_at": "string",
    "arrival_at": "string",
    "cents": "string",
    "train_code": "string"
  }
]