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

# Get media URL

> Retrieve the download URL for a media file.

**Important:** The returned URL is temporary and expires after 5 minutes.




## OpenAPI

````yaml /api/meta/whatsapp/openapi-whatsapp.yaml get /{media_id}
openapi: 3.1.0
info:
  title: Kapso Meta Proxy API
  version: 1.0.0
  description: >
    Kapso's Meta Proxy API provides a unified interface to WhatsApp Business
    Platform with enhanced features and Kapso-specific extensions.


    This API acts as a proxy layer between your application and WhatsApp,
    adding:

    - Simplified authentication with project-level API keys

    - Enhanced message metadata and tracking

    - Conversation management capabilities

    - Voice call integration

    - Extended contact and template management


    ## Base URL


    All API requests are made to: `https://api.kapso.ai/meta/whatsapp/v24.0`


    ## Authentication


    The API supports authentication via **X-API-Key header** (recommended):


    ```

    X-API-Key: your_project_api_key

    ```


    Alternative: Bearer token authentication is also supported for backward
    compatibility:


    ```

    Authorization: Bearer your_access_token

    ```


    Note: X-API-Key is the recommended authentication method for the Meta Proxy
    API.
  contact:
    name: Kapso Support
    url: https://kapso.ai
    email: dev@kap.so
servers:
  - url: https://api.kapso.ai/meta/whatsapp/v24.0
    description: Production server
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Messages
    description: Send and retrieve WhatsApp messages
  - name: Conversations
    description: Manage WhatsApp conversations
  - name: Contacts
    description: Manage WhatsApp contacts
  - name: Templates
    description: Manage message templates
  - name: Media
    description: Upload and retrieve media files
  - name: Calls
    description: Manage voice calls
  - name: Settings
    description: Account settings and configuration
  - name: Business Profile
    description: Business profile management
  - name: Phone Numbers
    description: Phone number management
  - name: Flows
    description: WhatsApp Flow management (Beta)
  - name: Block Users
    description: Block and unblock WhatsApp users
  - name: Usernames
    description: Reserve and manage WhatsApp business usernames
paths:
  /{media_id}:
    parameters:
      - name: media_id
        in: path
        required: true
        description: Media ID returned from upload
        schema:
          type: string
        example: '2621233374848975'
    get:
      tags:
        - Media
      summary: Get media URL
      description: >
        Retrieve the download URL for a media file.


        **Important:** The returned URL is temporary and expires after 5
        minutes.
      operationId: getMediaUrl
      parameters:
        - name: phone_number_id
          in: query
          required: true
          description: Phone number ID that owns this media
          schema:
            type: string
          example: '110987654321'
      responses:
        '200':
          description: Media URL retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  messaging_product:
                    type: string
                    enum:
                      - whatsapp
                    example: whatsapp
                  id:
                    type: string
                    description: Media ID
                    example: '2621233374848975'
                  url:
                    type: string
                    format: uri
                    description: Temporary download URL (valid for 5 minutes)
                    example: >-
                      https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=...
                  mime_type:
                    type: string
                    description: MIME type
                    example: image/jpeg
                  sha256:
                    type: string
                    description: File hash
                    example: >-
                      81d3bd8a8db4868c9520ed47186e8b7c5789e61ff79f7f834be6950b808a90d3
                  file_size:
                    type: string
                    description: File size in bytes (returned as string)
                    example: '303833'
                  download_url:
                    type: string
                    format: uri
                    description: >
                      Kapso-hosted authenticated download URL. Valid for 4
                      minutes.

                      Use this URL to download the media file without needing to
                      pass auth headers — authentication is embedded in the
                      token.
                    example: >-
                      https://api.kapso.ai/meta/whatsapp/media_download?token=...
                  download_url_expires_at:
                    type: string
                    format: date-time
                    description: ISO 8601 expiry timestamp for `download_url`.
                    example: '2026-03-13T12:34:56.000Z'
              example:
                messaging_product: whatsapp
                url: >-
                  https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=2621233374848975&ext=1234567890&hash=...
                mime_type: image/jpeg
                sha256: >-
                  81d3bd8a8db4868c9520ed47186e8b7c5789e61ff79f7f834be6950b808a90d3
                file_size: '303833'
                id: '2621233374848975'
                download_url: >-
                  https://api.kapso.ai/meta/whatsapp/media_download?token=eyJfcmFpbHMiOnsibWVzc2FnZSI6...
                download_url_expires_at: '2026-03-13T12:34:56.000Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Media not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
            - code
          properties:
            message:
              type: string
              description: Human-readable error message
              example: Invalid phone number format
            type:
              type: string
              description: Error category
              example: OAuthException
            code:
              type: integer
              description: Error code
              example: 400
            error_subcode:
              type: integer
              description: More specific error code
              example: 1001
            fbtrace_id:
              type: string
              description: Facebook trace ID for debugging
              example: AXk7s_8dR4eVHp9Kq2MmNlO
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        Project API key for authentication. This is the recommended
        authentication method.


        Get your API key from the Kapso dashboard under Integrations > API keys.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Bearer token authentication (alternative method).

        Note: X-API-Key authentication is recommended for the Meta Proxy API.

````