Bookings

View as Markdown

This guide explains how to use booking-related APIs in AISquare.

These APIs integrate with Cal.com for scheduling functionality.


Overview

The bookings APIs allow you to:

  • Retrieve configuration for Cal.com integration
  • Refresh access tokens
  • Retrieve user details

All endpoints are scoped to the authenticated user.


Authentication

Bookings endpoints use:

  • JWT authentication
  • API key (where required)

Get configuration

Retrieve Cal.com configuration details required for frontend integration.

Endpoint

GET /api/v1/bookings/config/

Access control

  • Requires authentication
  • Returns 401 if unauthorized

Response

  • Cal.com configuration data

Token refresh and integration

Refresh the Cal.com access token or perform initial integration.

Endpoint

POST /api/v1/bookings/token/refresh/

Request body

  • Uses CalTokenRefreshRequest schema

Behavior

  • Refreshes access token for existing users
  • Handles initial integration for first-time users

Response includes

  • access_token
  • expires_in
  • token_type
  • refreshed (boolean)
  • integration_status (created or existing)
  • cal_client_id

Status codes

StatusMeaning
200Success
400Invalid request
401Unauthorized
500Internal error

Get user details

Retrieve Cal.com user details for the authenticated user.

Endpoint

GET /api/v1/bookings/user/

Access control

  • Requires authentication
  • Returns 404 if user not found

Response

  • User details based on CalUser schema

Notes

  • Bookings APIs are tied to Cal.com integration
  • Token refresh endpoint supports both initial setup and refresh
  • All endpoints require authentication

When to use these endpoints

Use caseEndpoint
Setup frontend integration/bookings/config/
Manage tokens/bookings/token/refresh/
Fetch user details/bookings/user/