Skip to main content

Get Upload by ID

GET /backend/uploads/{id}
Response (200):
{
  "id": "uuid",
  "tenant_id": "uuid",
  "filename": "product_photo",
  "file_type": "media",
  "file_url": "https://api.leavo.ai/media/proxy/tenant_id/uuid.jpg",
  "mime_type": "image/jpeg",
  "size": 1048576,
  "status": "PENDING",
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

List Tenant Uploads

GET /backend/uploads/tenant/{tenantId}
Returns all tenant uploads, ordered by creation date.

Update Status

PUT /backend/uploads/{id}/status
Body:
{
  "status": "ASSOCIATED"
}
StatusDescription
PENDINGUpload not yet linked
ASSOCIATEDUpload linked to an entity (protected from cleanup)

Delete Upload

DELETE /backend/uploads/{id}
Removes the file from storage and the database record. Response: 200 OK

Cleanup Orphaned Uploads

POST /backend/uploads/cleanup?hours=24
Removes uploads with PENDING status older than the specified number of hours.
ParameterTypeDefaultDescription
hoursinteger24Minimum hours since creation

Public File Access

Files can be accessed publicly through the media proxy:
GET /media/proxy/{path}
The proxy sets the following headers:
  • Content-Type: file MIME type
  • Cache-Control: public, max-age=86400 (24 hours)
  • Access-Control-Allow-Origin: *