> ## Documentation Index
> Fetch the complete documentation index at: https://docs.overviu.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a booking

> Creates a booking with source `api` and status `pending`, priced like the booking site, and returns it with
status 201. The guest is matched to an existing guest of the team with the same email, or created. Dates that
aren't available return 422 with the reason in `errors.availability`; a coupon that doesn't apply returns 422
in `errors.coupon_code`.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/bookings
openapi: 3.1.0
info:
  title: Overviu API
  version: '1.0'
  description: >-
    Read your listings and availability, and create and manage bookings, from
    your own systems. Authenticate with an API token from **Settings → API
    tokens** in Overviu, sent as `Authorization: Bearer <token>`. Endpoints
    under `/v1/public/{teamSlug}` need no token: they serve what your booking
    site shows. Guides and conventions:
    https://docs.overviu.app/api-reference/introduction
servers:
  - url: https://api.overviu.app/api
    description: Production
security:
  - http: []
tags:
  - name: Account
    description: The team an API token belongs to.
  - name: Listings
    description: The team's listings.
  - name: Availability
    description: Prices and availability for dates.
  - name: Bookings
    description: Create, read, change and cancel the team's bookings.
  - name: Guests
    description: The team's guests.
  - name: Public
    description: What a booking site shows, with no token.
paths:
  /v1/bookings:
    post:
      tags:
        - Bookings
      summary: Create a booking
      description: >-
        Creates a booking with source `api` and status `pending`, priced like
        the booking site, and returns it with

        status 201. The guest is matched to an existing guest of the team with
        the same email, or created. Dates that

        aren't available return 422 with the reason in `errors.availability`; a
        coupon that doesn't apply returns 422

        in `errors.coupon_code`.
      operationId: v1.bookings.store
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreBookingRequest'
      responses:
        '201':
          description: '`BookingResource`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/BookingResource'
                required:
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    StoreBookingRequest:
      type: object
      properties:
        listing_id:
          type: string
          format: uuid
        check_in:
          type: string
          format: date
        check_out:
          type: string
          format: date
        number_of_guests:
          type: integer
          minimum: 1
        notes:
          type:
            - string
            - 'null'
          maxLength: 2000
        special_requests:
          type:
            - string
            - 'null'
          maxLength: 2000
        coupon_code:
          type:
            - string
            - 'null'
          maxLength: 40
        guest:
          type: object
          properties:
            name:
              type: string
              maxLength: 200
            email:
              type:
                - string
                - 'null'
              format: email
              maxLength: 200
            phone:
              type:
                - string
                - 'null'
              maxLength: 50
          required:
            - name
      required:
        - listing_id
        - check_in
        - check_out
        - number_of_guests
        - guest
      title: StoreBookingRequest
    BookingResource:
      type: object
      properties:
        id:
          type: string
        confirmation_code:
          type:
            - string
            - 'null'
        listing_id:
          type: string
        unit:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
            name:
              type: string
          required:
            - id
            - name
        whole_building:
          type: boolean
        guest_id:
          type:
            - string
            - 'null'
        status:
          type: string
        source:
          type: string
        check_in:
          type: string
        check_out:
          type: string
        nights:
          type: integer
        number_of_guests:
          type: integer
        currency:
          type: string
        accommodation_total:
          type: integer
        discount_total:
          type: integer
        fees_total:
          type: integer
        taxes_total:
          type: integer
        grand_total:
          type: integer
        price_breakdown:
          type: array
          items: {}
        notes:
          type:
            - string
            - 'null'
        special_requests:
          type:
            - string
            - 'null'
        confirmed_at:
          type: string
        cancelled_at:
          type: string
        completed_at:
          type: string
        created_at:
          type: string
        updated_at:
          type: string
        listing:
          $ref: '#/components/schemas/ListingResource'
        guest:
          $ref: '#/components/schemas/GuestResource'
      required:
        - id
        - confirmation_code
        - listing_id
        - unit
        - whole_building
        - guest_id
        - status
        - source
        - check_in
        - check_out
        - nights
        - number_of_guests
        - currency
        - accommodation_total
        - discount_total
        - fees_total
        - taxes_total
        - grand_total
        - price_breakdown
        - notes
        - special_requests
        - confirmed_at
        - cancelled_at
        - completed_at
        - created_at
        - updated_at
      title: BookingResource
    ListingResource:
      type: object
      properties:
        id:
          type: string
        slug:
          type: string
        kind:
          type: string
        building_id:
          type:
            - string
            - 'null'
        whole_building_bookable:
          type: boolean
        public_title:
          type: string
        nickname:
          type:
            - string
            - 'null'
        status:
          type: string
        property_type:
          type: string
        max_guests:
          type: integer
        bedrooms_count:
          type: integer
        beds_count:
          type: integer
        bathrooms_count:
          type: integer
        bathrooms_half:
          type: boolean
        currency:
          type: string
        timezone:
          type: string
        check_in_time:
          type: string
        check_out_time:
          type: string
        address:
          type: object
          properties:
            street:
              type:
                - string
                - 'null'
            city:
              type:
                - string
                - 'null'
            state:
              type:
                - string
                - 'null'
            postcode:
              type:
                - string
                - 'null'
            country:
              type:
                - string
                - 'null'
            latitude:
              type:
                - string
                - 'null'
            longitude:
              type:
                - string
                - 'null'
          required:
            - street
            - city
            - state
            - postcode
            - country
            - latitude
            - longitude
        headline:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
        photos:
          type: array
          items:
            $ref: '#/components/schemas/ListingPhotoResource'
        created_at:
          type: string
        updated_at:
          type: string
      required:
        - id
        - slug
        - kind
        - building_id
        - whole_building_bookable
        - public_title
        - nickname
        - status
        - property_type
        - max_guests
        - bedrooms_count
        - beds_count
        - bathrooms_count
        - bathrooms_half
        - currency
        - timezone
        - check_in_time
        - check_out_time
        - address
        - headline
        - description
        - created_at
        - updated_at
      title: ListingResource
    GuestResource:
      type: object
      properties:
        id:
          type: string
        name:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
        phone:
          type:
            - string
            - 'null'
        notes:
          type:
            - string
            - 'null'
        created_at:
          type: string
      required:
        - id
        - name
        - email
        - phone
        - notes
        - created_at
      title: GuestResource
    ListingPhotoResource:
      type: object
      properties:
        id:
          type: string
        is_featured:
          type: boolean
        sort_order:
          type: integer
        width:
          type:
            - integer
            - 'null'
        height:
          type:
            - integer
            - 'null'
        thumbnail_url:
          type: string
        medium_url:
          type: string
        original_url:
          type: string
      required:
        - id
        - is_featured
        - sort_order
        - width
        - height
        - thumbnail_url
        - medium_url
        - original_url
      title: ListingPhotoResource
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      description: >-
        An API token from **Settings → API tokens** in Overviu, sent as
        `Authorization: Bearer <token>`.
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.