Create a booking

Create a booking from a locked fare. fareId must come from GET /v1/{vertical}/search/{sessionId}/fares/{fareId}.

When tripId is supplied, a TripSegment record is persisted linking this booking to its parent trip.

The Idempotency-Key header is required, but creates are not deduplicated on it: a repeated request creates another booking, whatever its key. The create is sent to the provider once and is not re-sent after a provider error or timeout. After a 503 the provider may still hold a booking from the failed attempt. Its id is not returned, and it is not charged unless it is confirmed: payment is taken only by confirm. Retrying creates a new booking.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Path Params
string
enum
required
Allowed:
Body Params

Request body for creating a booking.

fareId must be a locked fare ID returned by
GET /v1/{vertical}/search/{sessionId}/fares/{fareId}.

The Idempotency-Key header is required, but creates are not
deduplicated on it: a repeated request creates another booking, whatever
its key. After a 503 the provider may still hold a booking from the
failed attempt. Its id is not returned and it is not charged unless it is
confirmed; retrying creates a new booking. Confirm only the booking id a
create returned.

string
required

Locked fare ID from the search session.

passengers
array of objects

Passenger details. Exactly one adult must have isHolder=true.

Passengers
extraServices
array of objects
deprecated

Deprecated: send all ancillary selections via ancillaries. Still accepted for back-compat; ancillaries takes precedence.

Extraservices
array | null

Unified ancillary selection input. Each item: {id, quantity, passenger_id}. Takes precedence over extraServices when both are provided. For cars, both booking-flow and pay-at-desk selections go here; Mercury routes each to the correct provider bucket by its ancillary kind, so requestServices is no longer needed.

requestServices
array of objects
deprecated

Deprecated (cars only): pay-at-desk selections now belong in the unified ancillaries field, which Mercury routes by ancillary kind. Still accepted for back-compat.

Requestservices

Optional trip to associate this booking with. When provided, a TripSegment record is persisted linking the booking to the trip.

Whether this is a personal (non-business) booking.

Contact phone number for the booking.

Invoice profile to use for this booking. Omitting the key and sending an explicit null are equivalent: Mercury resolves both to the account's first available invoice profile (the same list GET /v1/invoice-profiles/booking returns) before the request reaches the provider, so neither shape is ever forwarded to the provider as a null or missing value. A client that has already defaulted this field to null (for example a generated TypeScript client with no way to omit an optional key it has serialized) still gets auto-resolution — it does not need to strip the key to opt in. When the account has no invoice profile at all, booking creation fails with a 422 NO_INVOICE_PROFILE error before any provider call is made — no booking is created and no fiscal documents are issued. Do not assume a newly created guest-checkout account (from the magic-link exchange) has a default invoice profile at the moment of its first booking — Mercury's own account provisioning does not create one, so that first booking should be expected to hit this error unless a real invoiceProfileId is supplied explicitly. Whichever profile is resolved cannot be changed after create — there is no way to point an existing booking at a different profile. Whether an edit to this profile (PATCH /v1/invoice-profiles/{id}) made after this booking is created — including appending an emailRecipients entry — is reflected in the invoice this booking eventually generates is not currently documented or guaranteed. Do not design a flow that depends on a post-create edit reaching this booking's invoice.

Billing address to associate with this booking. Omitting the key and sending an explicit null are equivalent, following the same null-as-absent rule as invoiceProfileId: both are resolved from the resolved invoice profile's default billing address before the request reaches the provider. That defaulting applies to stays and flights; for cars and trains the key is left off the request to the provider entirely rather than sent as null.

A flight booking needs a billing address to be confirmed. The provider requires one to finalize and reports it missing only at POST /v1/flights/bookings/{id}/confirm, by which point the booking already exists and can never be confirmed. So when a flight create resolves no billing address — none sent here, and the resolved invoice profile has no default — it fails with 422 BILLING_ADDRESS_REQUIRED (recoveryAction: FIX_INPUT, field error on this field) before any provider call, and no booking is created. Send a billingAddressId from GET /v1/billing/addresses, or an invoiceProfileId whose defaultBillingAddressId is set. A newly provisioned guest-checkout account has neither, so a guest flight booking must supply this field. Cars, trains and stays are not subject to this check.

object | null

Answers to the account's custom fields for this vertical, keyed by definition key (from GET /v1/custom-fields). Values: string for text/single_select (option key) and date (YYYY-MM-DD), list of option keys for multi_select. Answers are validated against the account's definitions; any invalid answer fails the request with a field-level 422. An empty value ("" or []) means unanswered and is stripped at the boundary, so it is treated identically to omitting the key.

length ≤ 2000

A message for the approver, for a traveler whose company requires one on bookings that need approval (see approvalMessageRequired on GET /v1/profile/identity). Passed on to the approver, stored on the booking and returned as approvalMessage on its detail. Optional; blank counts as missing. When the company requires one and it is missing, create fails with 422 APPROVAL_MESSAGE_REQUIRED.

Headers

Client-generated idempotency key (UUID v4 recommended). Required on all booking mutation requests. Whether a repeated key replays the first response depends on the operation; see its description and the idempotency and retries guide.

Responses

401

Missing or invalid authentication

403

User lacks booking capability for this vertical

404

Referenced fare or tripId does not exist / is not accessible to the authenticated account

409

Booking already exists (conflict)

410

Offer expired (OFFER_EXPIRED); refresh fare search

422

Validation error, missing Idempotency-Key header, missing passenger document, missing custom attributes, or APPROVAL_MESSAGE_REQUIRED

503

Booking service not configured or temporarily unavailable

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json