Skip to main content

Upload File

POST /backend/uploads
Content-Type: multipart/form-data

Form Parameters

FieldTypeRequiredDescription
filefileYesFile to upload (max 10 MB)
typestringNoFile type: media or audio (default: media)
folderstringNoFolder to organize the file in storage

Example

curl -X POST "https://api.leavo.ai/backend/uploads" \
  -H "Authorization: Bearer your_api_key_here" \
  -F "file=@product_photo.jpg" \
  -F "type=media"

Response (200)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "tenant_id": "d6b10acc-2307-413f-a4de-4c2edf3f9a70",
  "filename": "product_photo",
  "file_type": "media",
  "file_url": "https://api.leavo.ai/media/proxy/d6b10acc/550e8400.jpg",
  "mime_type": "image/jpeg",
  "size": 1048576,
  "status": "PENDING",
  "created_at": "2024-01-15T10:30:00Z"
}

Send Media in Message

After uploading, use the file to send a media message:
POST /backend/messages/send-media
Content-Type: multipart/form-data
FieldTypeRequiredDescription
channel_idUUIDYesChannel to send through
remote_jidstringYesRecipient (WhatsApp JID)
message_typestringYesimage, audio, video, or document
contentstringNoMedia caption
filefileYesMedia file

Common Errors

CodeDescription
400File not provided or invalid format
413File exceeds 10 MB limit