BobaBanana API

DELETE /v1/files/{file_id}: delete an uploaded file

DELETE /v1/files/{file_id} is the endpoint to delete an uploaded file. Deletes the upload and its bytes. Refused with 409 while an unfinished job uses it.

View as Markdown

At a glance

Endpoint
DELETE /v1/files/{file_id}
Base URL
https://bobabanana.com/api/v1
Auth
Authorization: Bearer bb_...
Success
200
Safe to retry
no body to repeat; repeating it is harmless
Guide
Files

Request#

Path parameters#

Path parameters
Name Type Required Default Limits Description
file_id string yes The upload's id, e.g. file_3f9c2a1b7d4e.

Headers#

Headers
Header Required Description
Authorization yes Bearer bb_...: your API key (or send X-API-Key: bb_...)

Example request#

curl
curl -X DELETE https://bobabanana.com/api/v1/files/file_3f9c2a1b7d4e \
  -H "Authorization: Bearer $BOBABANANA_API_KEY"
Python
import os

import requests

r = requests.delete(
    "https://bobabanana.com/api/v1/files/file_3f9c2a1b7d4e",
    headers={"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}"},
    timeout=60,
)
r.raise_for_status()
print(r.json())
JavaScript
const res = await fetch("https://bobabanana.com/api/v1/files/file_3f9c2a1b7d4e", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`,
  },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
console.log(await res.json());

Response#

200: Successful Response

{
  "id": "file_3f9c2a1b7d4e",
  "object": "file",
  "deleted": true
}

Errors#

Errors use the error object. The codes this endpoint can return (what to do about each is in Error codes):

Errors
Status Code Meaning
400 bad_request The Content-Length header is not a number.
401 invalid_api_key The key is wrong, revoked or belongs to no workspace.
401 missing_api_key No API key was sent.
403 workspace_suspended The workspace that owns the key is suspended.
404 file_not_found No live upload with this id in the workspace (expired or deleted).
409 file_in_use The upload is an input of an unfinished job.
413 too_large The request body is over the limit for this endpoint (JSON bodies 100 MB, uploads 64 MB).
429 too_many_attempts Too many requests with wrong keys came from your address. Retry-After is set.
500 internal_error Something went wrong on our side.
503 maintenance BobaBanana is being updated; changes are paused for a few minutes. Reads still work. Retry-After is set.