Skip to main content

DELETE /api/documents/

Permanently deletes a document and its associated file from storage. This action cannot be undone.

Authentication

This endpoint requires authentication using Laravel Sanctum. Include the bearer token in the Authorization header.

Path parameters

id
integer
required
The ID of the document to delete

Headers

Authorization
string
required
Bearer token obtained from login endpoint
Accept
string
Set to application/json

Authorization

Users can only delete their own documents. Attempting to delete another user’s document will return a 404 error.
This action permanently deletes both the document metadata and the physical file from storage. This cannot be undone.

Response

message
string
Success message confirming the deletion

Example request

curl -X DELETE https://api.filebright.com/api/documents/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Example response

200 - Success
{
  "message": "Document deleted successfully"
}
401 - Unauthorized
{
  "message": "Unauthenticated."
}
404 - Not found
{
  "message": "Document not found"
}
A 404 error is returned both when the document doesn’t exist and when attempting to delete another user’s document. This prevents information disclosure about document existence.

Build docs developers (and LLMs) love