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

# Upload media

> Upload media files to WhatsApp. The media ID returned can be used when sending messages.

**Supported formats and size limits:**

**Images** (jpeg, png)
- Max size: 5MB

**Videos** (mp4, 3gp)
- Max size: 16MB

**Audio** (aac, mp3, ogg, opus)
- Max size: 16MB

**Documents** (pdf, doc, docx, ppt, pptx, xls, xlsx)
- Max size: 100MB

**Stickers** (webp)
- Static: max 100KB
- Animated: max 500KB




## OpenAPI

````yaml /api/meta/whatsapp/openapi-whatsapp.yaml post /{phone_number_id}/media
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:
  /{phone_number_id}/media:
    parameters:
      - name: phone_number_id
        in: path
        required: true
        description: WhatsApp Business Phone Number ID
        schema:
          type: string
        example: '110987654321'
    post:
      tags:
        - Media
      summary: Upload media
      description: >
        Upload media files to WhatsApp. The media ID returned can be used when
        sending messages.


        **Supported formats and size limits:**


        **Images** (jpeg, png)

        - Max size: 5MB


        **Videos** (mp4, 3gp)

        - Max size: 16MB


        **Audio** (aac, mp3, ogg, opus)

        - Max size: 16MB


        **Documents** (pdf, doc, docx, ppt, pptx, xls, xlsx)

        - Max size: 100MB


        **Stickers** (webp)

        - Static: max 100KB

        - Animated: max 500KB
      operationId: uploadMedia
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - messaging_product
              properties:
                file:
                  type: string
                  format: binary
                  description: Media file to upload
                messaging_product:
                  type: string
                  enum:
                    - whatsapp
                  description: Always "whatsapp"
            examples:
              upload_image:
                summary: Upload JPEG image
                value:
                  messaging_product: whatsapp
                  file: '@/path/to/image.jpg'
              upload_video:
                summary: Upload MP4 video
                value:
                  messaging_product: whatsapp
                  file: '@/path/to/video.mp4'
              upload_audio:
                summary: Upload OGG audio
                value:
                  messaging_product: whatsapp
                  file: '@/path/to/audio.ogg'
              upload_document:
                summary: Upload PDF document
                value:
                  messaging_product: whatsapp
                  file: '@/path/to/document.pdf'
              upload_sticker:
                summary: Upload WEBP sticker
                value:
                  messaging_product: whatsapp
                  file: '@/path/to/sticker.webp'
      responses:
        '200':
          description: Media uploaded successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Media ID to use when sending messages
                    example: '4490709327384033'
              example:
                id: '4490709327384033'
        '400':
          description: Bad request (invalid file format or size exceeds limit)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          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.

````