Once I end the web call I want to get the Cost of ...
# support
r
I've integrated Vapi in Web application, Now once user end the call we want to get the cost of that call, how can we do that. Is there any alternative available such as Any cost api or so.
v
message has been deleted
@rudra To retrieve the cost of a call after it has ended in your web application, you would typically use a billing API provided by VAPI, if available. This API would allow you to query the cost of a specific call by its unique identifier (such as a call SID or similar). Unfortunately, I don't have access to the full API reference for VAPI, so I can't provide you with the exact endpoint or method to use. However, most voice API providers offer some form of billing API that you can use to fetch call cost details. If VAPI offers a billing API or a similar endpoint, you would need to make an API call to that endpoint, passing the unique identifier of the call as a parameter. The response from the API would typically include the cost of the call. If you're unsure about the availability of such an API or how to use it, I recommend checking the VAPI documentation under the "API Reference" section for billing-related endpoints. If the information is not available there, please ask support for more info on this. Would you like me to look for any specific documentation or help you with anything else?
You can continue this conversation by mentioning me in the message.
s
@rudra You can get the call cost in two ways: 1. Using the server-event
end-of-call-report
2. Making a GET request to /call/:id after 1 minute of the call ending For the server-event method, Vapi sends an end-of-call report to your server URL containing complete details about the call, including costs. You can learn more about server events here: https://api.vapi.ai/api-json# Navigate to Components > Schemas > ServerMessageEndOfCallReport for the full schema.