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

# Download media file

> Download a media file using a short-lived authenticated token.

Tokens are returned in the `download_url` field of the [Get media URL](#operation/getMediaUrl) response.
They expire 4 minutes after issue.

No `X-API-Key` header is needed — authentication is embedded in the token.




## OpenAPI

````yaml /api/meta/whatsapp/openapi-whatsapp.yaml get /media_download
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_download:
    servers:
      - url: https://api.kapso.ai/meta/whatsapp
        description: Kapso Media Download (no version prefix)
    get:
      tags:
        - Media
      summary: Download media file
      description: >
        Download a media file using a short-lived authenticated token.


        Tokens are returned in the `download_url` field of the [Get media
        URL](#operation/getMediaUrl) response.

        They expire 4 minutes after issue.


        No `X-API-Key` header is needed — authentication is embedded in the
        token.
      operationId: downloadMedia
      parameters:
        - name: token
          in: query
          required: true
          description: Signed token from `download_url`
          schema:
            type: string
          example: eyJfcmFpbHMiOnsibWVzc2FnZSI6...
      responses:
        '200':
          description: Media file bytes
          headers:
            Content-Type:
              description: MIME type of the media file
              schema:
                type: string
                example: image/jpeg
            Content-Disposition:
              description: Inline disposition with media ID as filename
              schema:
                type: string
                example: inline; filename="2621233374848975"
            Cache-Control:
              description: Cache directive (tokens are short-lived)
              schema:
                type: string
                example: private, max-age=240
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '404':
          description: Token missing, invalid, expired, or media not found
        '502':
          description: Media download from WhatsApp failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Media download failed
components:
  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.

````