> ## Documentation Index
> Fetch the complete documentation index at: https://docs.minimo.it/llms.txt
> Use this file to discover all available pages before exploring further.

# Download Media

> Download a voice note, image, video or document a contact sent you

A `whatsapp.message.received` event never carries the file: it carries `message.media.providerMediaId`. Pass that id
here to get the file itself, with its `Content-Type` (and the filename in `Content-Disposition` for documents). You
need no WhatsApp provider credentials.

## Permissions

The API key needs the **WhatsApp** or **Transactional** permission. Only media received on your own numbers can be
downloaded: any other id answers `404`.


## OpenAPI

````yaml get /public/v1/media/{id}
openapi: 3.1.0
info:
  title: API Documentation
  description: Documentation for transactional and subscribe APIs
  version: 1.0.0
servers:
  - url: https://app.minimo.it
security:
  - bearerAuth: []
paths:
  /public/v1/media/{id}:
    servers:
      - url: https://api.minimo.it
    get:
      summary: Download a received media
      description: >-
        The file of a voice note, image, video or document a contact sent you,
        by the `message.media.providerMediaId` of the webhook event. Answers the
        file itself, with its `Content-Type`.
      operationId: downloadInboundMedia
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            The `message.media.providerMediaId` from a
            `whatsapp.message.received` event.
          schema:
            type: string
      responses:
        '200':
          description: >-
            The file. `Content-Type` is its type; documents also carry
            `Content-Disposition` with the filename.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '401':
          description: >-
            Missing or invalid API key, or a key without the `WhatsApp` or
            `Transactional` permission.
        '404':
          description: >-
            Not a media received on your numbers, or the file is no longer
            available.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: FAIL
                  message:
                    type: string
      security:
        - bearerAuth: []
      x-codeSamples:
        - label: CLI
          lang: cURL
          source: |-
            curl --request GET \
              --url 'https://api.minimo.it/public/v1/media/1234567890123456' \
              --header 'Authorization: Bearer {{BEARER_TOKEN}}' \
              --output attachment
        - lang: JavaScript
          source: >-
            const res = await
            fetch('https://api.minimo.it/public/v1/media/1234567890123456', {
              method: 'GET',
              headers: {
                'Authorization': 'Bearer {{BEARER_TOKEN}}',
              },
            });

            const file = await res.arrayBuffer();

            console.log(res.headers.get('content-type'), file.byteLength);
        - lang: Python
          source: |-
            import requests

            res = requests.get(
                'https://api.minimo.it/public/v1/media/1234567890123456',
                headers={'Authorization': 'Bearer {{BEARER_TOKEN}}'},
            )
            open('attachment', 'wb').write(res.content)
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: mn-API_CLIENT_ID-API_KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.