Files
Delete an uploaded file
Deletes an uploaded file right away. It can no longer be sent by file_id. Messages already sent with it keep their own copy, so their media_url keeps working. A file that was sent is kept until you delete it; an unsent one is deleted by itself after 24 hours.
- Bearer API key
- Scope:
writeor admin - or app session
- Workspace:
X-Tenant-ID(optional with a key)
Path parameters
iduuidrequiredFile id: the
idreturned by Upload a file.
Headers
AuthorizationstringrequiredYour API key as
Bearer <key>. The wordBearerand the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.X-Tenant-IDuuidoptionalWorkspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass
?tenant=<id>instead.
Response
Status codes
- 204No content. The file was deleted. There is no body.
- 400Bad request. The id is not a valid UUID (
invalid file id). - 401Unauthorized. The API key is unknown, revoked or expired (
invalid or expired API key), or there is no key and no signed-in session (unauthorized). - 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes
code: "payment_required". - 403Forbidden. The API key has the
readscope, which only allows GET requests (API key is read-only). A key in another workspace getsAPI key belongs to a different workspace; a key used from an IP address outside itsallowed_ipsgetsthis API key is not allowed from your IP address(code: "ip_not_allowed"). - 404Not found. No such file in this workspace (
file not found): the id is unknown, the file was deleted or has expired, or it belongs to another workspace. - 500Server error. Something went wrong on our side. Retry with backoff.
Each delete is recorded in the audit log as file.deleted.