Get agents call history (grouped by agent)
Call Logs
Call History
GET
Get agents call history (grouped by agent)
Retrieve a summarized call history grouped by agent. The endpoint returns one row per agent with totals (calls, successful calls, duration) and representative phone numbers for the agent’s calls.
Common error messages:
Notes:
API Endpoint
GET/api/v1/global/agents/call-history
Content-Type: application/json
Authentication: Required (API token validated by middleware apiauth.verifyToken). Provide token via header token or api_access_token.
Query Parameters / Request Body
This endpoint accepts parameters either as query parameters (GET) or as JSON in the request body (middleware mapsreq.data).
Additional filters supported by the underlying summary/list endpoints may also be honored:
sentiment, disposition, emotion, transcript, audio_url, etc. However this endpoint forces grouping by agent_id.
Available Filters (from code)
The controller and underlyingagentController support a set of filters you can pass as query parameters or in the request body. Below are the most useful filters observed in the implementation:
Notes:
- The
getCallHistoryendpoint specifically calls the summary function withgroup_by = 'agent_id', so grouping is enforced even if othergroup_byvalues exist in the summary helper. - Some filters have slightly different column names between the summary and the per-call list endpoints (
STATUSvsCALL_STATUS); prefer usingstatusfor the summary endpoint andCALL_STATUSwhen calling the per-call list directly if you need exact behavior. dispositionaccepts comma-separated values and will be converted into anINfilter in SQL.- For precise per-call data (transcripts, audio URLs, cost breakdown), use the per-call endpoint
agentController.getAgentExecutionListand apply the same filters.
Example Request
Successful Response (200)
Top-level response follows the project’s standard wrapper in many endpoints. The importantdata structure (simplified) is shown below.
Response Fields
Error Responses
400 - Bad Request
Status Code:400 Bad Request
Invalid date range or parametersfromdate / todate format invalid
401 - Authentication Error
Status Code:401 Unauthorized
404 - Not Found
Status Code:404 Not Found
500 - Server Error
Status Code:500 Internal Server Error
Pagination
Results are paginated. Usepage and limit to page through results. Pagination metadata is returned in the pagination object. For large datasets, prefer narrow date ranges (≤ 3 months).
Important Notes
- Grouping: This endpoint is implemented by calling
getAgentExecutionSummarywithgroup_by=agent_id, so responses are grouped by agent. - Representative numbers:
call_fromandcall_toare taken from one representative execution (latest with non-null numbers) per agent — usegetAgentExecutionListfor full per-call records. - Date ranges: Defaults to last 1 month if
fromdate/todateare not provided. The code enforces a reasonable maximum range (~3 months) for performance. - Pagination defaults: Values come from environment variables
DEFAULT_PAGEandDEFAULT_PAGE_LIMITif not provided.
Example: Use agent_id to fetch one agent’s summary
Example Requests (filters)
Below are cURL examples that demonstrate how to call the endpoint using the various filters supported by the code. You can use GET query parameters or POST JSON bodies (middleware mapsreq.data).
1) Get summary for a specific agent (GET)
2) Get summary for a specific agent (POST)
3) Filter by calling_number (partial match)
4) Filter by provider_number (exact match)
5) Filter by status (e.g., completed)
6) Filter for calls that have audio available
7) Filter for calls with transcript available
8) Filter by sentiment or emotion
9) Filter by disposition (comma-separated)
10) Filter by input_data partial match
11) Filter by cost_breakdown (partial match)
12) Duration range (per-call list; example for reference)
13) Combined filters (example)
14) POST example with multiple filters (combined)
- Use GET for simple queries and POST when your client prefers JSON bodies or needs to send complex filters.
- Some filters (like
duration) are more relevant to the per-call list endpoint; the summary groups by agent but accepts the filter (the underlying query logic differs slightly).
Related Endpoints
/api/v1/global/agents/get— Get agent metadata and configuration./api/v1/global/agents/call— Initiate an agent call.agentController.getAgentExecutionList— Use this endpoint for row-level per-call details (call-level list, transcripts, audio URLs).
Headers
API token for authentication

