Collections > Delete a collection
Delete an object
Deleting objects from collections
Section titled “Deleting objects from collections”This endpoint permanently removes a specific object from a Tallyfy Answers collection using its unique identifier. Once deleted, you can’t recover an object.
API endpoint
Section titled “API endpoint”DELETE /collections/{collection_name}/objects/{object_id}This endpoint needs the API key.
Request parameters
Section titled “Request parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
collection_name | path | Yes | Name of the collection containing the object |
object_id | path | Yes | The object’s uid, the identifier you set when you imported it |
Response
Section titled “Response”The service returns a 200 OK status code with this response:
{ "message": "Object is deleted successfully"}It deletes every object in the collection with that uid. It doesn’t check that a matching object existed first, so a 200 doesn’t prove anything was removed.
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/objects/product-123 \ -H "Authorization: Bearer your_api_key"Important considerations
Section titled “Important considerations”Permanent action
Object deletion is permanent and can’t be undone. There’s no “trash” or “recycle bin” for deleted objects.
- Verify you have the correct
uidbefore deletion - Consider archiving objects in your application logic instead of deleting them if you might need them later
- Deleting an object removes it from search results
- To delete several objects, call this endpoint once for each. To empty a collection,
DELETE /collections/{collection_name}/objectsremoves every object and keeps the collection. - Consider implementing confirmation workflows in your application before calling this endpoint
Alternative approaches
Section titled “Alternative approaches”Instead of deleting objects, consider these alternatives:
- Add a “status” field to mark objects as inactive
- Move objects to an “archive” collection
- Implement soft deletion1 by adding a “deleted_at” timestamp field
Related articles
Section titled “Related articles” The DELETE endpoint permanently removes collections and all their objects from Tallyfy Answers…
Objects are the JSON records you store in a Tallyfy Answers collection. They’re indexed in…
Collections in Tallyfy Answers group similar objects together, like database tables. You can…
Objects > Index multiple objects
The batch import endpoint queues a JSON array of objects for indexing into a Tallyfy Answers…
Footnotes
Section titled “Footnotes”-
Records marked as deleted but retained in database, unlike hard deletion which permanently removes data ↩
About Tallyfy