Skip to main content

How to Retrieve Call Information

In this guide we will show you how to retrieve call information Bandwidth's platform. Please ensure you have followed our earlier guide on how to make an outbound call with Bandwidth.

Call information can provide information such as how the call ended, the length of the call, any errors that may have occurred, recording info, and more about the call.

Retrieve Call Information

Call information can be retrieved during or after a call has completed. The call information is near-real time, so it may take a few minutes for your call to be accessible using this endpoint.

To show how this works, first place an outbound call using our API.

Note: Remember to add authentication for your application if needed!

POST https://voice.bandwidth.com/api/v2/accounts/{accountId}
//Make sure an authentication header is added with your BANDWIDTH_USERNAME and BANDWIDTH:PASSWORD
{
"from": "{BW_NUMBER}",
"to": "{$USER_NUMBER}",
"applicationId": "{APPLICATION_ID}",
"answerUrl": "http://example.test/callbacks/answer",
}

Using the unique callId returned in the response, we will make a POST request to our API v2 /calls/{callId} endpoint to retrieve the call's information.

Note: Remember to add authentication for your application if needed!

curl 'https://voice.bandwidth.com/api/v2/accounts/{accountId}/calls/{callId}' \
-u {BANDWIDTH_USERNAME}:{BANDWIDTH:PASSWORD}

In the example above we have placed an outbound call and then retrieved the call information. Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response.

A call may have disconnected for several reasons. For example, if a call is rejected by the callee then a rejected state would appear in the disconnectCause. A list of possible values can be found here.

Where to next?

Now that you have learnt how to retrieve call information, check out some of the available actions in the following guides: