# Get Next available appointment time

Endpoint: GET /next_available_appointment
Version: v1
Security: x-api-key, a-api-key

## Query parameters:

  - `from` (string, required)
    Cannot be more than 7 days before the `to` parameter and cannot be before the current date in the tenant's time zone.

  - `to` (string, required)
    Cannot be more than 7 days after the `from` parameter and cannot be before the current date in the tenant's time zone.

  - `appointment_type_id` (integer, required)

  - `client_id` (integer)
    Required if account_id is not null

  - `account_id` (integer)

  - `business_ids` (array)

  - `practitioner_ids` (array)

  - `profession_ids` (array)

  - `resource_ids` (array)

  - `requires_single_resource` (boolean)
    Determines how availability is evaluated when multiple resource_ids are provided.  
- When true, the system returns time slots where <b>only one</b> of the specified resources is available.
- When false, the system returns time slots where <b>all</b> specified resources are available simultaneously.

  - `manual` (boolean)

  - `online` (boolean)

  - `waiting_list` (boolean)

  - `buffer` (integer)
    Minutes added to the current time when searching for availability. Only appointment times starting after now + buffer are returned.

## Response 200 fields (application/json):

  - `available_times` (array)

  - `available_times.app_time` (string)
    ISO 8601 local datetime in the tenant's timezone.
    Example: 2026-01-01T12:05:30

  - `available_times.column_number` (integer)

  - `available_times.item_id` (integer)

  - `available_times.item_group_id` (integer | null)

  - `available_times.appointment_type_id` (integer)

  - `available_times.practitioner_id` (integer)

  - `available_times.business_id` (integer)

  - `available_times.profession_id` (integer)

  - `available_times.width` (integer)

  - `available_times.duration` (integer)

  - `available_times.resource_ids` (array)

  - `available_times.practitioner_name` (string)

  - `total_entries` (integer)

  - `links` (object)

  - `links.self` (string)
    Example: https://api.pracsuite.com/v1/next_available_appointment?page=2&appointment_type_id=1&from=2025-01-01&to=2025-01-07

## Response 400 fields (application/json):

  - `error` (object, required)

  - `error.status` (integer)
    Example: 400

  - `error.code` (string)
    Example: INVALID_PARAMS

  - `error.detail` (string)
    Human readable explanation of the error
    Example: One or more request parameters are invalid.

  - `request_id` (string, required)
    Example: 00000000-0000-0000-0000-000000000000

## Response 401 fields (application/json):

  - `error` (object, required)

  - `error.status` (integer)
    Example: 403

  - `error.code` (string)
    Example: UNAUTHORIZED

  - `error.detail` (string)
    Human readable explanation of the error
    Example: Access could not be verified for this request.

  - `request_id` (string, required)
    Example: 00000000-0000-0000-0000-000000000000

## Response 403 fields (application/json):

  - `error` (object, required)

  - `error.status` (integer)
    Example: 403

  - `error.code` (string)
    Example: MISSING_AUTHENTICATION_TOKEN

  - `error.detail` (string)
    Human readable explanation of the error
    Example: Authentication token is missing or the requested endpoint does not exist

  - `request_id` (string, required)
    Example: 00000000-0000-0000-0000-000000000000

## Response 500 fields (application/json):

  - `error` (object, required)

  - `error.status` (integer)
    Example: 500

  - `error.code` (string)
    Example: SERVER_ERROR

  - `error.detail` (string)
    Human readable explanation of the error
    Example: An unexpected error occurred while processing your request. Please try again in a few minutes. If it keeps happening, contact support with Request ID: 00000000-0000-0000-0000-000000000000.

  - `request_id` (string, required)
    Example: 00000000-0000-0000-0000-000000000000

