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

# Upload de Mídia

> Envie um arquivo e obtenha um media_id para usar em mensagens

<Note>Requer **token de instância**.</Note>

Após o upload, use o `id` retornado no campo `id` (em vez de `link`) ao enviar mensagens de imagem, documento, áudio ou vídeo.

## Limites por tipo

| Tipo      | MIME types                                          | Tamanho máximo |
| --------- | --------------------------------------------------- | -------------- |
| Imagem    | `image/jpeg`, `image/png`, `image/webp`             | 5 MB           |
| Áudio     | `audio/aac`, `audio/mp4`, `audio/mpeg`, `audio/ogg` | 16 MB          |
| Vídeo     | `video/mp4`, `video/3gp`                            | 16 MB          |
| Documento | `application/pdf`, `text/plain`, Office             | 100 MB         |
| Sticker   | `image/webp` (animado ou estático)                  | 100 KB         |

## Parâmetros

### Body (multipart/form-data)

<ParamField body="file" type="file" required>
  Arquivo a ser enviado.
</ParamField>

<ParamField body="type" type="string" required>
  MIME type do arquivo. Ex: `image/jpeg`.
</ParamField>

<ParamField body="messaging_product" type="string" required>
  Sempre `"whatsapp"`.
</ParamField>

## Exemplo

```bash theme={null}
curl -X POST https://apis.vectalk.com.br/api/media \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/caminho/para/imagem.jpg" \
  -F "type=image/jpeg" \
  -F "messaging_product=whatsapp"
```

## Resposta

```json theme={null}
{
  "id": "1234567890"
}
```

Use o `id` em uma mensagem de imagem:

```json theme={null}
{
  "messaging_product": "whatsapp",
  "to": "5511999999999",
  "type": "image",
  "image": {
    "id": "1234567890",
    "caption": "Confira!"
  }
}
```
