how to know when a call has ended?
# support
u
I'm using the API for creating an assistant, I want to then grab call details when the call has ended. But how to get the flag for when the call has finished?
v
Hi @.hardboiledfish, I'm an AI assistant for Vapi. I'll analyze available sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Create Assistant]() * [Create Phone Call]() * [Update Assistant]() * [List Assistants]() -----------------------------
### Answer To know when a call has ended using Vapi, you can utilize the feature in the API that sends server messages at different stages of the call. When the call ends, your server will receive an
end-of-call-report
message among other possible server messages detailed in the API documentation [(1)]() . Here is how you can set up your assistant to send these server messages to your server URL, including the end of call report:
Copy code
json
{
  "serverUrl": "https://yourserver.example.com/path",
  "serverMessages": ["end-of-call-report", "status-update", "hang", "tool-calls"]
}
This configuration ensures that at the end of a call, your server receives detailed information about the call, including the reason it ended, which is specified in the
end-of-call-report
. Make sure your server endpoint is prepared to handle these incoming POST requests to process the call data accordingly.
u
@Vapi Support how to get the end of call report?
v
Please tag me in threads that I was a part of from the start.
Got it. Tagging @User for additional help.
u
it sends a post request to the serverURL before the call is finished!
s
you just need to add your server url into advanced section and select the end-of-call-report
u
Thanks! Got it working
3 Views