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

# Temporary media uploads

> Prepare temporary media before sending direct messages from the MsgFlash console.

## What this upload is for

In the MsgFlash dashboard, media messages and media campaigns use a temporary upload before final sending.

Typical cases:

* image
* video
* document
* audio
* voice note

The backend then returns a temporary URL that can be reused for sending.

***

## Endpoint used by the dashboard

```txt theme={null}
POST /api/media/upload
```

Authentication:

```txt theme={null}
Authorization: Bearer <jwt_console>
```

This route is not a public `x-api-key` endpoint.

***

## Useful response

```json theme={null}
{
  "data": {
    "id": "med_uuid",
    "url": "https://cdn.example.com/tmp/file.jpg",
    "type": "image",
    "mimeType": "image/jpeg",
    "sizeBytes": 248112,
    "originalName": "visuel.jpg",
    "expiresAt": "2026-04-05T12:00:00.000Z",
    "suggestedMessageType": "image"
  }
}
```

Important fields:

* `url`: temporary URL to reuse in `mediaUrl`
* `expiresAt`: expiration timestamp
* `suggestedMessageType`: UI hint for the correct media type

***

## Product constraints visible in the dashboard

* the generated link is temporary
* the link may be publicly accessible
* media scheduled after `expiresAt` may fail to send

The dashboard should therefore warn users when a message or campaign is scheduled after the expiration date.

***

## Product-supported sizes and formats

| Type         | Supported examples                        |
| ------------ | ----------------------------------------- |
| `image`      | JPEG, PNG, WEBP, GIF                      |
| `video`      | MP4, 3GPP                                 |
| `document`   | PDF, DOC, DOCX, XLS, XLSX                 |
| `audio`      | MP3, OGG, MP4 audio, AAC, AMR             |
| `voice_note` | MP3, OGG, WEBM audio, MP4 audio, AAC, AMR |

Current product limits:

* image: 5 MB
* document: 10 MB
* video: 16 MB
* audio: 16 MB
* voice note: 16 MB

***

## Where this flow is used

* "New message" page
* campaign composer v2 in direct message mode
* voice note recording and upload

For the public API, you can also provide your own `mediaUrl` directly if you already host the file.
