Is there any way to send complete call data to an ...
# support
a
I want to send stats like call length, cost, latency, etc beyond the normal structered outputs functions to Supabase. Is this possible?
v
Yes, you can send complete call data (including call length, cost, latency, etc.) to Supabase by retrieving the call object from the Vapi API after the call ends and then uploading it to your Supabase database. Here’s a simple example using Node.js:
Copy code
js
// Fetch call data from Vapi
const call = await fetch('https://api.vapi.ai/calls/{callId}', { headers: { Authorization: 'Bearer YOUR_API_KEY' } }).then(res => res.json());

// Insert into Supabase
const { data, error } = await supabase.from('calls').insert([{ ...call }]);
This approach lets you automate the process in a webhook or background job. For the full call object structure, see the [Vapi API reference](https://docs.vapi.ai/api-reference/calls/get?explorer=true). Source: - [Vapi API Reference Calls](https://docs.vapi.ai/api-reference/calls/get?explorer=true)
c
Yes, this is absolutely possible! You can automatically send complete call data to Supabase (or any external database) using Server URLs/Webhooks. Here's how: Using the
end-of-call-report
Webhook Configure your assistant to send the
end-of-call-report
webhook to your server, which can then forward the data to Supabase. 1. Configure your assistant with a server URL • Go to Vapi dashboard -> assistants -> select your assistant • Go to messaging -> server messages -> select end-of-call-report 2. The
end-of-call-report
webhook includes: • Call ID, status, and ended reason • Transcript • Recording URLs • Cost data • Duration/timestamps • Messages array with timing info • And much more Getting Detailed Cost Breakdown For the most detailed cost data (per-provider breakdown), you can also use the REST API to fetch call details: • API endpoint:
GET https://api.vapi.ai/call/{call_id}
Costs field:
response.body.costs
provides total cost and breakdown per provider Documentation links: • Server URLs overview: [https://docs.vapi.ai/server-url](https://docs.vapi.ai/server-url) • Server events reference: [https://docs.vapi.ai/server-url/events](https://docs.vapi.ai/server-url/events) • Call API reference (for costs): [https://docs.vapi.ai/api-reference/calls/get#response.body.costs](https://docs.vapi.ai/api-reference/calls/get#response.body.costs)