Delete a collection
Deleting collections
Section titled “Deleting collections”This endpoint lets you permanently remove a collection and all its objects from Tallyfy Answers1. This operation is irreversible and should be used with caution.
Permanent action
Deleting a collection permanently removes all objects within it. This can’t be undone, and there’s no way to recover the data once deleted.
API endpoint
Section titled “API endpoint”DELETE /collections/{collection_name}This endpoint needs the API key.
Path parameters
Section titled “Path parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
collection_name | string | Yes | Name of the collection to delete |
Response
Section titled “Response”The service returns a 200 OK status code with this response:
{ "message": "Collection is deleted successfully"}It returns this even when the collection didn’t exist or the delete failed, so a 200 doesn’t prove anything was removed. To check, get the collection afterwards and expect a 404.
Error scenarios
Section titled “Error scenarios”| Status | Description |
|---|---|
| 400 | Invalid collection name format |
| 403 | The Authorization header is missing or doesn’t match the API key |
Example request
Section titled “Example request”curl -X DELETE https://answers.tallyfy.com/collections/products \ -H "Authorization: Bearer your_api_key"Before you delete
Section titled “Before you delete”If a batch import is still running for the collection, stop it first with DELETE /tasks/{collection_name} (see Tasks). Deleting the collection doesn’t stop the import.
When to delete a collection
Section titled “When to delete a collection”Consider deleting a collection when:
- The data is no longer needed for any purpose
- You need to rebuild a collection with a different structure
- You want to remove test or development data
- You’re performing cleanup of unused resources
Alternatives to deletion
Section titled “Alternatives to deletion”Instead of permanently deleting a collection, you might consider these alternatives:
- Export the data first with
GET /collections/{collection_name}/objects, which returns every object’s properties - Delete every object but keep the collection with
DELETE /collections/{collection_name}/objects - Create a new collection with only the objects you want to keep
- Use application-level filtering to hide certain objects from users
Best practices
Section titled “Best practices”- Always confirm collection names before deletion
- Consider implementing a confirmation step in your application
- Back up important data before deletion
- Use descriptive logging to track deletion operations
- Keep the API key out of anything that doesn’t need it, since it can delete collections
Related articles
Section titled “Related articles”Collections > Create a collection
Footnotes
Section titled “Footnotes”-
Tallyfy’s semantic search and knowledge management system using vector embeddings ↩