https://retellai.com/?utm_source=discord&utm_medium=seo logo
what is the correct API endppoint to call so i can...
# ❓・ai-evy-support
d
@AI Evy what is the correct API endppoint to call so i can verify how many minutes my AI agent has done in the last 30 days?
a
Thanks for tagging me @Daniel D. I'll look through relevant sources and get back to you shortly.
### Answer I don't have documentation for a specific API endpoint that directly returns aggregated usage minutes for your AI agent over a time period. However, based on the available sources, you can retrieve individual call details using the Get Call endpoint, which includes
duration_ms
(call duration in milliseconds) for each call. [(1) ]() ``` ```
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
message has been deleted
Thanks for the follow-up, @Daniel D. I'll get back to you soon.
d
so @AI Evy if i want to build my own solution that tracks the amount of minutes my ai agent performs in a designated amount of time. What is the best way to go about it?
a
### Answer To build your own usage tracking solution, you can leverage the call data returned by the Get Call endpoint. Each call object includes: -
duration_ms
— the call duration in milliseconds [(1) ]() -
start_timestamp
— begin timestamp (milliseconds since epoch) -
end_timestamp
— end timestamp (milliseconds since epoch) -
agent_id
— the corresponding agent for the call Recommended approach: 1. Set up a webhook to listen for
call.ended
events. The agent's
webhook_url
field can be configured to receive call events. [(2) ]() 2. Store call data — When a call ends, capture the
call_id
,
agent_id
,
duration_ms
, and
start_timestamp
in your own database. 3. Query your database — Filter by
agent_id
and
start_timestamp
to aggregate total minutes within your designated time window. 4. Convert duration — Since
duration_ms
is in milliseconds, divide by 60,000 to get minutes. Example of retrieving a call's details:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const callResponse = await client.call.retrieve('119c3f8e47135a29e65947eeb34cf12d') ;
console.log(callResponse) ;
[(1) ]() The response will include
duration_ms
,
start_timestamp
, and
agent_id
which you can use for your tracking logic.
​ To learn more, see the sources I considered: [[1] Get Call](https://docs.retellai.com/api-references/get-call) [[2] Get Voice Agent](https://docs.retellai.com/api-references/get-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.