Switch to dark mode

Error Codes

An operation that fails returns GraphQL errors. Most of them have an extensions property with an error code, which tells you what went wrong and how to handle it. A request that never gets as far as GraphQL fails with an HTTP status or a WebSocket close code instead. See Transport errors.

Extensions

extensions is the part of a GraphQL error that holds extra information. It has the error code, and sometimes args with details that help you find the cause.

json
{
  "errors": [
    {
      "message": "Message describing what went wrong",
      "locations": [{ "line": 6, "column": 7 }],
      "path": ["node", "field", 1, "name"],
      "extensions": {
        "code": "ERROR_CODE",
        "args": {
          "name": "value"
        }
      }
    }
  ]
}

Authentication and authorization

UNAUTHORIZED

The credentials are valid, but they don't allow this operation. This happens when:

  • The API key lacks the base scope for the environment (live or test). Every request with that key is refused, as in the example below. See API Scopes.
  • The key lacks a scope the operation needs, such as orders:read for reading orders. A missing passenger_profiles:read is FORBIDDEN instead.
  • The booking, order or cost center belongs to another sales agent, one you have no access to.
  • passengerProfiles is given a filter.salesAgentUid that names a sales agent you have no access to.
  • An access token is used for an operation outside the ones it allows.
json
{
  "errors": [
    {
      "message": "Provided credentials are not permitted to access the live environment (missing live scope).",
      "extensions": {
        "code": "UNAUTHORIZED"
      }
    }
  ]
}

NOT_AUTHENTICATED

No credentials were sent, or they weren't recognized: the api-key header is missing, the API key is unknown, or the access token has expired or been revoked.

json
{
  "errors": [
    {
      "message": "No or invalid authentication provided! For HTTP requests, use either: (1) `api-key: <your-api-key>` header, or (2) `Authorization: Bearer <jwt-token>` header. For WebSocket connections, provide authentication in the ConnectionInit message payload.",
      "extensions": {
        "code": "NOT_AUTHENTICATED"
      }
    }
  ]
}

USER_TOKEN_MISSING

me, which reads the signed-in user, was called with only an API key. Authenticate the request with a user token (JWT) instead.

json
{
  "errors": [
    {
      "message": "This query requires a user token",
      "extensions": {
        "code": "USER_TOKEN_MISSING"
      }
    }
  ]
}

NOT_AUTHORIZED

The authenticated user is not allowed to perform the action.

json
{
  "errors": [
    {
      "message": "Not authorized",
      "extensions": {
        "code": "NOT_AUTHORIZED"
      }
    }
  ]
}

FORBIDDEN

This happens when:

  • The target sales agent does not allow orders to be created on its behalf: a passenger's cost center belongs to it, or passengerProfiles names it in filter.salesAgentUid. The example below is this case.
  • passengerProfiles, or passengerProfile for any profile but your own, is called with a key that lacks the passenger_profiles:read scope. See API Scopes.
json
{
  "errors": [
    {
      "message": "Target agent does not allow orders",
      "extensions": {
        "code": "FORBIDDEN"
      }
    }
  ]
}

Node and resource lookup

NOT_FOUND

Something the operation needs can't be found.

json
{
  "errors": [
    {
      "message": "Part was not found",
      "extensions": {
        "code": "NOT_FOUND"
      }
    }
  ]
}

INVALID_ID

An id has an invalid format.

json
{
  "errors": [
    {
      "message": "Invalid order id",
      "extensions": {
        "code": "INVALID_ID"
      }
    }
  ]
}

Validation

VALIDATION_ERROR

The input to an operation is invalid, for example when you update a Booking. extensions.validation names the validation rule that failed.

json
{
  "errors": [
    {
      "message": "Passenger date of birth is required",
      "extensions": {
        "code": "VALIDATION_ERROR",
        "validation": "REQUIRED"
      }
    }
  ]
}

Common values of validation:

  • REQUIRED: A required field is missing
  • MISSING_ARGUMENTS: Required arguments are missing

INVALID_ARGUMENT

An argument refers to something that can't be found, such as a cost center that doesn't exist. You also get this code from:

  • passengerProfiles, for a blank filter.query, a first below 1, a cursor from another search, or a filter.salesAgentUid that is not a company in the profile directory.
  • A search or booking whose passengerProfile names a directory that is no profile directory or an id not in that directory's form, or names the same profile on two passengers.
  • passengerProfile, for a reference whose directory is no profile directory or whose id isn't in that directory's form.

A list argument that is too long gets the same code, before anything else in the operation runs. Most lists hold up to 50 items, such as the offers or passengers of a booking. A passenger's travel cards and a search's via points hold 10. The message names the list and its limit, as in "offerIds may hold at most 50 items".

json
{
  "errors": [
    {
      "message": "Cost center not found",
      "extensions": {
        "code": "INVALID_ARGUMENT"
      }
    }
  ]
}

Access token errors

These come from createAccessToken. See Access Tokens for what each argument accepts. Minting can also fail with:

  • NOT_FOUND, for an order you can't read.
  • NOT_AUTHORIZED, when the minting key can't itself do what the token is for.
  • WALLET_NOT_AVAILABLE, for a WRITE token on an order whose cost center is set up for wallet payments but has no wallet.

INVALID_RESTRICTIONS

restrictions names no order. A token is always for exactly one order, so orderId is required.

json
{
  "errors": [
    {
      "message": "restrictions must name an order",
      "extensions": {
        "code": "INVALID_RESTRICTIONS"
      }
    }
  ]
}

INVALID_TTL

ttlSeconds is not between 1 and 86400. Leave the argument out to get the default of 900 seconds.

json
{
  "errors": [
    {
      "message": "ttlSeconds must be between 1 and 86400",
      "extensions": {
        "code": "INVALID_TTL"
      }
    }
  ]
}

INVALID_CAPABILITIES

capabilities is an empty list. A token must grant something, so an empty list is rejected and not treated as the default. Leave the argument out to get [READ].

json
{
  "errors": [
    {
      "message": "capabilities must grant at least one capability",
      "extensions": {
        "code": "INVALID_CAPABILITIES"
      }
    }
  ]
}

Booking and order errors

BOOKING_NOT_FOUND

A mutation was given a booking id that doesn't exist, for example an old id or one from another environment. Create a new booking and retry with its id.

json
{
  "errors": [
    {
      "message": "Booking not found",
      "extensions": {
        "code": "BOOKING_NOT_FOUND"
      }
    }
  ]
}

UNKNOWN

A ticketing provider returned an error that we don't recognize, or one that isn't about the booking itself. It can happen when you create a booking, and when the tickets are pre-booked as you create an order or a payment.

json
{
  "errors": [
    {
      "message": "Unable to process booking",
      "extensions": {
        "code": "UNKNOWN"
      }
    }
  ]
}

NO_TICKETS

One or more of the selected tickets are no longer available. Tickets can sell out between the time you get the offers and the time you create the booking. Request a new JourneyOffer and create the booking again.

extensions.args.originName and extensions.args.destinationName tell you which tickets are no longer available.

json
{
  "errors": [
    {
      "message": "One of the selected tickets are no longer available",
      "extensions": {
        "code": "NO_TICKETS",
        "args": {
          "originName": "London",
          "destinationName": "Paris"
        }
      }
    }
  ]
}

COMPARTMENT_TYPE_UNAVAILABLE

The selected compartment type is not available for the selected journey. Request a new JourneyOffer and create the booking again.

json
{
  "errors": [
    {
      "message": "The selected compartment type is not available",
      "extensions": {
        "code": "COMPARTMENT_TYPE_UNAVAILABLE"
      }
    }
  ]
}

BOOKING_ALREADY_USED

With some ticketing providers, a booking can only be used once. If you create an order or a payment from it and that fails, the booking can't be used for another attempt. Create a new booking and try again.

You also get this code if you change the custom fields of a booking or a passenger after its order is paid or confirmed. There is one error per field, with the field's args.key.

json
{
  "errors": [
    {
      "message": "This booking cannot be used again",
      "extensions": {
        "code": "BOOKING_ALREADY_USED"
      }
    }
  ]
}

BOOKING_UNUSABLE

The booking can't be completed, and retrying won't help. The reservation at the ticketing provider is in a state that it can't recover from. Unlike with BOOKING_ALREADY_USED, a new booking from the same search results is not enough, because it may give you the same broken reservation. Start a new journey search and create a new booking from it.

json
{
  "errors": [
    {
      "message": "This booking can no longer be completed. Please start a new search.",
      "extensions": {
        "code": "BOOKING_UNUSABLE"
      }
    }
  ]
}

PRICE_CHANGED

The price has changed since the selection was made. Request a new JourneyOffer and create the booking again.

json
{
  "errors": [
    {
      "message": "The price has changed since the selection was made",
      "extensions": {
        "code": "PRICE_CHANGED"
      }
    }
  ]
}

SEAT_UNAVAILABLE

The desired seat is not available for booking.

json
{
  "errors": [
    {
      "message": "The desired seat is not available",
      "extensions": {
        "code": "SEAT_UNAVAILABLE"
      }
    }
  ]
}

NOT_ENOUGH_FUNDS

The wallet balance doesn't cover the order total when you finalize an order with finalizeOrder. createOrder doesn't check the balance. Nothing is booked or charged, so you can top up the wallet and finalize the same order again, as long as the booking hasn't expired.

json
{
  "errors": [
    {
      "message": "Not enough funds in wallet",
      "extensions": {
        "code": "NOT_ENOUGH_FUNDS"
      }
    }
  ]
}

ORDER_LOCKED

The order is locked by another operation and cannot be modified at this time.

json
{
  "errors": [
    {
      "message": "Order is locked by other operation.",
      "extensions": {
        "code": "ORDER_LOCKED"
      }
    }
  ]
}

MISSING_CONTACT_PERSON

No passenger has isContactPerson set to true. Exactly one passenger must be the contact person.

json
{
  "errors": [
    {
      "message": "One person must be assigned as the contact person",
      "extensions": {
        "code": "MISSING_CONTACT_PERSON"
      }
    }
  ]
}

MULTIPLE_CONTACT_PERSONS

More than one passenger has isContactPerson set to true. Only one passenger can be the contact person.

json
{
  "errors": [
    {
      "message": "Only one person can be assigned as the contact person",
      "extensions": {
        "code": "MULTIPLE_CONTACT_PERSONS"
      }
    }
  ]
}

RESERVATION_UNAVAILABLE

A seat reservation for part of the journey could not be confirmed. Request a new JourneyOffer and create the booking again.

json
{
  "errors": [
    {
      "message": "A seat reservation for part of this journey could not be confirmed",
      "extensions": {
        "code": "RESERVATION_UNAVAILABLE"
      }
    }
  ]
}

SELECTED_OFFER_UNAVAILABLE

A selected offer is no longer available. Request a new JourneyOffer and create the booking again.

json
{
  "errors": [
    {
      "message": "A selected offer is no longer available. Please try with a new booking.",
      "extensions": {
        "code": "SELECTED_OFFER_UNAVAILABLE"
      }
    }
  ]
}

TICKET_SUPPLIER_FAILURE

The ticket supplier's own booking system rejected or failed the request. This is usually transient, so the same booking can be retried.

json
{
  "errors": [
    {
      "message": "Our ticket supplier failed to complete the booking.",
      "extensions": {
        "code": "TICKET_SUPPLIER_FAILURE"
      }
    }
  ]
}

INVALID_OFFER

One or more of the selected offer ids are invalid or could not be matched to the journey.

json
{
  "errors": [
    {
      "message": "Invalid offer id: ...",
      "extensions": {
        "code": "INVALID_OFFER"
      }
    }
  ]
}

OFFER_UNAVAILABLE

createBooking looks every selected offer up again before it builds the booking, and one or more of them can no longer be sold. Nothing was booked. Request a new JourneyOffer and create the booking from the offers that come back.

json
{
  "errors": [
    {
      "message": "One or more selected offers are no longer available",
      "extensions": {
        "code": "OFFER_UNAVAILABLE"
      }
    }
  ]
}

DUPLICATE_OFFERS_SELECTED

Two or more of the offers passed to createBooking belong to the same segment collection. A booking takes one offer for each part of the journey, so choose between them.

json
{
  "errors": [
    {
      "message": "Multiple offers belong to the same journey",
      "extensions": {
        "code": "DUPLICATE_OFFERS_SELECTED"
      }
    }
  ]
}

OFFER_SET_INCOMPLETE

You selected an offer from an offer set, but not on every leg the set covers. Offers in a set can't be booked on their own. A UK return fare, for example, is priced as a whole, but comes as an offer in one direction and a companion offer at no extra cost in the other. The rule is the same for every set: select an offer from the set on every leg it covers, or on none of them.

The message names the leg that has no offer from the set, by its origin and destination. A leg is a segment collection. The message also says what is wrong with the leg:

  • It is not in the booking at all. Only createBooking reports this, because an update can't remove a leg that the booking already has.
  • It is in the booking, but has no offer selected.
  • It is booked with an offer from outside the set.

There are two ways to fix it:

  • Complete the set: Select an offer from the set on the leg the message names. On a journey that is only sold whole, this means booking every leg.
  • Drop the set: Select an offer from outside the set on each of its legs that you book. This only works when those legs have offers outside the set. If they don't, complete the set.

Use extensions.args.offerSetIds to identify the set, by matching it against the memberOf.id of the offers you were shown. The message itself never contains a set id or an offer id.

If a request breaks more than one set, you get one error per set. Each error names only one leg, so a set that is missing several legs reports them one at a time as you fix them. To avoid that, select an offer on every leg of the set in one call.

When the leg is not in the booking:

json
{
  "errors": [
    {
      "message": "This offer set covers the London Euston – Edinburgh leg, which is not in this booking. Select an offer from the set for every leg it covers, or select nothing from it.",
      "extensions": {
        "code": "OFFER_SET_INCOMPLETE",
        "args": {
          "offerSetIds": ["offer_set_01k2yq..."]
        }
      }
    }
  ]
}

When the leg is in the booking, but has no offer selected:

json
{
  "errors": [
    {
      "message": "This offer set covers the Edinburgh – London Euston leg, which has no offer selected. Select an offer from the set for every leg it covers, or select nothing from it.",
      "extensions": {
        "code": "OFFER_SET_INCOMPLETE",
        "args": {
          "offerSetIds": ["offer_set_01k2yq..."]
        }
      }
    }
  ]
}

When the leg is booked with an offer from outside the set:

json
{
  "errors": [
    {
      "message": "This offer set covers the Edinburgh – London Euston leg, which is booked with an offer outside the set. Select an offer from the set for every leg it covers, or select nothing from it.",
      "extensions": {
        "code": "OFFER_SET_INCOMPLETE",
        "args": {
          "offerSetIds": ["offer_set_01k2yq..."]
        }
      }
    }
  ]
}

OFFER_SET_UNAVAILABLE

You selected an offer from an offer set, but the offers for the other legs the set covers are no longer available. The set can't be completed, so select an offer outside the set for the leg the message names. If that leg has no other offers, request a new JourneyOffer and create the booking again.

Only createBooking returns this code. Updating a booking's selections doesn't.

This is different from OFFER_SET_INCOMPLETE, where there is still an offer you can add to complete the set. Use extensions.args.offerSetIds to identify the set, by matching it against the memberOf.id of the offers you were shown. You get one error per set.

json
{
  "errors": [
    {
      "message": "The other legs this offer set covers are no longer on offer, so it cannot be booked. Select an offer outside the set for the London Euston – Edinburgh leg, or search this journey again.",
      "extensions": {
        "code": "OFFER_SET_UNAVAILABLE",
        "args": {
          "offerSetIds": ["offer_set_01k2yq..."]
        }
      }
    }
  ]
}

OFFER_SET_CONFLICT

You selected offers from two different offer sets that cover the same leg. Both sets can't be completed at the same time, so the combination can't be booked. Select offers from one of the sets only.

extensions.args.offerSetIds has both sets, in no particular order. You get one error per pair of conflicting sets.

json
{
  "errors": [
    {
      "message": "Two offer sets both cover the London Euston – Edinburgh leg and cannot be booked together.",
      "extensions": {
        "code": "OFFER_SET_CONFLICT",
        "args": {
          "offerSetIds": ["offer_set_01k2yq...", "offer_set_01k2yr..."]
        }
      }
    }
  ]
}

NOT_OPTIONAL

The booking part is not optional, so it can't be added or removed.

json
{
  "errors": [
    {
      "message": "Part is not optional and cannot be toggled",
      "extensions": {
        "code": "NOT_OPTIONAL"
      }
    }
  ]
}

INVALID_ANCILLARY_PASSENGER

The passengerId provided for an ancillary does not match any passenger on the booking.

json
{
  "errors": [
    {
      "message": "Ancillary passenger_id does not match any passenger on the booking",
      "extensions": {
        "code": "INVALID_ANCILLARY_PASSENGER"
      }
    }
  ]
}

INVALID_ANCILLARY_PASSENGER_FOR_OFFER

The ancillary cannot be sold to the given passenger because they are not in the offer's set of applicable passengers.

json
{
  "errors": [
    {
      "message": "Ancillary cannot be sold to passenger — not in the offer's applicable passenger set",
      "extensions": {
        "code": "INVALID_ANCILLARY_PASSENGER_FOR_OFFER"
      }
    }
  ]
}

OFFER_NOT_FOUND

The offer id given to setTicketDelivery matches no offer, or the one given to addTaxiRide matches no taxi offer. The id is an Offer.id or a TaxiRideOffer.id, taken from the booking or from the offers you were shown.

json
{
  "errors": [
    {
      "message": "Offer was not found",
      "extensions": {
        "code": "OFFER_NOT_FOUND"
      }
    }
  ]
}

UNAVAILABLE_TICKET_DELIVERY_METHOD

The delivery method given to setTicketDelivery is not one the offer can be issued with. Pick one of the methods in that offer's ticketDelivery.availableOptions. If the offer is the companion of a return fare from a combined journey offer, it has no ticketDelivery. Set the delivery on the full-price offer that shares its memberOf.id instead.

json
{
  "errors": [
    {
      "message": "That ticket delivery method is not available for this offer",
      "extensions": {
        "code": "UNAVAILABLE_TICKET_DELIVERY_METHOD"
      }
    }
  ]
}

TICKET_DELIVERY_CONFLICT

createOrder was refused because offers that the operator delivers together hold different ticket delivery methods. args.offers lists each of those offers with the method it holds. Choose the same method on all of them with setTicketDelivery, then create the order again.

json
{
  "errors": [
    {
      "message": "The offers in this booking that are delivered together have different ticket delivery methods. Choose the same method for all of them.",
      "extensions": {
        "code": "TICKET_DELIVERY_CONFLICT",
        "args": {
          "offers": [
            { "offerId": "offer_01jq3v8k2mfx9t0a7c4r5d6e8h", "method": "E_TICKET" },
            { "offerId": "offer_01jq3v8k2mfx9t0a7c4r5d6e9j", "method": "TICKET_ON_DEPARTURE" }
          ]
        }
      }
    }
  ]
}

PAYMENT_METHOD_NOT_ALLOWED

No payment method is both configured on the cost centers and allowed for the API key used to create the order.

json
{
  "errors": [
    {
      "message": "No payment method is both configured on the cost centers and allowed for this API key",
      "extensions": {
        "code": "PAYMENT_METHOD_NOT_ALLOWED"
      }
    }
  ]
}

WALLET_NOT_AVAILABLE

The cost center is configured for wallet payments but has no wallet.

json
{
  "errors": [
    {
      "message": "The cost center is configured for wallet payments but has no wallet",
      "extensions": {
        "code": "WALLET_NOT_AVAILABLE"
      }
    }
  ]
}

FINALIZE_FAILED

finalizeOrder was refused before anything was booked, for example because the payment for the order couldn't be settled. Nothing was charged. Contact us with the order reference if it keeps happening.

json
{
  "errors": [
    {
      "message": "Finalization failed",
      "extensions": {
        "code": "FINALIZE_FAILED"
      }
    }
  ]
}

Finalization errors from operators

When an operator rejects part of an order during finalizeOrder, the mutation returns one error per failed part. Each one has args.provider and args.orderReference, and one of these codes:

Code Meaning
OFFER_EXPIRED The selected offer expired before the booking could be finalized. Start over with a new search and booking.
BOOKING_EXPIRED The booking expired before it could be finalized. Start over with a new booking.
ALREADY_FINALIZED The operator says the booking is already finalized. Check the order with node before trying anything else.
DUPLICATE_BOOKING The operator rejected the booking as a duplicate of a recent one. Check whether you have already booked the same journey for the same passengers.
UPSTREAM_UNAVAILABLE The operator is temporarily unavailable.
UNKNOWN The operator returned an error we don't recognize.
json
{
  "errors": [
    {
      "message": "The booking expired before it could be finalized",
      "extensions": {
        "code": "BOOKING_EXPIRED",
        "args": {
          "provider": "sj",
          "orderReference": "AAK7Q2M9XP"
        }
      }
    }
  ]
}

If the booking has already passed its expiresAt when you call finalizeOrder, no operator is called. The mutation returns a single BOOKING_EXPIRED error with only args.orderReference, and no args.provider. Start over with a new booking, as above.

ORDER_NOT_PAYABLE

createPayment was called for an order that is already paid, finalized or voided. An order whose earlier payment was canceled or abandoned can still be paid: call createPayment again with the same orderId.

json
{
  "errors": [
    {
      "message": "This order can no longer be paid",
      "extensions": {
        "code": "ORDER_NOT_PAYABLE"
      }
    }
  ]
}

COST_CENTER_NOT_AVAILABLE

A passenger's costCenter doesn't exist, or belongs to another sales agent than the first cost center in the request. All passengers in a booking must have cost centers from the same sales agent, so make one booking for each agent. See Booking for Another Sales Agent.

json
{
  "errors": [
    {
      "message": "This cost center is not available",
      "extensions": {
        "code": "COST_CENTER_NOT_AVAILABLE"
      }
    }
  ]
}

MULTI_COST_CENTER_NOT_SUPPORTED

The passengers in a booking belong to more than one cost center, which isn't enabled for your sales agent. Rail pass bookings never support more than one cost center.

json
{
  "errors": [
    {
      "message": "Multiple cost centers per booking are not supported",
      "extensions": {
        "code": "MULTI_COST_CENTER_NOT_SUPPORTED"
      }
    }
  ]
}

MIXED_COST_CENTER_SPECIFICATION

Some passengers have a non-default costCenter and others have none. When any passenger is assigned to a non-default cost center, every passenger must have one.

json
{
  "errors": [
    {
      "message": "When any passenger specifies a non-default cost center, all passengers must specify one",
      "extensions": {
        "code": "MIXED_COST_CENTER_SPECIFICATION"
      }
    }
  ]
}

MIXED_PAYMENT_METHOD

The cost centers in a booking don't share a payment method. All cost centers in one booking must have at least one payment method in common.

json
{
  "errors": [
    {
      "message": "All cost centers in a booking must share at least one payment method",
      "extensions": {
        "code": "MIXED_PAYMENT_METHOD"
      }
    }
  ]
}

Taxi ride errors

Taxi rides are only available in Sweden, so taxiAvailability returns an empty list for a booking with no station in Sweden. It only fails with BOOKING_NOT_FOUND. The other taxi operations can fail with the codes below.

Getting taxi offers

taxiRideOffers fails with one of these codes:

Code Meaning
AVAILABILITY_NOT_FOUND The availability id matches none on the booking. Read taxiAvailability again.
INVALID_ADDRESS address.coordinates is not a GeoJSON point.
ADDRESS_NOT_SERVED The operator has no such street and number near the coordinates or in the city.
ADDRESS_AMBIGUOUS The operator has several matching addresses. Narrow the address with coordinates or a city.
json
{
  "errors": [
    {
      "message": "The taxi operator has several addresses near the coordinates",
      "extensions": {
        "code": "ADDRESS_AMBIGUOUS"
      }
    }
  ]
}

Adding a taxi

addTaxiRide checks the offer with the operator again, so it can fail with the codes above, with OFFER_NOT_FOUND, or with one of these:

Code Meaning
PASSENGER_NOT_FOUND A passenger id matches no passenger on the booking.
TOO_MANY_RIDERS More passengers than the product's maxPassengers.
CHILD_AGE_REQUIRED The product has a child seat, and childAge is missing.
CHILD_AGE_INVALID The operator takes a child age from 0 to 12.
DUPLICATE_RIDE A passenger already has a ride for this segment end. Remove it first.
PICKUP_TIME_TOO_EARLY, PICKUP_TIME_TOO_LATE The operator no longer allows the offer's pickup time. Get new offers.
TAXI_DISABLED Taxi rides are not enabled for your sales agent.

RIDE_NOT_FOUND

The ride id given to removeTaxiRide matches no ride on the booking. The id is a TaxiRide.id, taken from the booking's taxiRides.

Passenger validation errors

INVALID_AGE

The provided age doesn't match the passenger birth dates.

json
{
  "errors": [
    {
      "message": "The provided age doesn't match the passenger birth dates",
      "extensions": {
        "code": "INVALID_AGE"
      }
    }
  ]
}

AGE_CATEGORY_CHANGED

A passenger's birth date doesn't match the age the offer was priced for, so the passenger now falls into a different passenger type or age category. For tickets this happens when you update passenger details, and for rail passes when you create the order. extensions.args.passengerId identifies the passenger. Price the journey or search for passes again with the right age.

json
{
  "errors": [
    {
      "message": "The birth date does not match the previously selected age",
      "extensions": {
        "code": "AGE_CATEGORY_CHANGED",
        "args": {
          "passengerId": "pax_21rnqr78yp9ax97j4yh5m1n1yt"
        }
      }
    }
  ]
}

PASSENGER_MISMATCH

The passengers you create the booking for aren't the passengers the offers were priced for. They are compared one by one, in the order you send them, on passenger type, age, travel card codes and corporate codes. A card's identifier is not part of the comparison, and the order of a passenger's cards or codes doesn't matter. Price the journey again for the passengers you mean to book, and create the booking from the offers that come back.

json
{
  "errors": [
    {
      "message": "Provided passenger placeholders do not match the passengers the offers were searched for (type, age, travel cards or corporate codes)",
      "extensions": {
        "code": "PASSENGER_MISMATCH"
      }
    }
  ]
}

PASSENGERS_MISSING

createBooking was called without passengers, and the offers don't carry any passengers of their own to fall back on. Send the passengers the offers were priced for.

json
{
  "errors": [
    {
      "message": "Can't create booking without passengers",
      "extensions": {
        "code": "PASSENGERS_MISSING"
      }
    }
  ]
}

PASSENGER_FIELD_MISSING

A required passenger field is missing. extensions.args.field names the field, and extensions.args.passengerId identifies the passenger.

json
{
  "errors": [
    {
      "message": "Missing passenger field birthDate",
      "extensions": {
        "code": "PASSENGER_FIELD_MISSING",
        "args": {
          "field": "birthDate",
          "passengerId": "pax_4gk5wsa62e9cwa3wbbgs1sayh5"
        }
      }
    }
  ]
}

PASSENGER_VALIDATION_FAILED

An operator refused a passenger's details. The message is always the same, so read extensions.args for what to correct, where it is known:

  • field: the field that was refused, such as firstName, lastName or tel.
  • validation: length when the value is too short or too long, with the limits in min and max, or format when it has the wrong shape, sometimes with a hint that describes the right one.
  • passengerId: the passenger concerned. It is left out when the operator doesn't say which passenger it refused.

Any of them can be missing, and args can be empty.

json
{
  "errors": [
    {
      "message": "Passenger validation error",
      "extensions": {
        "code": "PASSENGER_VALIDATION_FAILED",
        "args": {
          "validation": "length",
          "field": "lastName",
          "min": 2,
          "max": 15,
          "passengerId": "pax_4gk5wsa62e9cwa3wbbgs1sayh5"
        }
      }
    }
  ]
}

UNKNOWN_PASSENGER_ERROR

An unknown error occurred while resolving passenger placeholders.

json
{
  "errors": [
    {
      "message": "Unknown passenger error",
      "extensions": {
        "code": "UNKNOWN_PASSENGER_ERROR"
      }
    }
  ]
}

DUPLICATE_PASSENGER_NAME

Two or more passengers share the same name, which some ticketing providers do not allow. The duplicated name is available in extensions.args.name.

json
{
  "errors": [
    {
      "message": "There are duplicates in the passenger names: John Doe",
      "extensions": {
        "code": "DUPLICATE_PASSENGER_NAME",
        "args": {
          "name": "John Doe"
        }
      }
    }
  ]
}

TRAVEL_CARD_FIELD_REQUIRED

A travel card attached to a passenger is missing a field that pricing or booking the journey requires, typically the identifier of an Interrail Pass. It can be returned when fetching a journey offer or when creating the booking. Whether it is required depends on the operators and kinds of train in the journey. extensions.args.field names the field. Nothing was booked, so collect the field and create the booking again with the same offer ids. See Travel Cards.

json
{
  "errors": [
    {
      "message": "Travel card identifier is required.",
      "extensions": {
        "code": "TRAVEL_CARD_FIELD_REQUIRED",
        "args": {
          "field": "identifier"
        }
      }
    }
  ]
}

TRAVEL_CARDS_IMMUTABLE

The travelCards sent for a passenger on updateBooking differ from the ones that passenger already holds. A booking is priced on the cards its passengers hold, so cards are set when you price the journey and create the booking. They can't be changed afterward. Leave travelCards out when updating passengers. Sending the cards the passenger already has is accepted and changes nothing. None of the passenger changes in the failed call are saved. See Travel Cards.

json
{
  "errors": [
    {
      "message": "Travel cards can't be changed on an existing booking. Search again with the right cards and create a new booking.",
      "extensions": {
        "code": "TRAVEL_CARDS_IMMUTABLE"
      }
    }
  ]
}

CORPORATE_CODES_MIXED

The passengers sent to a journey offer or createBooking don't all carry the same corporateCodes. Every passenger in a search or booking is priced on the same agreements. Search and book passengers on different agreements separately. See Corporate Codes.

json
{
  "errors": [
    {
      "message": "Every passenger must carry the same corporate codes. Book passengers on different corporate agreements separately.",
      "extensions": {
        "code": "CORPORATE_CODES_MIXED"
      }
    }
  ]
}

CORPORATE_CODE_OPERATOR_UNKNOWN

The operator of a corporate code names no operator we know. Send the operator's code as listed on Operator, for example aaop_sj. See Corporate Codes.

json
{
  "errors": [
    {
      "message": "Unknown operator aaop_xyz on a corporate code",
      "extensions": {
        "code": "CORPORATE_CODE_OPERATOR_UNKNOWN"
      }
    }
  ]
}

CORPORATE_CODES_IMMUTABLE

The corporateCodes sent for a passenger on updateBooking differ from the ones that passenger already holds. A booking is priced on its passengers' codes, so codes are set when you price the journey and create the booking. They can't be changed afterward. Leave corporateCodes out when updating passengers. Sending the codes the passenger already has is accepted and changes nothing. None of the passenger changes in the failed call are saved. See Corporate Codes.

json
{
  "errors": [
    {
      "message": "Corporate codes can't be changed on an existing booking. Search again with the right codes and create a new booking.",
      "extensions": {
        "code": "CORPORATE_CODES_IMMUTABLE"
      }
    }
  ]
}

Rail pass errors

INVALID_COUNTRY_FOR_PASS

The selected pass is not valid in the passenger's country of residence.

json
{
  "errors": [
    {
      "message": "The selected type of pass is not valid in the passenger's country of residence",
      "extensions": {
        "code": "INVALID_COUNTRY_FOR_PASS"
      }
    }
  ]
}

RESIDENCE_MATCHES_PASS_COUNTRY

A One Country Pass cannot be used by a passenger whose country of residence is the same as the pass's country. Choose a Global Pass or a pass for a different country.

json
{
  "errors": [
    {
      "message": "A One Country Pass can't be used in the passenger's own country of residence. Choose a Global Pass or a pass for a different country.",
      "extensions": {
        "code": "RESIDENCE_MATCHES_PASS_COUNTRY"
      }
    }
  ]
}

COUNTRY_NOT_ELIGIBLE_FOR_PASS

The pass can't be sold to residents of the passenger's country of residence. Some passes are only sold to residents of listed countries. When we can tell which passenger it is, extensions.args.passengerId identifies them. Choose a different pass, or correct the passenger's country of residence.

json
{
  "errors": [
    {
      "message": "This pass cannot be sold to residents of the passenger's country of residence",
      "extensions": {
        "code": "COUNTRY_NOT_ELIGIBLE_FOR_PASS",
        "args": {
          "passengerId": "pax_3x7rfn572b9t5bdm1fba61x6t7"
        }
      }
    }
  ]
}

NO_COUNTRY_PROVIDED

No country of residence was provided for a passenger.

json
{
  "errors": [
    {
      "message": "No country of residence was provided",
      "extensions": {
        "code": "NO_COUNTRY_PROVIDED"
      }
    }
  ]
}

CAMPAIGN_CLOSED

The selected campaign deal is no longer available.

json
{
  "errors": [
    {
      "message": "The selected campaign deal is no longer available",
      "extensions": {
        "code": "CAMPAIGN_CLOSED"
      }
    }
  ]
}

CAMPAIGN_NOT_FOUND

The campaign with the given ID does not exist.

json
{
  "errors": [
    {
      "message": "The campaign with the given id does not exist",
      "extensions": {
        "code": "CAMPAIGN_NOT_FOUND"
      }
    }
  ]
}

PASS_UNAVAILABLE

The selected pass is no longer available.

json
{
  "errors": [
    {
      "message": "The selected pass is not available",
      "extensions": {
        "code": "PASS_UNAVAILABLE"
      }
    }
  ]
}

Journey search errors

LOCATION_NOT_FOUND

A location with the given UID could not be resolved.

json
{
  "errors": [
    {
      "message": "Could not resolve location e:...",
      "extensions": {
        "code": "LOCATION_NOT_FOUND"
      }
    }
  ]
}

LOCATIONS_EQUAL

Equal origin and destination locations were provided.

json
{
  "errors": [
    {
      "message": "Equal origin and destination given",
      "extensions": {
        "code": "LOCATIONS_EQUAL"
      }
    }
  ]
}

PLACEHOLDER_PASS_CODES_UNAVAILABLE

Tickets for the requested route can't be looked up at the moment. Try again later.

json
{
  "errors": [
    {
      "message": "Unable to look up tickets for this route at the moment. Please try again later.",
      "extensions": {
        "code": "PLACEHOLDER_PASS_CODES_UNAVAILABLE"
      }
    }
  ]
}

Passenger profile errors

NO_PROFILE_DIRECTORY

Your sales agent has no profile directory, so passengerProfiles has nothing to search. A search or booking that names a passenger profile, and the passengerProfile query, get the same error, and so does one whose passengerProfile.directory names a profile directory your sales agent isn't set up with, even when it has another. Retrying won't help. Contact team@allaboard.eu if your sales agent should have a profile directory.

In the same situation, the signed-in user's me.profile is null and not an error.

json
{
  "errors": [
    {
      "message": "The sales agent has no profile directory to search",
      "path": ["passengerProfiles"],
      "extensions": {
        "code": "NO_PROFILE_DIRECTORY"
      }
    }
  ]
}

PASSENGER_PROFILE_NOT_FOUND

A search or booking names a passenger profile that doesn't exist, or one you may not book for. The two aren't told apart.

json
{
  "errors": [
    {
      "message": "Passenger profile not found",
      "extensions": {
        "code": "PASSENGER_PROFILE_NOT_FOUND"
      }
    }
  ]
}

CUSTOM_FIELD_UNKNOWN

A custom field change names a key that the booking or passenger has no field for. You can change the values of the existing fields, but not add new ones.

Like every custom field error, this one comes once per field, with args.key and, for a passenger's field, args.passengerId. Nothing in the call is saved.

json
{
  "errors": [
    {
      "message": "There is no custom field 9b2d…. Only the value of a custom field that is there can be changed.",
      "path": ["updateBooking"],
      "extensions": {
        "code": "CUSTOM_FIELD_UNKNOWN",
        "args": {
          "passengerId": "pax_3x7rfn572b9t5bdm1fba61x6t7",
          "key": "a5ce944d-5a44-471c-b1ef-ea90b1400331"
        }
      }
    }
  ]
}

CUSTOM_FIELD_READ_ONLY

The custom field is readonly for you, so its value can't be changed. Sending back the value it already holds is not an error.

json
{
  "errors": [
    {
      "message": "The custom field 9b2d… is read-only for you.",
      "path": ["setCustomFields"],
      "extensions": {
        "code": "CUSTOM_FIELD_READ_ONLY",
        "args": { "key": "9b2d…" }
      }
    }
  ]
}

CUSTOM_FIELD_VALUE_INVALID

The value doesn't fit the custom field's type: send a Boolean for BOOLEAN, a YYYY-MM-DD date for DATE, the value of one of its options for SELECT, and text otherwise.

json
{
  "errors": [
    {
      "message": "The value of custom field 9b2d… does not fit its type: a boolean for BOOLEAN, a date (YYYY-MM-DD) for DATE, the value of one of its options for SELECT, and text otherwise.",
      "path": ["setCustomFields"],
      "extensions": {
        "code": "CUSTOM_FIELD_VALUE_INVALID",
        "args": { "key": "9b2d…" }
      }
    }
  ]
}

CUSTOM_FIELD_DUPLICATE

The same custom field key is sent more than once in one change.

json
{
  "errors": [
    {
      "message": "The custom field 9b2d… is named more than once.",
      "path": ["setCustomFields"],
      "extensions": {
        "code": "CUSTOM_FIELD_DUPLICATE",
        "args": { "key": "9b2d…" }
      }
    }
  ]
}

CUSTOM_FIELD_REQUIRED

createOrder is refused while a required custom field that you can fill is empty, on the booking or on a passenger. There is one error per empty field, with args.key, args.label and, for a passenger's field, args.passengerId. Fill them in and create the order again.

json
{
  "errors": [
    {
      "message": "The custom field Cost Center is required",
      "path": ["createOrder"],
      "extensions": {
        "code": "CUSTOM_FIELD_REQUIRED",
        "args": {
          "label": "Cost Center",
          "passengerId": "pax_3x7rfn572b9t5bdm1fba61x6t7",
          "key": "a5ce944d-5a44-471c-b1ef-ea90b1400331"
        }
      }
    }
  ]
}

Timetable errors

OUTSIDE_TIMETABLE

There is no timetable for the search date yet. Operators release new timetables at different intervals, just as they do with tickets. This error is most common around the end of the year, when timetables and booking horizons can be shorter than usual.

json
{
  "errors": [
    {
      "message": "The timetable for the given date is not available yet",
      "extensions": {
        "code": "OUTSIDE_TIMETABLE"
      }
    }
  ]
}

DATE_IN_PAST

The search date is in the past.

json
{
  "errors": [
    {
      "message": "Search date is in the past",
      "extensions": {
        "code": "DATE_IN_PAST"
      }
    }
  ]
}

Refund errors

ALREADY_REFUNDED

The order is already refunded.

json
{
  "errors": [
    {
      "message": "Order is already refunded.",
      "extensions": {
        "code": "ALREADY_REFUNDED"
      }
    }
  ]
}

REFUND_ALREADY_IN_PROGRESS

A refund is already in progress for this order.

json
{
  "errors": [
    {
      "message": "A refund is already in progress.",
      "extensions": {
        "code": "REFUND_ALREADY_IN_PROGRESS"
      }
    }
  ]
}

REFUND_EXPIRED

The refund has expired.

json
{
  "errors": [
    {
      "message": "Refund has expired.",
      "extensions": {
        "code": "REFUND_EXPIRED"
      }
    }
  ]
}

REFUND_INVALID

The refund is invalid.

json
{
  "errors": [
    {
      "message": "Refund is invalid.",
      "extensions": {
        "code": "REFUND_INVALID"
      }
    }
  ]
}

UNEXPECTED_REFUND_STATE

The refund is in an unexpected state and cannot be processed.

json
{
  "errors": [
    {
      "message": "Refund is in an unexpected state",
      "extensions": {
        "code": "UNEXPECTED_REFUND_STATE"
      }
    }
  ]
}

NO_ITEMS_SELECTED

No items were selected for the refund.

json
{
  "errors": [
    {
      "message": "No items selected for refund",
      "extensions": {
        "code": "NO_ITEMS_SELECTED"
      }
    }
  ]
}

WALLET_CREDIT_FAILED

The refund was processed, but the wallet could not be credited. Contact support.

json
{
  "errors": [
    {
      "message": "Refund was processed successfully but failed to credit the wallet. Please contact support.",
      "extensions": {
        "code": "WALLET_CREDIT_FAILED"
      }
    }
  ]
}

Other errors

NO_MATCH

No matching journey was found.

json
{
  "errors": [
    {
      "message": "Unable to find a matching trip",
      "extensions": {
        "code": "NO_MATCH"
      }
    }
  ]
}

VALIDATION_FAILED

Order validation failed. This is a general validation error that may occur during order creation.

json
{
  "errors": [
    {
      "message": "Order validation failed",
      "extensions": {
        "code": "VALIDATION_FAILED"
      }
    }
  ]
}

RATE_LIMITED

The request was rate limited. These are limited per sales agent:

  • Journey searches and timetable lookups.
  • finalizeOrder: 20 orders per minute by default, counting failed attempts. The message is "Too many orders finalized in a short time, retry later." Nothing was booked or charged, so queue your finalizations and retry the same order.

When you price with journeyOffer, a rate-limited leg is not an error. The leg has the status RATE_LIMITED instead. See Rate limits for how to read your current limits.

json
{
  "errors": [
    {
      "message": "You have been rate limited.",
      "extensions": {
        "code": "RATE_LIMITED"
      }
    }
  ]
}

UPSTREAM_UNAVAILABLE

A service the request depends on could not be reached or did not answer. Nothing in the request needs correcting, so try again later. The service can be:

  • An operator, when finalizeOrder books a part of the order. The error has args.provider and args.orderReference. See Finalization errors from operators.
  • The profile directory, when passengerProfiles could not search it or the passengerProfile query could not read the profile, as in the example below, or when a search or booking could not read a passenger profile it names or its custom fields. The signed-in user's me.profile is null in that case rather than an error.
  • A service behind the API itself, on any request. The error then has args.status or args.closeCode.
json
{
  "errors": [
    {
      "message": "The profile directory could not be searched",
      "path": ["passengerProfiles"],
      "extensions": {
        "code": "UPSTREAM_UNAVAILABLE"
      }
    }
  ]
}

INTERNAL_ERROR

Something failed on our side, and the failure has been reported to us. There is nothing to correct in the request, so retry it later. If you contact support, include args.requestId so that we can find the failure. It can be null, over HTTP as well as over a WebSocket, because some operations run without a request id.

The message is always the same sentence, and doesn't describe the failure.

json
{
  "errors": [
    {
      "message": "Something went wrong on our side. Please try again in a moment.",
      "extensions": {
        "code": "INTERNAL_ERROR",
        "args": {
          "requestId": "F9-8OGZUbvcJmDsAAAmB"
        }
      }
    }
  ]
}

TIMEOUT

The operation waited too long for a service behind it, usually a rail provider, and gave up. The work it started may have completed anyway, so read the booking or order again before you retry. As with INTERNAL_ERROR, include args.requestId if you contact support, when it isn't null.

json
{
  "errors": [
    {
      "message": "The request timed out. Please try again.",
      "extensions": {
        "code": "TIMEOUT",
        "args": {
          "requestId": "F9-8OGZUbvcJmDsAAAmB"
        }
      }
    }
  ]
}

Transport errors

A request that fails before any GraphQL runs has no errors list to read. Over HTTP it is answered with a status code and a plain-text body, and on a WebSocket the connection is closed with a code.

HTTP status codes

Status When
400 The request asks to upgrade to something other than a WebSocket
404 The path is not /, the only path the API answers on
426 A WebSocket handshake doesn't offer the graphql-transport-ws subprotocol
500 The request could not be read, for example a POST whose body isn't JSON or that lacks the Content-Type: application/json header

Everything else, a failed operation included, is answered with 200 and the errors in the body.

WebSocket close codes

Code When
4499 The client stopped answering pings. The API sends a ping message every 12 seconds and expects a pong back within a few seconds
4400, 4401, 4408, 4409 and 4429 The client broke the graphql-transport-ws protocol, which defines each code: a subscription before the connection was acknowledged, for example
1011 Something failed on our side while an operation ran. The close reason carries a message

After any of them, open a new connection and subscribe again. See Subscriptions and Streaming for how to connect.