---
title: "Upload media to WhatsApp"
method: POST
path: "/messages/upload-media"
tags: ["Messages"]
---

# Upload media to WhatsApp

`POST /messages/upload-media`

## Request

- Base URL: `https://messenger-public-api.cogfy.com`
- URL: `https://messenger-public-api.cogfy.com/messages/upload-media`
- Auth: API key in header `api-key`
- TypeScript: <https://skmtc.dev/indigohive/apis/cogfy-messenger-public-api/docs/messages/upload-media/post.ts> (a function with typed inputs; its response is checked against the schema)

Uploads a file to WhatsApp Cloud API. Use the returned id as document.id when calling POST /messages/document.

## Request body

- object
  - `from` string, required: WhatsApp phone number ID (sender)
  - `media` object, required
    - `mimeType` string, required: MIME type of the file (e.g. application/pdf)
    - `base64` string, required: File bytes as base64 (optional data URL prefix supported)
    - `name` string: Filename hint for upload

## Response `200`

Media uploaded successfully

- object
  - `id` string: WhatsApp media id (use as document.id for send document)

## Changes

- **2026-07-28** `8ccfb9a461e2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/indigohive/apis/cogfy-messenger-public-api/changes/messages/upload-media/post.md)

---

[API](https://skmtc.dev/indigohive/apis/cogfy-messenger-public-api.md) - [All operations](https://skmtc.dev/indigohive/apis/cogfy-messenger-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/indigohive/apis/cogfy-messenger-public-api/revisions/30bd33ee45c9?raw)
