---
title: "Upload file"
method: POST
path: "/forward-upload/{account_phone_number}"
tags: ["Upload"]
---

# Upload file

`POST /forward-upload/{account_phone_number}`

## Request

- Base URL: `https://api.commpeak.com/textpeak/streams`
- URL: `https://api.commpeak.com/textpeak/streams/forward-upload/{account_phone_number}`
- Auth: API key in header `Authorization`

Upload a media file to use in WhatsApp sends. The response returns a `media_id` that you then pass to the **Send Media** endpoint. Send the file as `multipart/form-data`.

**File types.** Images (`image/jpeg`, `image/png`, `image/webp`), video (`video/mp4`, `video/3gpp`), audio (`audio/aac`, `audio/mp4`, `audio/mpeg`, `audio/amr`, `audio/ogg`, `audio/opus`) and documents (PDF, plain text, Word, Excel, PowerPoint). WhatsApp's own size limits apply.

**Timing.** The file is passed on to WhatsApp after this call returns. Send it within 20 minutes; a `media_id` used before processing finishes, or after it expires, fails with `0x17`.

**Response.** Always HTTP `200`: the upload's own status is in `status_code`, and its result or error in `remote_response`.

**Authentication:** stream token in the `Authorization` header (see **Authentication** in the API Overview).

## Path parameters

- `account_phone_number` string, required: The WhatsApp Business sender phone number of this stream that the media is for, in international format, digits only.

## Request body `multipart/form-data`

- BodyStreamsUploadMedia
  - `file` string, binary, required: The media file. Its content type must be one of the allowed types.

## Response `200`

Successful Response

- UploadResponse
  - `status_code` integer, required: HTTP status of the upload itself. This response is always HTTP `200`: check this field.
  - `remote_response` UploadResult, required
    - `status` boolean, nullable: `true` when the file was accepted.
    - `uploaded_media` UploadedMedia[], nullable: The uploaded file.
      - `file_name` string, required: The uploaded file name.
      - `media_id` string, required: Pass this as `media.media_id` on **Send WhatsApp media** or `simple_send`. Valid for 20 minutes.
      - `download_url` string, required: URL to retrieve the uploaded media.
    - `error_code` string, nullable: On failure: the hex error code, for example `0x17` (file type not allowed, or the phone number is not a sender of this stream).
    - `message` string, nullable: On failure: the error detail.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/commpeak/apis/commpeak-textpeak-streams-api.md) - [All operations](https://skmtc.dev/commpeak/apis/commpeak-textpeak-streams-api/llms.txt) - [OpenAPI document](https://skmtc.dev/commpeak/apis/commpeak-textpeak-streams-api/revisions/b9aaa8b4efa2?raw)
