For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGet API key
DocumentationIntegrationsAPI Reference
DocumentationIntegrationsAPI Reference
  • API Reference
      • GETGet Usage
      • GETGet Daily Usage
      • GETGet Monthly Usage
      • GETGet Usage By Number
      • GETGet Usage By Agent
LogoLogo
HomeGet API key
API Referenceusage

Get Usage By Agent

GET
https://api.agentphone.ai/v1/usage/by-agent
GET
/v1/usage/by-agent
1const url = 'https://api.agentphone.ai/v1/usage/by-agent?period=month&tz=America%2FNew_York';
2const options = {
3 method: 'GET',
4 headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
5 body: '{}'
6};
7
8try {
9 const response = await fetch(url, options);
10 const data = await response.json();
11 console.log(data);
12} catch (error) {
13 console.error(error);
14}
1{
2 "data": [
3 {
4 "agentId": "a1b2c3d4-e5f6-7890-ab12-cd34ef567890",
5 "agentName": "Support Agent Alpha",
6 "messages": 152,
7 "calls": 47,
8 "totalSeconds": 7320,
9 "isOrphan": false
10 },
11 {
12 "agentId": "b2c3d4e5-f678-9012-ab34-cd56ef789012",
13 "agentName": "Sales Agent Beta",
14 "messages": 98,
15 "calls": 30,
16 "totalSeconds": 5400,
17 "isOrphan": false
18 },
19 {
20 "agentId": null,
21 "agentName": "Unassigned",
22 "messages": 25,
23 "calls": 5,
24 "totalSeconds": 600,
25 "isOrphan": true
26 }
27 ],
28 "period": "month",
29 "periodStart": "2024-06-01T00:00:00Z",
30 "periodEnd": "2024-06-30T23:59:59Z"
31}

Get usage broken down by agent for the current calendar week, month, or year. Includes message count, completed call count, and total call seconds per agent. Calls/messages with no agent attached are bucketed as “Unassigned”.

Was this page helpful?
Previous

Send Message

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Query parameters

periodenumRequired
Allowed values:
tzstring or nullOptional

IANA timezone, e.g. America/New_York

Response

Successful Response
datalist of objects
periodstring
periodStartstring
periodEndstring

Errors

422
Unprocessable Entity Error