---
title: "POST /v1/whatsapp/media"
method: POST
path: "/v1/whatsapp/media"
---

# POST /v1/whatsapp/media

`POST /v1/whatsapp/media`

Upload a media file to the WhatsApp service. Only the specified <code>originationPhoneNumberId</code> has the permissions to send the media file when using <a href="https://docs.aws.amazon.com/social-messaging/latest/APIReference/API_SendWhatsAppMessage.html">SendWhatsAppMessage</a>. You must use either <code>sourceS3File</code> or <code>sourceS3PresignedUrl</code> for the source. If both or neither are specified then an <code>InvalidParameterException</code> is returned.

## Request body

- object
  - `originationPhoneNumberId` string, required — The ID of the phone number to associate with the WhatsApp media file. The phone number identifiers are formatted as <code>phone-number-id-01234567890123456789012345678901</code>. Use <a href="https://docs.aws.amazon.com/social-messaging/latest/APIReference/API_GetLinkedWhatsAppBusinessAccount.html">GetLinkedWhatsAppBusinessAccount</a> to find a phone number's id.
  - `sourceS3PresignedUrl` object — You can use presigned URLs to grant time-limited access to objects in Amazon S3 without updating your bucket policy. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html">Working with presigned URLs</a> in the <i>Amazon S3 User Guide</i>.
    - `url` string — The presign url to the object.
    - `headers` object — A map of headers and their values. You must specify the <code>Content-Type</code> header when using <code>PostWhatsAppMessageMedia</code>. For a list of common headers, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html">Common Request Headers</a> in the <i>Amazon S3 API Reference</i>
  - `sourceS3File` object — Contains information for the S3 bucket that contains media files.
    - `bucketName` string — The bucket name.
    - `key` string — <p>The S3 key prefix that defines the storage location of your media files. The prefix works like a folder path in S3, and is combined with the WhatsApp mediaId to create the final file path.</p> <p>For example, if a media file's WhatsApp mediaId is <code>123.ogg</code>, and the key is <code>audio/example.ogg</code>, the final file path is <code>audio/example.ogg123.ogg</code>.</p> <p>For the same mediaId, a key of <code>audio/</code> results in the file path <code>audio/123.ogg</code>.</p>

## Response `200`

Success

- PostWhatsAppMessageMediaOutput
  - `mediaId` string — The unique identifier of the posted WhatsApp message.

## Other responses

- `480` — ValidationException
- `481` — AccessDeniedException
- `482` — ResourceNotFoundException
- `483` — InvalidParametersException
- `484` — AccessDeniedByMetaException
- `485` — ThrottledRequestException
- `486` — InternalServiceException
- `487` — DependencyException

---

[API](https://skmtc.net/aws/apis/socialmessaging.md) · [All operations](https://skmtc.net/aws/apis/socialmessaging/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/socialmessaging/versions/127e73cd9a15/schema)
