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

# Obter mídia como base64

> Baixa uma mensagem de mídia e a retorna como uma string base64.



## OpenAPI

````yaml openapi.evolution-v2.pt.json POST /chat/getBase64FromMediaMessage/{instance}
openapi: 3.1.0
info:
  title: Evolution V2 Layer
  version: 1.0.0
  description: >-
    Camada de API do Pilot Status — Evolution V2. Base URL
    `https://pilotstatus.com.br/api/layer/evolution-v2`. Autentique com o header
    `apikey` (sua chave `ps_` do Pilot Status). Endpoints de instância/sessão
    NÃO estão disponíveis na camada.
servers:
  - url: https://pilotstatus.com.br/api/layer/evolution-v2
security:
  - apiKey: []
tags:
  - name: Chamada e Business
  - name: Chat
  - name: Grupo
  - name: Etiqueta (Label)
  - name: Mensagem
  - name: Perfil
  - name: Configurações e Proxy
  - name: Armazenamento (S3)
  - name: Template
paths:
  /chat/getBase64FromMediaMessage/{instance}:
    post:
      tags:
        - Chat
      summary: Obter mídia como base64
      description: Baixa uma mensagem de mídia e a retorna como uma string base64.
      operationId: post__chat_getBase64FromMediaMessage_instance
      parameters:
        - name: instance
          in: path
          required: true
          schema:
            type: string
          description: O nome de exibição do número no painel do Pilot Status.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: object
                  description: >-
                    Objeto de mensagem completo, ou um objeto contendo apenas
                    `key` para que possa ser buscada.
                  example:
                    key:
                      id: BAE5F5A632EAE722
                      remoteJid: 5511999999999@s.whatsapp.net
                      fromMe: false
                message.key:
                  type: object
                  description: Chave da mensagem com `id`, `remoteJid`, `fromMe`.
                convertToMp4:
                  type: boolean
                  description: Converte a mídia para MP4 quando aplicável.
                  example: false
              required:
                - message
      responses:
        '200':
          description: Sucesso — corpo de resposta nativo do provedor.
          content:
            application/json:
              schema:
                type: object
                description: Decoded media of a message returned as base64.
                properties:
                  mediaType:
                    type: string
                    description: >-
                      Baileys media message type, e.g. imageMessage,
                      videoMessage, audioMessage, documentMessage,
                      stickerMessage.
                  fileName:
                    type: string
                    description: Resolved file name (original name or <messageId>.<ext>).
                  caption:
                    type: string
                    description: Caption of the media message, when present.
                  size:
                    type: object
                    description: Reported media dimensions/length.
                    properties:
                      fileLength:
                        type: string
                        description: >-
                          Media byte length (as reported by WhatsApp, may be a
                          numeric string).
                      height:
                        type: integer
                        description: Media height in pixels, when applicable.
                      width:
                        type: integer
                        description: Media width in pixels, when applicable.
                  mimetype:
                    type: string
                    description: >-
                      MIME type of the media (audio/mp4 when convertToMp4
                      requested for audio).
                  base64:
                    type: string
                    description: Base64-encoded media bytes.
                  buffer:
                    type:
                      - object
                      - 'null'
                    description: Raw buffer; null unless requested internally (getBuffer).
                required:
                  - mediaType
                  - fileName
                  - mimetype
                  - base64
              example:
                mediaType: imageMessage
                fileName: BAE5F5A632EAE722.jpg
                caption: Look at this!
                size:
                  fileLength: '24680'
                  height: 1280
                  width: 720
                mimetype: image/jpeg
                base64: >-
                  /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof...
                buffer: null
        default:
          description: Erro — erro do provedor ou da camada.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  error:
                    type: string
                  message:
                    type: string
                  response:
                    type: object
              example:
                status: 400
                error: Bad Request
                message: Invalid payload
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apikey
      description: >-
        Your Pilot Status API key (ps_...). Evolution GO also accepts
        `Authorization: Bearer <key>`.

````