Call usage and cost
# support
r
Hello!! i want to check the usage and cost of call with api? is there any way? thanks
v
Hi there! 👋 Yes, there are definitely ways to check the usage and cost of calls using Vapi's API! According to the [documentation](https://api.vapi.ai/api#/Analytics/AnalyticsController_query), Vapi provides an Analytics API that can be used to track usage and cost of your calls. Here are a few methods you can use: ## 1. Analytics API You can use the
/analytics
endpoint to get detailed cost information. Here's an example for checking daily call costs:
Copy code
bash
curl --location 'https://api.vapi.ai/analytics' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer token' \
--data '{
    "queries": [
        {
            "name": "getAnalyticsByAssistantID",
            "table": "call",
            "timeRange": {
                "start": "2025-01-29T00:00:00Z",
                "end": "2025-01-29T23:59:59Z",
                "step": "day"
            },
            "operations": [
                {
                    "operation": "sum",
                    "column": "cost"
                }
            ]
        }
    ]
}'
The response will look something like:
Copy code
json
[{"name":"getAnalyticsByAssistantID","timeRange":{"start":"2025-01-29T00:00:00.000Z","end":"2025-01-29T23:59:59.000Z","step":"day","timezone":"UTC"},"result":[{"date":"2025-01-29T00:00:00.000Z","sumCost":0.0226}]}]
## 2. Get Call API You can also get cost information for a specific call using the [Get Call API endpoint](https://docs.vapi.ai/api-reference/calls/get-call), which returns properties like
cost
and
costBreakdown
. ## 3. End-of-Call-Report Webhook If you prefer a webhook approach, Vapi provides an ["end-of-call-report" webhook](https://docs.vapi.ai/server-url/events#end-of-call-report) that includes the cost of each call. Is there a specific aspect of call usage or cost tracking you're interested in learning more about? Sources: - [Analytics API Endpoint](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1337948247678914610)
k
Hey Rishabh, could you share the call ID so I could share the call cost with you?
2 Views