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

# Resolve a media ID to Meta's download URL

> Resolve a media ID to Meta's download URL



## OpenAPI

````yaml openapi.json GET /v1/media/{id}
openapi: 3.1.0
info:
  title: Watahub API
  version: 0.2.0
  description: >-
    Tenant API of Watahub, the multi-tenant WhatsApp Cloud API gateway.
    Authenticate every request with your API key as `Authorization: Bearer
    <key>` or `X-API-Key: <key>`.


    - Shapes the gateway owns are closed: no other field appears.

    - Records that come from Meta are open: documented fields are listed and any
    other field Meta adds is passed through.

    - The `/vN.N` proxy passes Meta's body and status through untouched; the
    version in the path is accepted and ignored.
servers:
  - url: https://cloud.watahub.dev
security:
  - bearerApiKey: []
  - headerApiKey: []
tags:
  - name: Messages
  - name: Media
  - name: Templates
  - name: Graph-compatible proxy
    description: >-
      Drop-in for Meta's Graph API on three routes. Meta's response is returned
      as is.
  - name: Phones
    description: Phones
  - name: Conversations
    description: Conversations
  - name: Connect
    description: Connect
  - name: Customers
    description: Customers
  - name: Webhooks
    description: Webhooks
  - name: Logs
    description: Logs
  - name: Health
    description: Health
  - name: Message templates
    description: >-
      Templates cached by the gateway per WABA; synced from Meta and required by
      broadcasts.
  - name: Broadcasts
    description: >-
      Send one approved template to up to 500 recipients; sending is queued and
      drained in the background.
paths:
  /v1/media/{id}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          pattern: ^\d{1,32}$
        description: phoneNumberId for POST, mediaId for GET.
    get:
      tags:
        - Media
      summary: Resolve a media ID to Meta's download URL
      description: >-
        Only for media this tenant uploaded or received. Meta's `mime_type`,
        `sha256` and `file_size` are not returned.
      operationId: getMedia
      parameters:
        - name: id
          in: path
          required: true
          description: Media ID.
          schema:
            $ref: '#/components/schemas/GraphId'
        - name: redirect
          in: query
          required: false
          description: '`true` answers 302 to Meta''s URL instead of JSON.'
          schema:
            type: string
            enum:
              - 'true'
      responses:
        '200':
          description: Meta's URL for the media.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaUrl'
        '302':
          description: With `redirect=true`.
          headers:
            Location:
              description: Meta's URL for the media.
              schema:
                type: string
                format: uri
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    GraphId:
      type: string
      pattern: ^\d+$
      description: Numeric Meta Graph ID.
    MediaUrl:
      type: object
      additionalProperties: false
      required:
        - mediaId
        - url
      properties:
        mediaId:
          type: string
        url:
          type: string
          description: >-
            Meta's temporary URL. It answers only with the number's Meta token:
            download through `GET /v1/media/{mediaId}/content`.
    GatewayError:
      type: object
      description: >-
        An error the gateway or the core answers itself. `error` is a stable
        English message for developers.
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: string
        fields:
          type: array
          items:
            type: string
          description: 'With 400 `Invalid fields`: the paths of the rejected fields.'
        requestId:
          type: string
          description: 'With 500 `Operation unavailable`: the ID to quote to support.'
    ValidationError:
      type: object
      description: The core rejected a value of the body, path, header or query.
      additionalProperties: false
      required:
        - error
        - details
      properties:
        error:
          const: Validation failed
        details:
          type: object
          description: Messages by field name.
          additionalProperties:
            type: array
            items:
              type: string
    MetaError:
      type: object
      description: >-
        Meta failed a `/v1` call. With Meta's error: `code`, its `subcode`,
        `type` on sends, and the core's classification. When Meta could not be
        reached or answered something unusable, only `message`, plus the
        `unknown_outcome` classification on sends.
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - message
          properties:
            message:
              type: string
            code:
              type: integer
              description: Meta's error code; Meta's HTTP status when Meta gave none.
            subcode:
              type: integer
              description: Meta's `error_subcode`.
            type:
              type: string
              description: Meta's error type. Only on message sends.
            category:
              type: string
              enum:
                - auth
                - billing
                - rate_limit
                - meta_server
                - unknown
                - unknown_outcome
            retryable:
              type: boolean
            action:
              type: string
              description: What to do next, in English.
  responses:
    ClientError:
      description: >-
        Rejected by the gateway (`GatewayError`), by the core's validation
        (`ValidationError`, 422) or by Meta (`MetaError`, with Meta's status).
      content:
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/GatewayError'
              - $ref: '#/components/schemas/ValidationError'
              - $ref: '#/components/schemas/MetaError'
    ServerError:
      description: >-
        `GatewayError` for a gateway failure (500 with `requestId`, 503 for
        missing configuration); `MetaError` for a Meta 5XX, an unreachable Meta
        (502) or a Meta timeout (504).
      content:
        application/json:
          schema:
            anyOf:
              - $ref: '#/components/schemas/GatewayError'
              - $ref: '#/components/schemas/MetaError'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: Tenant API key.
    headerApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Tenant API key.

````

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