Skip to main content

DELETE /api/storage/file

Permanently removes a file from storage. You must provide the path value that was returned when the file was uploaded. This operation cannot be undone.

Required Headers

HeaderValue
x-api-keyYour pk_live_… or sk_live_… key
Content-Typeapplication/json

Request Body

path
string
required
The storage path of the file to delete, in the format PROJECT_ID/filename.ext. This is the path field returned by the upload endpoint — not the public URL.

Response Fields

success
boolean
true when the file was deleted successfully.
message
string
Human-readable confirmation message.

Code Examples

const res = await fetch('https://api.ub.bitbros.in/api/storage/file', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'pk_live_YOUR_KEY'
  },
  body: JSON.stringify({
    path: 'PROJECT_ID/image.png'
  })
});

const { success, message } = await res.json();

Success Response

{
  "success": true,
  "data": {},
  "message": "File deleted successfully"
}

Errors

StatusCause
401 UnauthorizedMissing or invalid API key
404 Not FoundThe path does not exist or the file was already deleted