Skip to main content
Delete File
Deletes a file record and removes all associated storage objects. For image files, all generated variants are also deleted. Requires authentication. The owner deletes: a file with an owner is deleted only as that user — with their own access token, or with a service key naming them in actingUserId, and the request then runs exactly as theirs (suspension included). An app-owned file (uploaded without an actingUserId) is deleted only by a service key naming nobody; a user token gets 403. The owner can delete any of their files here except these, refused with 409 storage/file-attached:
  • a chat message’s file: it’s removed when the message is deleted;
  • a live comment’s file: it’s removed when the comment is deleted;
  • a live entity’s file: remove it with removeFileIds on Update Entity;
  • a user’s or space’s avatar or banner (the file its avatarFileId or bannerFileId points at): remove it with removeFileIds on Update User or Update Space;
  • a conversation’s avatar (the file its avatarFileId points at): remove it with removeFileIds on Update Conversation;
  • a live event’s file, its cover included: remove it with removeFileIds on Update Event.
A file whose comment was deleted, or whose entity or event was soft-deleted with its files kept (see Delete Entity and Delete Event), belongs to nothing, an event’s cover included, as does a file whose record no longer exists: its owner deletes it here like any other file. Rate limit: 50 requests per 5 minutes.

Path Parameters

string
required
The UUID of the file to delete.

Query Parameters

string
Service key only: the user this delete acts as. Required when the file has an owner: name the owner (naming anyone else gets 403). Leave it out only for an app-owned file. A user token always acts as its own user and must not send it, and neither may a request with no credentials (400 storage/acting-user-not-allowed).

Response

204 No Content on success, with no body. The original file and every image variant made from it are removed from storage.

Error Responses

Returned when fileId isn’t a valid UUID. Checked before sign-in, permissions and the endpoint’s other checks.
Returned when the acting user doesn’t own the file, or when a user token, or a service key naming a user, deletes an app-owned file.
The file is a chat message’s file, a live comment’s or entity’s file, a user’s or space’s avatar or banner, a conversation’s avatar, or a live event’s file (its cover included). error names which, and how to remove it. Checked after the owner check, so only the file’s owner learns this.
A chat message’s file:
A live comment’s file:
A live entity’s file:
A live event’s file or cover:
A conversation’s avatar:
A service key sent no actingUserId for a file that has an owner. Name the owner: the request then runs exactly as their own.
A user token, or a request with no credentials, sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.