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

# POST /v1/whatsapp/media/get

`POST /v1/whatsapp/media/get`

Get a media file from the WhatsApp service. On successful completion the media file is retrieved from Meta and stored in the specified Amazon S3 bucket. Use either <code>destinationS3File</code> or <code>destinationS3PresignedUrl</code> for the destination. If both are used then an <code>InvalidParameterException</code> is returned.

## Request body

- object
  - `mediaId` string, required — The unique identifier for the media file.
  - `originationPhoneNumberId` string, required — The unique identifier of the originating phone number for the WhatsApp message media. 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.
  - `metadataOnly` boolean — Set to <code>True</code> to get only the metadata for the file.
  - `destinationS3PresignedUrl` 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>
  - `destinationS3File` 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

- GetWhatsAppMessageMediaOutput
  - `mimeType` string — The MIME type of the media.
  - `fileSize` integer — The size of the media file, in KB.

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