Upload

Upload file

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).

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

Path parameters

account_phone_numberstring required

The WhatsApp Business sender phone number of this stream that the media is for, in international format, digits only.

Example:12125551234

Request body multipart/form-data

filestring binary required

The media file. Its content type must be one of the allowed types.

Response

Successful Response

status_codeinteger required

HTTP status of the upload itself. This response is always HTTP 200: check this field.

Example response

{
  "remote_response": {
    "status": true,
    "uploaded_media": [
      {
        "download_url": "https://demo.example.com/conv_media/01d1e10f-2b3c-4d5e-6f70-3707906010e2",
        "file_name": "receipt.pdf",
        "media_id": "01d1e10f-2b3c-4d5e-6f70-3707906010e2"
      }
    ]
  },
  "status_code": 200
}

Changes

No recorded changes to this operation across all 1 revision of this API.