Skip to content

Error Handling

FluentBooking returns standard HTTP status codes and a consistent JSON body for non-2xx responses.

Response Shape

json
{
  "code": "validation_failed",
  "message": "The given data was invalid.",
  "data": {
    "status": 422,
    "errors": {
      "email": ["The email field is required."]
    }
  }
}
  • code — machine-readable error slug (snake_case).
  • message — human-readable summary, often surfaced directly in the admin UI.
  • data.status — HTTP status code.
  • data.errors — field-level validation errors when applicable (typically on 422).

HTTP Status Codes

StatusMeaningWhen You See It
200OKStandard successful response.
201CreatedA resource was created (some endpoints use 200 instead).
400Bad RequestMalformed request body or missing required fields outside the validation layer.
401UnauthorizedMissing or invalid credentials. See Authentication.
403ForbiddenThe authenticated user lacks the FluentBooking capability for this route.
404Not FoundThe resource (calendar, event, booking, etc.) does not exist or you cannot access it.
409ConflictA slug or unique identifier collision.
422Unprocessable EntityRequest body failed validation — inspect data.errors.
429Too Many RequestsRate limit triggered by repeated booking attempts or external API calls.
500Internal Server ErrorUnhandled exception. Check the WordPress error log.

Validation Errors

Most write endpoints validate input using FluentBooking's Validator. On failure, the response contains a per-field errors map. Each field maps to an array of error messages so multiple rules can fail in a single response.

json
{
  "code": "validation_failed",
  "message": "The given data was invalid.",
  "data": {
    "status": 422,
    "errors": {
      "title": ["The title field is required."],
      "duration": ["The duration must be at least 5."]
    }
  }
}

Permission Errors

Policy denials return a 403 with a descriptive code:

json
{
  "code": "rest_forbidden",
  "message": "Sorry, you are not allowed to do that.",
  "data": { "status": 403 }
}

If you are calling an admin endpoint with cookie auth, double-check that the user has the FluentBooking admin role and that a valid X-WP-Nonce header is present.

Booking-Specific Errors

The booking endpoints add a few domain-specific error codes:

CodeMeaning
slot_no_longer_availableThe selected slot was booked by another attendee between page load and submission.
event_payment_requiredThe event requires payment; redirect the user to the payment flow.
event_disabledThe event was disabled by the host.
outside_availabilityThe selected time is outside the event's availability window.