> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leavo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Media

> Send images, audio, and documents

## Endpoint

<Card>
  <strong>POST</strong> `/backend/messages/media`
</Card>

## Body Parameters

<ParamField body="lead_id" type="string" required>
  Recipient lead ID
</ParamField>

<ParamField body="type" type="string" required>
  Media type: `image`, `audio`, `document`, `video`
</ParamField>

<ParamField body="url" type="string" required>
  Public media URL
</ParamField>

<ParamField body="caption" type="string">
  Caption (for images and videos)
</ParamField>

<ParamField body="filename" type="string">
  Filename (for documents)
</ParamField>

## Request Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.leavo.ai/backend/messages/media" \
    -H "Authorization: Bearer your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "lead_id": "lead-uuid",
      "type": "image",
      "url": "https://example.com/image.jpg",
      "caption": "Check out our latest product!"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.leavo.ai/backend/messages/media', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your_api_key_here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      lead_id: 'lead-uuid',
      type: 'document',
      url: 'https://example.com/contract.pdf',
      filename: 'Contract.pdf',
      caption: 'Here is the attached contract'
    })
  });
  ```
</CodeGroup>

## Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "message-uuid",
    "lead_id": "lead-uuid",
    "type": "image",
    "media_url": "https://example.com/image.jpg",
    "caption": "Check out our latest product!",
    "role": "assistant",
    "status": "pending",
    "timestamp": "2024-01-15T10:30:00Z"
  }
}
```

## Supported Formats

<AccordionGroup>
  <Accordion title="Images" icon="image">
    * JPEG (.jpg, .jpeg)
    * PNG (.png)
    * WebP (.webp)
    * Maximum: 5MB
  </Accordion>

  <Accordion title="Audio" icon="microphone">
    * MP3 (.mp3)
    * OGG (.ogg)
    * AAC (.aac)
    * Maximum: 16MB
  </Accordion>

  <Accordion title="Documents" icon="file">
    * PDF (.pdf)
    * Word (.doc, .docx)
    * Excel (.xls, .xlsx)
    * Maximum: 100MB
  </Accordion>

  <Accordion title="Video" icon="video">
    * MP4 (.mp4)
    * 3GP (.3gp)
    * Maximum: 16MB
  </Accordion>
</AccordionGroup>

<Warning>
  URL must be publicly accessible. Private or authentication-required URLs will fail.
</Warning>
