Skip to content

Bookings Workflow

Bookings and classes are managed via the Bookings endpoints. For more information about Classes, access the Classes section on the API reference.

POST: Available classes

To retrieve the list of available classes, use the model and model_id fields from the response as follows:

  • Endpoint: /2.0/bookings
  • Method: POST
  • Content-Type: application/json

Required Headers

{
  "x-glofox-branch-id": "{branch_id}",
  "x-api-key": "{api_key}",
  "x-glofox-api-token": "{api_token}"
}

Model Assignment Logic

  • If model_id is null, assign event._id to model_id.
  • If model_id is present, use its value directly.
  • Set the model parameter to event.

Request Body

{
  "model": "string",
  "model_id": "string",
  "user_id": "string",
  "payment_method": "string",
  "pay_gym": boolean,
  "guest_bookings": int,
  "charge": boolean
}

Important Parameters for Creating a Booking

  • The guest_bookings field is required only if users are permitted to bring guests.
  • Set pay_gym to true only when payment is collected in person. For payments processed through the app, set this field to false.
  • The charge parameter determines whether Glofox processes the payment. By default, this is set to true. Setting it to false means that the booking will go through regardless of any missing or invalid payment information. Use this only if you are processing payment in your own platform.

For further details regarding cancellations, access the cancellation policy.

To obtain the streaming link for an online class, use the following endpoint:

  • Endpoint: /2.0/events/{event_id}?include=facility,model,trainers,program&limit=100
  • Method: GET
  • Content-Type: application/json

Request Headers:

Request Body:

Tip

The response will include the external_provider_stream_url field.

GET: Booking information for users

To retrieve a list of user bookings with detailed information, use:

  • Endpoint: /2.0/bookings?branchId={{x-glofox-branch-id}}&user_id={{sample-user-id}}&include="facility,model,trainers"&sort_by="-time_start&across_branches=true
  • Method: GET
  • Content-Type: application/json

Warning

If the image_url field returns an access denied error, this indicates that no image has been uploaded.

Waiting List

To join a waiting list, include the field join_waiting_list: true in the booking payload.

  • If the user is already on the waiting list, if spots are available, or if the waiting list is full, the request will fail.
  • Waiting list promotion settings can be configured in the Dashboard under the Booking tab.

When a booking is canceled, the first user on the waiting list is automatically booked. If the user has available credits or a valid card on file, payment is processed automatically; otherwise, staff intervention is required to complete the payment.

GET: Book a trainer

Danger

The trainers model is deprecated in favor of the appointments model. Please verify your version before proceeding with implementation.

To book a trainer, use the following request:

  • Endpoint: /2.0/bookings
  • Method: GET
  • Content-Type: application/json

Required Headers

{
  "x-glofox-branch-id": "{branch_id}",
  "x-api-key": "{api_key}",
  "x-glofox-api-token": "{api_token}"
}

Request Body

{
  "model": "timeslot",
  "model_id": "624cf36e65167f35063c7f07",
  "user_id": "62264815aa26217ba57a43f5",
  "payment_method": "cash",
  "pay_gym": false,
  "guest_bookings": 0
}

Tip

The model_id parameter corresponds to the timeslot ID, which can be retrieved from the /2.0/staff/{trainer-user-id}?include=timeslots endpoint.

Finding Trainers by Email Using the Legacy API

To search for a trainer by email, use the following legacy endpoint: https://api.glofox.com/users/listview/1/30/{email}/staff/1. This endpoint returns an array of users. Note that it is a legacy endpoint and may be deprecated in the future.

GET: Booking with credits

To determine if a user has valid credits for a booking, use the following endpoints:

  • Events: GET /2.0/branches/{branch_id}/events/{event_id}/price?for={user_id}
  • Timeslot: GET /2.0/branches/{branch_id}/appointments/{timeslot_id}/price?for={user_id}
  • Courses: GET /2.0/branches/{branch_id}/courses/{event_id}/price?for={user_id}

Request Response

{
  "success": true,
  "data": {
    "credits": 1,
    "price": 0,
    "currency": "USD"
  }
}

Booking with credits

  • If price == 0, the user has sufficient credits and no payment is required.
  • If price > 0, payment is required to complete the booking.
  • To book using credits, submit the standard booking request as described above.

GET: User’s credits

To retrieve a user’s total available credits:

  • Endpoint: /2.0/credits?user_id={user_id}
  • Method: GET
  • Content-Type: application/json