Talk API: Using the Delete Recording endpoint
You can use the Delete Recording endpoint in the Talk API to programmatically delete call recordings from any of your tickets. This tutorial shows you how to use the the Delete Recording endpoint to delete a call recording.
Requirements
Zendesk Support
Make sure you’re authorized to use the API in your Zendesk account. To learn more about getting access to the API, see Managing access to the Zendesk API in Zendesk help. If you're not a Zendesk admin, ask one to give you access to the API.
Once you have your authorization credentials (either an API token or an OAuth token), you can start making API requests.
Postman
This tutorial uses Postman to make API requests. If you don't use Postman, you can download the free app for Windows or macOS from the Postman website.
Make sure to specify your Zendesk authorization credentials for your requests in Postman. See Authorization in the Postman docs.
Disclaimer: Zendesk can't provide support for third-party technologies such as Postman.
Deleting a call recording
Deleting a call recording consists in identifying the ticket comment that contains the recording, identifying the recording in the comment, then deleting the recording.
-
Identify a ticket in your account that contains a recording. It should appear as a voice comment in the ticket. Example:
-
Note the ticket id from the ticket URL in the web browser address:
https://yoursubdomain.zendesk.com/agent/tickets/{ticket_id}
-
Use the ticket id to retrieve the ticket comments.
In Postman, make a GET request to the List Comments endpoint:
https://{yoursubdomain}.zendesk.com/api/v2/tickets/{ticket_id}/comments.json
Example:
In the example, the ticket id, 23213427, is specified as a path variable.
The endpoint returns JSON data containing all the comment metadata related to this ticket, including the
call_id
property that identifies the recording:{
"id": 686093776271,
"type": "VoiceComment",
"public": true,
"data": {
"from": "***********",
"to": "*********",
"recording_url": "https://yoursubdomain.zendesk.com/api/v2/channels/voice/calls/CA13d7382d3624c770481166c98720ed7f/twilio/recording",
"call_id": 360507728571,
"call_duration": 458,
...
In the example,
call_id
is 360507728571. -
Note the value of
call_id
in the comment that contains the recording. -
Use the call id with the Delete Recording endpoint to delete the recording.
To do this, select the DELETE method in Postman and ping the Delete Recording endpoint:
https://{yoursubdomain}.zendesk.com/api/v2/channels/voice/calls/360507728571/recordings.json
Example:
Replace the subdomain and call id with your own values.
Make sure to select DELETE from the method dropdown on the left side.
After clicking Send, you’ll get a confirmation in the Response window in Postman that the message has been deleted.
For more information, see Delete Recording in the Talk API reference docs.
Deleting a call recording by type
A call can have two recordings associated with it. The two recordings will have different types that you can retrieve from the voice comments payload and then use to delete one of the comments.
To delete a call recording by type
-
Follow steps 1-3 from the previous section. A voice comment should contain a
recording_type
property along with thecall_id
.Note: Voice comments created before January 10, 2020, won't have a
recording_type
property. For those comments, follow the approach in the previous section, "Deleting a call recording". -
Note the value of
call_id
andrecording_type
in the comment that contains the recording. -
Make a request to the Delete Recording endpoint using the
call_id
andrecording_type
values.In Postman, select the DELETE method and paste the Delete Recording endpoint into the address field. Example:
https://{yoursubdomain}.zendesk.com/api/v2/channels/voice/calls/{call_id}/recordings/{recording_type}.json
Replace the subdomain, call_id, and recording_type with your own values.
After clicking Send, you’ll get a confirmation in the Response window that the message was deleted.