Booking Batch API Documentation

Overview

The Booking Batch API provides bulk upsert operations for bookings.

This allows multiple bookings to be created or updated in a single request.

Endpoints

Batch Upsert Bookings

POST /api/f1/sync/bookings/batch/

Creates or updates multiple bookings in a single request. For each booking in the batch:

  • If a booking with the given external_id exists, it will be updated

  • If no booking exists with that external_id, a new one will be created

Parameters

{
  "bookings": [
    {
      "external_id": "EXT123",
      "name": "John Smith",
      "email": "john@example.com",
      ...other booking attributes...
    },
    {
      "external_id": "EXT456",
      "name": "Jane Smith",
      "jump_on": "2024-02-15",
      ...other booking attributes...
    }
  ]
}

Each booking object in the array accepts the same parameters as the Booking API's create/update endpoints.

Success Response

{
  "results": [
    {
      "external_id": "EXT123",
      "name": "John Smith",
      ...other booking attributes...,
      "status": "created"  // or "ok" if updated
    },
    {
      "external_id": "EXT456",
      "name": "Jane Smith",
      ...other booking attributes...,
      "status": "ok"  // or "created" if new
    }
  ]
}

Error Response

If any bookings in the batch have errors, they will be reported individually while still processing the rest of the batch:

{
  "results": [
    {
      "external_id": "EXT123",
      "name": "John Smith",
      ...other booking attributes...,
      "status": "created"
    },
    {
      "error": "requires external id",
      "status": "unprocessable_content"
    },
    {
      "external_id": "EXT789",
      "error": "booking is too old",
      "status": "not_acceptable"
    },
    {
      "external_id": "EXT456",
      ...other booking attributes...,
      "warning": "product locked, some changes ignored",
      "status": "partial_update"
    }
  ]
}

Notes

  • Operations are atomic per booking - each booking in the batch is processed independently
  • Failed operations for one booking do not affect the processing of other bookings in the batch
  • Response includes results for all bookings, with appropriate status for each:
    • created for new bookings
    • ok for successful updates
    • partial_update for updates where some changes were ignored due to locked attributes
    • unprocessable_content for validation errors
    • not_acceptable for ancient bookings
    • conflict where the external id is already used by a booking delivered more than 60 days ago
  • All other notes from the Booking API apply (ancient booking restrictions, product locking, etc.)
  • The same validations and restrictions apply to each booking as in the single booking API