how to delete all of my assistants from vapi?
# support
r
I want to delete all of my assistants and there are hundreds of assistants so how do I delete all of them in one-go?
g
If you can code a bit just write a function to list all the assistants through api and store their id and then a for loop that delete all of them. If you prefer not code solution maybe a work around could be create a new organisation and delete the current organisation. Just take care if you have file in the old organisation that you want to have in the new one
t
I can paste you a bash script I have that does exactly this if you want?
a
Hey Richard, checking if this is resolved for you.
r
Yup please paste it in
t
hi @Richard , sure thing, will paste below. FYI I have many bash scripts for directly manipulating VAPI agents and files etc, if you need - just hmu. P.S Not sure about your situation, but in case you have same situation as us - we are programmatically createing vapi agents with Python. I wanted a way to easily "delete all automatically-created agents" from the vapi dash, without deleting the agents we had manually created on the dash. If you have that problem, I have a solution for that as well. Here is your script, just put your api key in:
#!/bin/bash # Bash script to delete all vapi agents from dash. Contact drvertigo@gmail.com for questions. # Set your api key here VAPI_API_KEY="" # Exit if API key is not set [ -z "$VAPI_API_KEY" ] && { echo "Warning: VAPI_API_KEY is not set. Please set it before running the script."; exit 1; } # # Fetch all agents and extract IDs agent_ids_to_delete=($(curl -s -X GET "https://api.vapi.ai/assistant" -H "Authorization: Bearer $VAPI_API_KEY" | jq -r '.[].id')) echo "Number of Vapi Agents to be deleted: ${#agent_ids_to_delete[@]}" read -p "Type YES if you are sure you want to delete all vapi agents from your dashboard: " confirmation [ "$confirmation" != "YES" ] && { echo "Operation cancelled."; exit 1; } for agent_id in "${agent_ids_to_delete[@]}"; do echo "Deleting agent: $agent_id" curl -s -X DELETE "https://api.vapi.ai/assistant/$agent_id" -H "Authorization: Bearer $VAPI_API_KEY" && echo "Deleted $agent_id" done echo -e "\nFinished"
that formatted terribly, so I stuck it in pastebin: https://pastebin.com/3UvXr6ew
r
Yeah we too are creating agents with Typescript and it's huge in numbers. Hence, we want to delete some of the agents which are not in usage
t
Understand. Let me know if you want a simple way to automatically delete auto-created agents.
3 Views