Get Email Count

From docs
Revision as of 15:37, 21 July 2026 by Ashley DeBon (talk | contribs) (Get Email Count)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Mobile_API »Get Email Count

Base URL

https://apimobile.callproof.com

Endpoint

/api/ai/chat-bot/get-email-count

Purpose

Returns how many emails a user sent and received within a date range for a given company. Used by the AI chat bot for questions like how many emails were sent/received in a period.

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
userId integer Yes User whose emails should be counted
companyId integer Yes Company identifier used to scope the email records
startDate string No Start date for the count range (format: Y-m-d)
endDate string No End date for the count range (format: Y-m-d)

Successful Response (200)

Returns sent and received email counts for the user 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 object Email count payload
uri string Requested resource URI

data

Field Type Description
count object Sent/received totals

data.count

Field Type Description
sent integer Number of emails sent by the user in the date range
received integer Number of emails received by the user in the date range

Error Responses

Status Code Meaning
200 Validation failed – response body uses clientStatusCode 422 with the first validation error message
400 Bad Request – email count could not be retrieved
401 Unauthorized – missing, invalid, or expired Bearer token
  • Validation (HTTP 200, clientStatusCode 422) – Missing or non-integer userId / companyId.
  • 400 – Invalid parameters ("Invalid input parameters.") or failure to fetch counts ("Failed to fetch email count.").
  • 401 – Authentication failed or the access token is missing/expired.