Appointmet Stats

From docs
Revision as of 15:48, 21 July 2026 by Ashley DeBon (talk | contribs) (Overall Appointment Stats)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Mobile_API »Overall Appointment Stats

Base URL

https://apimobile.callproof.com

Endpoint

/api/ai/chat-bot/appointmet-stats

Purpose

Returns appointment statistics for all reps in a company within a date range. For each rep, the API provides the number of appointments and the average appointment duration. Results are ordered by appointment count (highest first). Useful for questions such as which rep had the most appointments or what the average appointment duration was.

HTTP Method

POST

Headers

Header Required Description
Authorization Yes Bearer access token

Security

  • Yes – Requires Bearer Token authentication.

Parameters

Path Parameters

None.

Query Parameters

None.

Request Body

Parameter Type Required Description
companyId integer Yes Company identifier whose reps’ appointments will be aggregated
startDate string Yes Start date of the range (Y-m-d, for example 2026-07-01)
endDate string Yes End date of the range (Y-m-d, for example 2026-07-21)

Successful Response (200)

Returns per-rep appointment counts and average durations for the given company and date range.

Field Type Description
clientStatusCode integer Status indicator for the client (for example, 200)
user_id integer Identifier of the authenticated user
company_id integer Identifier of the authenticated user’s company
data array List of rep appointment stats (see below)
uri string Requested resource URI

data[]

Field Type Description
rep_id integer Unique identifier of the rep
full_name string Full name of the rep
appointment_count integer Number of appointments for the rep in the date range
average_duration string Average appointment duration (for example, 120.5 seconds or 0 seconds)

Error Responses

Status Code Meaning
200 Validation failed – response body uses clientStatusCode 422 with the first validation error message
400 Bad Request – appointment stats could not be retrieved
401 Unauthorized – missing, invalid, or expired Bearer token
  • Validation (HTTP 200, clientStatusCode 422) – Missing/invalid companyId, or startDate/endDate not in Y-m-d format.
  • 400 – No representatives found for the company, or another error fetching stats (for example, "Failed to fetch appointment stats.").
  • 401 – Authentication failed or the access token is missing/expired.