Error Codes

Complete reference of all API error codes.

Error response format

When an error occurs, the API returns a response with the following format:

JSON
{
    "success": false,
    "error": {
        "code": "ERROR_CODE",
        "message": "Human-readable error description",
        "details": {
            // Additional information (optional)
        }
    }
}

Fields

Field Type Description
code string Unique error code (for programming logic)
message string Descriptive message (can be shown to user)
details object Additional details (invalid fields, etc)

Authentication errors (401, 403)

Code HTTP Description
MISSING_API_KEY 401 X-API-Key header was not included
INVALID_API_KEY 401 Invalid or not found API Key
API_KEY_DISABLED 403 API Key has been disabled
API_KEY_EXPIRED 403 API Key has expired
ORIGIN_NOT_ALLOWED 403 Origin domain is not authorized
TENANT_INACTIVE 403 Business account is not active
MISSING_TOKEN 401 JWT token required but not provided
INVALID_TOKEN 401 Invalid or malformed JWT token
TOKEN_EXPIRED 401 Expired JWT token
INVALID_CREDENTIALS 401 Incorrect email or password (login)

Rate limiting errors (429)

Code HTTP Description
RATE_LIMIT_EXCEEDED 429 Too many requests, wait before retrying
LOGIN_ATTEMPTS_EXCEEDED 429 Too many failed login attempts
REGISTRATION_LIMIT_EXCEEDED 429 Too many registration attempts

When you receive a 429 error, check the response headers:

Headers
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1704067260
Retry-After: 45

Validation errors (400)

Code HTTP Description
VALIDATION_ERROR 400 One or more fields have invalid values
MISSING_REQUIRED_FIELD 400 Required field is missing
INVALID_EMAIL 400 Invalid email format
INVALID_PHONE 400 Invalid phone format
INVALID_DATE 400 Invalid date format (must be YYYY-MM-DD)
INVALID_TIME 400 Invalid time format (must be HH:MM)
DATE_IN_PAST 400 Date is before today
DATE_TOO_FAR 400 Date exceeds advance booking limit

Example with details

JSON
{
    "success": false,
    "error": {
        "code": "VALIDATION_ERROR",
        "message": "The data sent is not valid",
        "details": {
            "email": ["Invalid email format"],
            "telefono": ["This field is required"],
            "fecha": ["Date cannot be before today"]
        }
    }
}

Resource errors (404)

Code HTTP Description
SERVICE_NOT_FOUND 404 Service not found
PROFESSIONAL_NOT_FOUND 404 Professional not found
BOOKING_NOT_FOUND 404 Booking not found
CLIENT_NOT_FOUND 404 Customer not found
CATEGORY_NOT_FOUND 404 Category not found

Booking errors

Code HTTP Description
SLOT_UNAVAILABLE 400 Time slot is no longer available
PROFESSIONAL_NOT_WORKING 400 Professional doesn't work that day/time
SERVICE_NOT_OFFERED 400 Professional doesn't offer this service
BUSINESS_CLOSED 400 Business is closed on that date
CANNOT_CANCEL 400 Booking cannot be cancelled (already passed or already cancelled)
CANCELLATION_DEADLINE_PASSED 400 Cancellation deadline has passed
BOOKING_ALREADY_PAID 400 Booking has already been paid

Payment errors

Code HTTP Description
STRIPE_NOT_CONFIGURED 400 Business doesn't have Stripe configured
INVALID_AMOUNT 400 Invalid amount (must be positive)
PAYMENT_FAILED 400 Error processing payment
CARD_DECLINED 400 Card declined
INSUFFICIENT_FUNDS 400 Insufficient funds

Points errors

Code HTTP Description
INSUFFICIENT_POINTS 400 You don't have enough points
POINTS_NOT_ENABLED 400 Points program is not active
SERVICE_NOT_REDEEMABLE 400 This service cannot be redeemed with points

Server errors (500)

Code HTTP Description
INTERNAL_ERROR 500 Internal server error
SERVICE_UNAVAILABLE 503 Service temporarily unavailable
500 Errors

If you receive recurring 500 errors, contact support at developers@salonbookit.com