---
title: "Create a booking"
method: POST
path: "/bookings"
tags: ["Bookings"]
---

# Create a booking

`POST /bookings`

A booking is a temporary hold on a trip. It is not confirmed until the payment is processed.

## Request body

- Booking — A booking for a train trip.
  - `id` string, uuid — Unique identifier for the booking
  - `trip_id` string, uuid — Identifier of the booked trip
  - `passenger_name` string — Name of the passenger
  - `has_bicycle` boolean — Indicates whether the passenger has a bicycle.
  - `has_dog` boolean — Indicates whether the passenger has a dog.

## Response `201`

Booking successful

- object — A booking for a train trip.
  - `id` string, uuid — Unique identifier for the booking
  - `trip_id` string, uuid — Identifier of the booked trip
  - `passenger_name` string — Name of the passenger
  - `has_bicycle` boolean — Indicates whether the passenger has a bicycle.
  - `has_dog` boolean — Indicates whether the passenger has a dog.
  - `links` LinksSelf — The link to the current resource.
    - `self` string, uri

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `409` — Conflict
- `429` — Too Many Requests
- `500` — Internal Server Error

## Changes

- **2024-10-16** `5c1810762d13` — 6 breaking
  - the response's body type/format changed from ``/`` to `object`/`` for status `400` (media type: application/problem+json)
  - the response's body type/format changed from ``/`` to `object`/`` for status `401` (media type: application/problem+json)
  - the response's body type/format changed from ``/`` to `object`/`` for status `404` (media type: application/problem+json)
  - the response's body type/format changed from ``/`` to `object`/`` for status `409` (media type: application/problem+json)
  - …2 more
- **2024-03-06** `586db3b230d3` — 2 breaking, 2 warning, 12 info
  - the request's body type/format changed from ``/`` to `object`/`` (media type: application/json)
  - the request's body type/format changed from ``/`` to `object`/`` (media type: application/xml)
  - removed `#/components/schemas/Wrapper-Resource, subschema #2` from the request body `allOf` list (media type: application/json)
  - removed `#/components/schemas/Wrapper-Resource, subschema #2` from the request body `allOf` list (media type: application/xml)
  - …12 more
- **2024-02-21** `ec0452670099` — 1 info
  - endpoint added
- **2024-02-02** `fa29befd1880` — 1 breaking
  - api removed without deprecation
- **2024-02-01** `5be56a36b7e0` — 2 info
  - added the non-success response with the status `429`
  - added the non-success response with the status `500`

[Change history](https://skmtc.dev/bump-sh-examples/apis/train-travel-api/changes/bookings/post.md)

---

[API](https://skmtc.dev/bump-sh-examples/apis/train-travel-api.md) · [All operations](https://skmtc.dev/bump-sh-examples/apis/train-travel-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/bump-sh-examples/train-travel-api/revisions/f98baa492089/schema)
