Skip to content

Booking Lifecycle

Every booking moves through a defined set of states. Understanding this is key to building on AvailEngine.

State Machine

              ┌──────────┐
              │ pending  │  ← Created. Deposit required but unpaid.
              └────┬─────┘
                   │ deposit paid

              ┌──────────┐
              │confirmed │  ← Slot locked. Customer expected.
              └────┬─────┘

        ┌──────────┼──────────┐
        │          │          │
        ▼          ▼          ▼
  ┌─────────┐ ┌────────┐ ┌────────┐
  │checked_in│ │no_show │ │cancelled│
  └────┬────┘ └────────┘ └────────┘


  ┌──────────┐
  │completed │
  └──────────┘

Creating a Booking

bash
curl -X POST https://api.availengine.com/v1/bookings/ \
  -H "Authorization: Bearer avail_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "business_id": "uuid",
    "booking_date": "2026-05-15",
    "start_time": "14:00",
    "capacity": 1,
    "first_name": "Jane",
    "last_name": "Doe",
    "email": "jane@example.com",
    "phone": "+301234567890"
  }'

With Deposit

If the business has deposits enabled, the response also includes stripe_client_secret and deposit_type:

json
{
  "booking": {
    "id": "uuid",
    "status": "pending",
    "confirmation_code": "AV-ABC123",
    "booking_date": "2026-05-15",
    "start_time": "14:00:00",
    "end_time": "15:00:00",
    "capacity": 1
  },
  "stripe_client_secret": "pi_xxx_secret_yyy",
  "deposit_type": "charge"
}

The customer pays using Stripe Elements or Checkout. On success, the booking auto-transitions to confirmed.

Without Deposit

json
{
  "booking": {
    "id": "uuid",
    "status": "confirmed",
    "confirmation_code": "AV-ABC123",
    "booking_date": "2026-05-15",
    "start_time": "14:00:00",
    "end_time": "15:00:00",
    "capacity": 1
  }
}

Updating a Booking

bash
curl -X PATCH https://api.availengine.com/v1/manage/bookings/{booking_id} \
  -H "Authorization: Bearer avail_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "checked_in"
  }'

What Can Change

FieldWhoWhen
statusStaffAny time
resource_idStaffBefore check-in
capacityStaffBefore check-in
staff_notesStaffAny time
customer_notesStaff/APIBefore completion

Cancelling

bash
curl -X PATCH https://api.availengine.com/v1/manage/bookings/{booking_id} \
  -H "Authorization: Bearer avail_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "cancelled",
    "cancellation_reason": "Customer request"
  }'

If a deposit was held:

  • Within cancellation_cutoff_hours → deposit is released (refunded)
  • After cutoff → deposit is captured (charged)

No-Show Handling

bash
curl -X POST https://api.availengine.com/v1/manage/bookings/{booking_id}/no-show \
  -H "Authorization: Bearer avail_live_YOUR_KEY"

This captures the deposit and marks the booking as no_show.

Webhooks

Every state change fires a webhook to your registered endpoints:

EventFires when
booking.createdNew booking (pending or confirmed)
booking.confirmedDeposit paid, booking confirmed
booking.checked_inCustomer arrives
booking.completedService done
booking.cancelledBooking cancelled
booking.no_showCustomer didn't show
deposit.paidDeposit payment successful
deposit.capturedDeposit charged (no-show)
deposit.releasedDeposit refunded

Learn about webhook verification →

Released under the MIT License.