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

# Create a new booking

> Creates a single booking. Each service line must reference an existing order + order item (orderId + orderItemId) to draw down — create and pay for an order first. Location fields depend on locationType: TRAVEL_ZONE requires locationId, latitude, longitude, and a structured address; PHYSICAL requires only locationId; VIRTUAL requires none. Local-time fields are derived server-side from bookingTz and must not be sent. The order need not be paid (credits exist from order creation), but a CANCELLED order books nothing (409 ORDER_CANCELLED): its cascade has already released its credits.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/projects/{projectId}/bookings
openapi: 3.0.0
info:
  title: MarketBox 2.0 Open API
  version: 1.0.0
  description: >-
    The MarketBox public API for building booking experiences. Core model:
    create an order, then draw its order items down into bookings. Single
    bookings reference an order item per service line; package bookings draw one
    PACKAGE item down across N sessions. To schedule a package, build a slate
    (POST /availability/package-slate) and book it by slateId (POST
    /orders/{orderId}/package-bookings). See the guides for end-to-end
    walkthroughs.
  contact:
    name: MarketBox support
servers:
  - url: https://apiv2.gomarketbox.com
    description: MarketBox Open API
security:
  - ApiKeyAuth: []
paths:
  /v1/projects/{projectId}/bookings:
    post:
      tags:
        - Bookings
      summary: Create a new booking
      description: >-
        Creates a single booking. Each service line must reference an existing
        order + order item (orderId + orderItemId) to draw down — create and pay
        for an order first. Location fields depend on locationType: TRAVEL_ZONE
        requires locationId, latitude, longitude, and a structured address;
        PHYSICAL requires only locationId; VIRTUAL requires none. Local-time
        fields are derived server-side from bookingTz and must not be sent. The
        order need not be paid (credits exist from order creation), but a
        CANCELLED order books nothing (409 ORDER_CANCELLED): its cascade has
        already released its credits.
      parameters:
        - schema:
            type: string
            minLength: 1
            description: >-
              The project (tenant) that owns the resource. Every resource in
              this API is scoped to a project, and your API key is restricted to
              the projects it was issued for — a project outside that scope
              returns 403.
            example: prj_01kv60qgnef2kt3pvqgwmkbzfr
          required: true
          description: >-
            The project (tenant) that owns the resource. Every resource in this
            API is scoped to a project, and your API key is restricted to the
            projects it was issued for — a project outside that scope returns
            403.
          name: projectId
          in: path
      requestBody:
        description: Booking data
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                supplierId:
                  type: string
                  minLength: 1
                  description: Assigned supplier. Omit to create an unassigned booking.
                  example: sup_01kv60qgnef2kt3pvqgwmkbzfr
                clientId:
                  type: string
                  minLength: 1
                  description: The client this booking is for.
                  example: cli_01kv8p20m1gnqvxl92xln6awk8
                bookingStartUtc:
                  type: string
                  format: date-time
                  description: Start time in UTC (ISO 8601).
                  example: '2026-07-09T13:30:00.000Z'
                bookingEndUtc:
                  type: string
                  format: date-time
                  description: End time in UTC (ISO 8601). Must be after start.
                  example: '2026-07-09T14:00:00.000Z'
                bookingTz:
                  type: string
                  minLength: 1
                  description: >-
                    IANA timezone the booking occurs in; local-time fields are
                    derived from this.
                  example: America/Toronto
                locationType:
                  type: string
                  enum:
                    - PHYSICAL
                    - VIRTUAL
                    - TRAVEL_ZONE
                  description: >-
                    VIRTUAL, PHYSICAL, or TRAVEL_ZONE. Determines which location
                    fields are required.
                  example: TRAVEL_ZONE
                locationId:
                  type: string
                  nullable: true
                  minLength: 1
                  description: >-
                    For PHYSICAL: the Location id. For TRAVEL_ZONE: the
                    supplierTravelZoneId. Null for VIRTUAL.
                  example: stz_01kv60qgs4e4nbjhzradnqtj0h
                latitude:
                  type: number
                  nullable: true
                  description: >-
                    Client latitude. Required for TRAVEL_ZONE; must be omitted
                    for PHYSICAL/VIRTUAL.
                  example: 43.6532
                longitude:
                  type: number
                  nullable: true
                  description: >-
                    Client longitude. Required for TRAVEL_ZONE; must be omitted
                    for PHYSICAL/VIRTUAL.
                  example: -79.3832
                address:
                  type: object
                  nullable: true
                  properties:
                    addressOneLine:
                      type: string
                      minLength: 1
                      description: >-
                        The whole address on one line, as a person would write
                        it.
                      example: 10 Main St, Toronto, ON M5V 1A1, Canada
                    streetNumber:
                      type: string
                      minLength: 1
                      description: The street number.
                      example: '10'
                    streetName:
                      type: string
                      minLength: 1
                      description: The street name.
                      example: Main St
                    city:
                      type: string
                      minLength: 1
                      description: The city or town.
                      example: Toronto
                    state:
                      type: string
                      minLength: 1
                      description: >-
                        The state, province or region; an ISO 3166-2 code when
                        one matches.
                      example: 'ON'
                    country:
                      type: string
                      minLength: 1
                      description: >-
                        The country; ISO 3166-1 alpha-2, alpha-3 or the English
                        name.
                      example: CA
                    zipCode:
                      type: string
                      minLength: 1
                      description: The postal or ZIP code, in any national format.
                      example: M5V 1A1
                    unitNumber:
                      type: string
                      nullable: true
                      description: The unit, suite or apartment, if any.
                      example: 4B
                  required:
                    - addressOneLine
                    - streetNumber
                    - streetName
                    - city
                    - state
                    - country
                    - zipCode
                  description: >-
                    Structured client address. Required for TRAVEL_ZONE
                    bookings.
                capacity:
                  type: integer
                  minimum: 0
                  exclusiveMinimum: true
                  default: 1
                  description: Max participants for this booking.
                  example: 1
                services:
                  type: array
                  items:
                    type: object
                    properties:
                      serviceId:
                        type: string
                        minLength: 1
                        description: The service being booked.
                        example: srv_01kv60qg12e82acr78edfnjhvv
                      offeringId:
                        type: string
                        minLength: 1
                        description: The specific offering (variant) of the service.
                        example: off_01kv60qge5eh59ap0gw0pqrrys
                      businessModelType:
                        type: string
                        enum:
                          - SINGLE_BOOKING
                          - PACKAGE
                          - SCHEDULED_PACKAGE
                          - SCHEDULED_SUBSCRIPTION
                          - FLEXIBLE_SUBSCRIPTION
                        description: How the service is sold (e.g. SINGLE_BOOKING).
                        example: SINGLE_BOOKING
                      quantity:
                        type: integer
                        minimum: 0
                        exclusiveMinimum: true
                        default: 1
                        description: How many units of the order item this line draws down.
                        example: 1
                      orderId:
                        type: string
                        minLength: 1
                        description: The order that paid for this line.
                        example: ord_01kx16ek2jf4r9da74adf6m4h0
                      orderItemId:
                        type: string
                        minLength: 1
                        description: The specific order item (SINGLE_SESSION) to draw down.
                        example: oi_01kx16ek2kf2fsc9x7b2n1dfc9
                    required:
                      - serviceId
                      - offeringId
                      - businessModelType
                      - orderId
                      - orderItemId
                  minItems: 1
                  description: One line per service booked; each draws down an order item.
                notes:
                  type: array
                  items:
                    type: object
                    properties:
                      scope:
                        type: string
                        enum:
                          - BOOKING
                          - BOOKING_SERVICE
                      bookingServiceId:
                        type: string
                        minLength: 1
                      noteText:
                        type: string
                        minLength: 1
                    required:
                      - scope
                      - noteText
                  default: []
                  description: Optional notes attached to the booking.
              required:
                - clientId
                - bookingStartUtc
                - bookingEndUtc
                - bookingTz
                - locationType
                - services
      responses:
        '201':
          description: Booking created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Booking'
                required:
                  - data
        '400':
          description: >-
            Validation error, or an order-item pre-check failed:
            INVALID_ORDER_REFERENCE, INVALID_ORDER_ITEM_REFERENCE,
            ORDER_ITEM_SERVICE_MISMATCH, ORDER_ITEM_BUSINESS_MODEL_MISMATCH (the
            line names a businessModelType the sku of the order item is not sold
            as), ORDER_ITEM_QUANTITY_UNAVAILABLE. Also 400 when the location is
            of the wrong type or another supplier’s, or its fields are invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: API key cannot access this project
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Client, supplier, offering, location or project not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: >-
            Supplier time is held or already booked (SLOT_HELD / SLOT_BOOKED),
            the calendar is under contention (OCCUPANCY_CONTENTION), or the
            order is cancelled (code: ORDER_CANCELLED)
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ErrorMessage'
                  - type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - SLOT_HELD
                          - SLOT_BOOKED
                        description: Which kind of claim is blocking the requested time.
                        example: SLOT_HELD
                      message:
                        type: string
                        description: Human-readable summary of the conflict.
                        example: >-
                          Supplier time is not available: HOLD
                          resv_01kv8p20m1gnqvxl92xln6awk8
                          (2026-08-01T10:00:00Z–2026-08-01T11:00:00Z)
                      statusCode:
                        type: number
                        enum:
                          - 409
                        description: >-
                          The HTTP status, repeated in the body — every
                          MarketBox error carries it, so you can branch on the
                          body alone.
                        example: 409
                      requestId:
                        type: string
                        description: >-
                          The id of this request (also returned as the
                          X-Request-Id header). Quote it in a support ticket.
                        example: a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10
                      conflicts:
                        type: array
                        items:
                          type: object
                          properties:
                            claimType:
                              type: string
                              enum:
                                - BOOKING
                                - HOLD
                              description: >-
                                Whether the blocking claim is a HOLD or a
                                confirmed BOOKING.
                            supplierId:
                              type: string
                              nullable: true
                              description: >-
                                The supplier whose calendar is blocked, when
                                known.
                            startUtc:
                              type: string
                              format: date-time
                              description: Start of the blocking claim, UTC ISO 8601.
                              example: '2026-08-01T10:00:00Z'
                            endUtc:
                              type: string
                              format: date-time
                              description: End of the blocking claim, UTC ISO 8601.
                              example: '2026-08-01T11:00:00Z'
                            reservationId:
                              type: string
                              nullable: true
                              description: >-
                                Present when claimType is HOLD — the
                                reservationId to convert or release. Null for a
                                BOOKING conflict.
                              example: resv_01kv8p20m1gnqvxl92xln6awk8
                            bookingId:
                              type: string
                              nullable: true
                              description: >-
                                Present when claimType is BOOKING — the id of
                                the confirmed booking occupying this time. Null
                                for a HOLD conflict.
                              example: null
                            heldUntil:
                              type: string
                              nullable: true
                              format: date-time
                              description: >-
                                HOLD only: when the blocking hold lazily
                                expires. Null for a BOOKING conflict.
                              example: '2026-08-01T10:05:00Z'
                          required:
                            - claimType
                            - startUtc
                            - endUtc
                        description: >-
                          Every live claim that overlaps the requested time —
                          usually one, but can be more.
                      hint:
                        type: string
                        description: >-
                          What to do next: for SLOT_HELD, convert or release the
                          named reservationId (POST
                          .../holds/{reservationId}/convert or /release); for
                          SLOT_BOOKED, search availability again.
                        example: >-
                          This time is held (reservation
                          resv_01kv8p20m1gnqvxl92xln6awk8). Convert the hold via
                          POST
                          /v1/projects/{projectId}/holds/{reservationId}/convert,
                          or release it with POST
                          /v1/projects/{projectId}/holds/{reservationId}/release.
                          Direct booking routes will not consume a hold — if you
                          hold, you convert.
                    required:
                      - code
                      - message
                      - statusCode
                      - requestId
                      - conflicts
                      - hint
        '422':
          description: >-
            The booking location is a PHYSICAL Location without coordinates
            (UNPROCESSABLE_ENTITY): the business’s location data needs fixing;
            or a line names an offering that is not ACTIVE (NOT_SELLABLE): the
            line draws down an order item already bought, so only the offering
            is checked, and a service retired since stays bookable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    Booking:
      type: object
      properties:
        projectId:
          type: string
        tenantId:
          type: string
        bookingId:
          type: string
        seriesId:
          type: string
          nullable: true
        occurrenceLocalDate:
          type: string
          nullable: true
        isException:
          type: boolean
        supplierId:
          type: string
          nullable: true
        clientId:
          type: string
        packageOrderItemId:
          type: string
          nullable: true
        bookingStartUtc:
          type: string
          format: date-time
        bookingEndUtc:
          type: string
          format: date-time
        bookingTz:
          type: string
        bookingLocalDate:
          type: string
        bookingLocalStartTime:
          type: string
        bookingLocalEndTime:
          type: string
        bookingLocalEndDate:
          type: string
        locale:
          type: string
        attribution:
          type: object
          properties:
            searchId:
              type: string
              minLength: 1
              maxLength: 128
              description: >-
                The `searchId` of the MarketBox search response the buyer booked
                from — the `X-MB-Search-Id` header / body field of every search
                route. Stored as given; a value MarketBox never issued is kept
                but not trusted.
              example: srch_01k7q3x9h4e8rb2d6m0z5a7c1n
            sessionKey:
              type: string
              minLength: 1
              maxLength: 64
              description: >-
                The same opaque per-session key you send with site events, at
                most 64 characters. Never an email, IP or user id.
              example: sess-example-01
            surface:
              type: string
              enum:
                - home
                - results
                - listing
                - site_search
                - profile
                - widget
                - assistant
                - other
              description: Where on your site the buyer started the purchase.
              example: results
          additionalProperties: false
          description: >-
            Which search and site session this purchase came from. Optional; set
            once on the order and copied onto every booking it funds. See the
            search-log guide, "Booking attribution".
        locationType:
          type: string
          enum:
            - PHYSICAL
            - VIRTUAL
            - TRAVEL_ZONE
        locationId:
          type: string
          nullable: true
        latitude:
          type: number
          nullable: true
        longitude:
          type: number
          nullable: true
        address:
          $ref: '#/components/schemas/Address'
        capacity:
          type: integer
          minimum: 0
          exclusiveMinimum: true
        participantCount:
          type: integer
          minimum: 0
        waitlistCount:
          type: integer
          minimum: 0
        isGroupBooking:
          type: boolean
        status:
          type: string
          enum:
            - SCHEDULED
            - STARTED
            - AWAITING_CONFIRMATION
            - DISPUTED
            - COMPLETED
            - CANCELLED
            - CLIENT_NO_SHOW
            - SUPPLIER_NO_SHOW
            - NO_SHOW
        statusUpdatedAt:
          type: string
          format: date-time
        statusUpdatedBy:
          type: string
        statusUpdatedByCapacity:
          type: string
          enum:
            - ADMIN
            - SUPPLIER
            - CLIENT
            - SYSTEM
            - API
        cancellationReason:
          type: string
          nullable: true
        cancelledBy:
          type: string
          nullable: true
        cancellationInitiatedBy:
          type: string
          enum:
            - CLIENT
            - SUPPLIER
            - BUSINESS
        cancellationReasonCode:
          type: string
          enum:
            - CLIENT_REQUESTED
            - CLIENT_UNWELL
            - SUPPLIER_UNAVAILABLE
            - WEATHER
            - FACILITY_UNAVAILABLE
            - BOOKED_IN_ERROR
            - OTHER
        creditTreatment:
          type: string
          enum:
            - RETURN
            - FORFEIT
            - REFUND_ORIGINAL_PAYMENT
            - NOT_APPLICABLE
        durationOverrideMinutes:
          type: integer
          minimum: 0
          exclusiveMinimum: true
          maximum: 1440
        durationOverrideReason:
          type: string
          minLength: 1
          maxLength: 500
        counts:
          type: object
          properties:
            services:
              type: integer
              minimum: 0
            notes:
              type: integer
              minimum: 0
            participants:
              type: integer
              minimum: 0
          required:
            - services
            - notes
            - participants
        deleted:
          type: boolean
        version:
          type: integer
          minimum: 0
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        createdBy:
          type: string
        updatedBy:
          type: string
      required:
        - projectId
        - tenantId
        - bookingId
        - supplierId
        - clientId
        - bookingStartUtc
        - bookingEndUtc
        - bookingTz
        - bookingLocalDate
        - bookingLocalStartTime
        - bookingLocalEndTime
        - bookingLocalEndDate
        - locationType
        - locationId
        - latitude
        - longitude
        - address
        - capacity
        - participantCount
        - waitlistCount
        - isGroupBooking
        - status
        - statusUpdatedAt
        - counts
        - deleted
        - version
        - createdAt
        - updatedAt
        - createdBy
        - updatedBy
    ErrorMessage:
      type: object
      properties:
        code:
          type: string
          description: Stable machine-readable error code, e.g. NOT_FOUND.
        message:
          type: string
          description: Human-readable description of what went wrong.
        statusCode:
          type: integer
          description: The HTTP status code of this response.
        requestId:
          type: string
          description: >-
            The id of this request, also returned as the X-Request-Id header.
            Quote it in a support ticket.
      required:
        - code
        - message
        - statusCode
        - requestId
      example:
        code: NOT_FOUND
        message: Booking not found
        statusCode: 404
        requestId: a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10
    Address:
      type: object
      nullable: true
      properties:
        addressOneLine:
          type: string
          minLength: 1
          description: The whole address on one line, as a person would write it.
          example: 10 Main St, Toronto, ON M5V 1A1, Canada
        streetNumber:
          type: string
          minLength: 1
          description: The street number.
          example: '10'
        streetName:
          type: string
          minLength: 1
          description: The street name.
          example: Main St
        city:
          type: string
          minLength: 1
          description: The city or town.
          example: Toronto
        state:
          type: string
          minLength: 1
          description: The state, province or region; an ISO 3166-2 code when one matches.
          example: 'ON'
        country:
          type: string
          minLength: 1
          description: The country; ISO 3166-1 alpha-2, alpha-3 or the English name.
          example: CA
        zipCode:
          type: string
          minLength: 1
          description: The postal or ZIP code, in any national format.
          example: M5V 1A1
        unitNumber:
          type: string
          nullable: true
          description: The unit, suite or apartment, if any.
          example: 4B
      required:
        - addressOneLine
        - streetNumber
        - streetName
        - city
        - state
        - country
        - zipCode
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key minted in the MarketBox dashboard. Scope is restricted to the
        projects you select at creation time. Every route needs the key's
        standard API access (`*`) except `POST /v1/projects/{projectId}/events`,
        which needs `events:write`; a key without `*` is refused with 403
        `CAPABILITY_NOT_GRANTED`.

````

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