Skip to main content

Delete an object

Permanently deletes an object. The database record and the stored file are removed together (a model event cleans up the bytes), so there are no orphaned files.

DELETE /api/v1/objects/{public_id}

Permission: write

Request

Path parameters

ParameterDescription
public_idThe ULID of the object to delete. Must belong to the key's project.

Headers

HeaderRequiredNotes
X-API-KeyYesA key with write permission.

Example

curl
curl -X DELETE https://fileshub.zaions.com/api/v1/objects/01JDKQXXXXXXXXXXXXXXXXXXXXX \
-H "X-API-Key: fh_live_xxx"
fetch
const res = await fetch(`https://fileshub.zaions.com/api/v1/objects/${publicId}`, {
method: 'DELETE',
headers: { 'X-API-Key': 'fh_live_xxx' },
});
if (res.ok) {
// object gone — drop the url from your record
}

Response

200 OK

{ "message": "Deleted" }

Errors

StatusWhenBody
401No / invalid X-API-Key.{ "message": "..." }
403Key lacks write permission.{ "message": "..." }
404Object not found, or it belongs to a different project.{ "message": "Not found" }
500Server error during deletion.{ "message": "An error occurred while deleting the object." }

Notes

  • Deletion is permanent — there is no trash or undo. Confirm in your own UI before calling.
  • A key can only delete objects in its own project; cross-project deletes return 404 so existence isn't leaked.
  • When you delete a record from your app, also delete the FilesHub object so storage doesn't accumulate orphans. (This is exactly what the file-cleanup convention in the wider FilesHub integration guide recommends.)