# Create booking

This endpoint is used to create a booking within Tyro Connect. Booking partners use this to create a reservation, which will create a booking in the POS system. POS systems use this to notify Tyro Connect about a new walk-in booking, which will create a booking in the App system. The request body shape differs by audience — see the two request examples below.

The id that is returned as a part of the response should be used to identify the booking for subsequent events or retrieving the details via the GET endpoint or during updates via the PATCH endpoint.

Endpoint: POST /bookings
Version: 1.0
Security: JWT

## Header parameters:

  - `Authorization` (string, required)

  - `Accept` (string, required)
    Specifies which version of the API to use. If no value is provided then 0.1 version will be used
    Enum: "application/vnd.tyro.connect+json;version=1.0", "application/vnd.tyro.connect+json;version=0.1"

  - `Content-Type` (string, required)
    Enum: "application/json"

## Response 201 fields (application/json):

  - `id` (string, required)
    The id of the booking in the Tyro Connect system
    Example: "0f448ac1-862a-4c7b-bdb4-a3b7cdbf6149"

  - `locationId` (string, required)
    The id of the location as specified by the Tyro Connect system

  - `origin` (object)
    Information relevant to the booking partner that this booking was created with

  - `origin.name` (string)
    Name of the booking app

  - `origin.bookingReference` (string, required)
    Reference for the booking. It is used to facilitate identification of the booking in the app and pos systems and must be unique per location and booking partner.

  - `asset` (any, required)

  - `bookingStatus` (string)
    The current status of the booking
    Enum: "CREATED", "ACCEPTED", "CANCELLED_BY_CUSTOMER", "CANCELLED_BY_MERCHANT", "REJECTED"

  - `numberOfPeople` (number, required)
    The number of expected guests

  - `payments` (array)
    A list of payments applied to the booking.

  - `payments.amount` (integer)
    This is the amount in cents. e.g 12520 is $125.20

  - `payments.currency` (string)
    This is always AUD
    Enum: "AUD"

  - `payments.description` (string)
    A description of what this payment amount represents
    Example: "Deposit for booking"

  - `startTime` (string)
    The date and time the booking starts at the venue. The format of the date time is the notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)
    Example: "2018-05-02T17:30:00.000Z"

  - `endTime` (string)
    The date and time the booking ends at the venue. The format of the date time is the notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)
    Example: "2018-05-02T18:30:00.000Z"

  - `customer` (object)
    The customer making the booking

  - `customer.id` (string)

  - `customer.name` (string)
    Customer's name

  - `customer.notes` (string)
    Notes specific to the customer. For example, 'Loves red wine'.

  - `customer.email` (string)
    Customer's email address

  - `customer.address` (object)
    The customer address

  - `customer.address.line1` (string)

  - `customer.address.line2` (string)

  - `customer.address.suburb` (string)

  - `customer.address.state` (string)

  - `customer.address.postcode` (string)

  - `customer.address.country` (string)

  - `customer.phoneNumber` (string)
    Customer's phone number

  - `customer.birthday` (string)
    Customer's birthday

  - `notes` (string)
    Notes specific to the booking. Example: 'Window seat please'

  - `reason` (string)
    The reason the booking was rejected or cancelled. Provided only when bookingStatus is REJECTED, CANCELLED_BY_MERCHANT or CANCELLED_BY_CUSTOMER

  - `createdAt` (string)
    The timestamp when the booking was created
    Example: "2022-11-23T22:39:54.931Z"

  - `updatedAt` (string)
    The timestamp when the booking was last updated
    Example: "2022-11-23T22:40:48.237Z"

## Response 400 fields (application/json):

  - `error` (string)
    The validation error message


## Response 403 fields
