# Upload media for an agent message (v2)

Upload a media file and receive a hosted mediaUrl (plus the detected mediaType) to attach to a Send an agent message call. Channel-agnostic — the same uploaded URL can be sent on WhatsApp, web, or Facebook.

Endpoint: POST /pl4chat-service/api/v2/messages/media
Version: 3.0.0
Security: apikeyAuth

## Request fields (multipart/form-data):

  - `file` (string, required)
    The media file to upload (image, document, video, audio).

## Response 200 fields (application/json):

  - `mediaUrl` (string)
    Hosted URL of the stored media. Pass this as mediaUrl on the send request.
    Example: "https://cdn.example.com/uploads/quote-1234.pdf"

  - `mediaType` (string)
    Detected media kind.
    Enum: "DOCUMENT", "IMAGE", "VIDEO", "NULL", "BUTTON", "FILE", "AUDIO", "VOICE"

## Response 400 fields (application/json):

  - `status` (string)
    Example: "ERROR"

  - `message` (string)
    Example: "Invalid Parameters"

  - `requestId` (string)
    Example: "c3a1f8e2-4b6d-11ee-be56-0242ac120002"

  - `timestamp` (string)
    Example: "2026-01-15T10:30:00Z"

## Response 401 fields (application/json):

  - `status` (string)
    Example: "ERROR"

  - `message` (string)
    Example: "Unauthorized user"

  - `requestId` (string)
    Example: "c3a1f8e2-4b6d-11ee-be56-0242ac120002"

  - `timestamp` (string)
    Example: "2026-01-15T10:30:00Z"


