openapi: 3.0.0
info:
  title: Evolution Foundation - Evolution Go - Message
  description: Go implementation of Evolution
  version: '1.0'
servers:
- url: http://localhost:8080/
  description: Development server (HTTP)
- url: https://localhost:8080/
  description: Development server (HTTPS)
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
paths:
  /message/delete:
    post:
      description: Delete a message for everyone
      summary: Delete a message for everyone
      responses:
        '200':
          description: Message deleted for everyone successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  messageId: "3EB0000000000000000001"
                  timestamp: "0001-01-01 00:00:00 +0000 UTC"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Message information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/delete
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/delete
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to delete message
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/delete
                  method: POST
        '404':
          description: Not Found - Message not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Message not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/delete
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/delete
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Message'
        description: Delete a message for everyone
  /message/downloadimage:
    post:
      description: Download an image
      summary: Download an image
      responses:
        '200':
          description: >
            ⚠️ BUG CONHECIDO: Este endpoint retorna erro 500 com "Failed to download image download failed with status code 429" (rate limit).
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  image:
                    type: string
                    format: base64
              example:
                error: "Failed to download image download failed with status code 429"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Image information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/downloadimage
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/downloadimage
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to download image
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/downloadimage
                  method: POST
        '404':
          description: Not Found - Image not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Image not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/downloadimage
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/downloadimage
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DownloadImage'
        description: Download an image
  /message/edit:
    post:
      description: Edit a message
      summary: Edit a message
      responses:
        '200':
          description: Message edited successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  messageId: "3EB0000000000000000002"
                  timestamp: "0001-01-01 00:00:00 +0000 UTC"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Message information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/edit
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/edit
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to edit message
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/edit
                  method: POST
        '404':
          description: Not Found - Message not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Message not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/edit
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/edit
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditMessage'
        description: Edit a message
  /message/markread:
    post:
      description: Mark a message as read
      summary: Mark a message as read
      responses:
        '200':
          description: Message marked as read successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  timestamp: "0001-01-01 00:00:00 +0000 UTC"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Message information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/markread
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/markread
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to mark message as read
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/markread
                  method: POST
        '404':
          description: Not Found - Message not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Message not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/markread
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/markread
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarkRead'
        description: Mark a message as read
  /message/presence:
    post:
      description: Set chat presence
      summary: Set chat presence
      responses:
        '200':
          description: Chat presence set successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  timestamp: "0001-01-01 00:00:00 +0000 UTC"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Chat presence information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/presence
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/presence
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to set chat presence
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/presence
                  method: POST
        '404':
          description: Not Found - Chat not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Chat not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/presence
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/presence
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatPresence'
        description: Set chat presence
  /message/react:
    post:
      description: React a message
      summary: React a message
      responses:
        '200':
          description: Message reacted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  Info:
                    Chat: "5511999999999@s.whatsapp.net"
                    Sender: "5511888888888:24@s.whatsapp.net"
                    IsFromMe: true
                    IsGroup: false
                    AddressingMode: ""
                    SenderAlt: ""
                    RecipientAlt: ""
                    BroadcastListOwner: ""
                    BroadcastRecipients: null
                    ID: "3EB0000000000000000003"
                    ServerID: 0
                    Type: "ReactionMessage"
                    PushName: ""
                    Timestamp: "2026-01-15T10:30:00.000000-03:00"
                    Category: ""
                    Multicast: false
                    MediaType: ""
                    Edit: ""
                    MsgBotInfo:
                      EditType: ""
                      EditTargetID: ""
                      EditSenderTimestampMS: "0001-01-01T00:00:00Z"
                    MsgMetaInfo:
                      TargetID: ""
                      TargetSender: ""
                      TargetChat: ""
                      DeprecatedLIDSession: null
                      ThreadMessageID: ""
                      ThreadMessageSenderJID: ""
                    VerifiedName: null
                    DeviceSentMeta: null
                  Message:
                    reactionMessage:
                      key:
                        remoteJID: "5511999999999@s.whatsapp.net"
                        fromMe: false
                        ID: "3EB0000000000000000003"
                      text: "🔥"
                      senderTimestampMS: 1700000000000
                  MessageContextInfo: null
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Message and reaction information are required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/react
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/react
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to react to message
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/react
                  method: POST
        '404':
          description: Not Found - Message not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Message not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/react
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/react
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/React'
        description: React a message
  /message/status:
    post:
      description: Get message status
      summary: Get message status
      responses:
        '200':
          description: Message status retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  status:
                    type: string
              example:
                data:
                  result: null
                  timestamp: "0001-01-01 00:00:00 +0000 UTC"
                message: "success"
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request data. Message information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/status
                  method: POST
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing API key
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/status
                  method: POST
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to get message status
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/status
                  method: POST
        '404':
          description: Not Found - Message not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Message not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/status
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /message/status
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageStatus'
        description: Get message status
components:
  schemas:
    ChatPresence:
      type: object
      properties:
        isAudio:
          type: boolean
        number:
          type: string
        state:
          type: string
    DownloadImage:
      type: object
      properties:
        directPath:
          type: string
        fileEncSHA256:
          items:
            type: integer
          type: array
        fileLength:
          type: integer
        fileSHA256:
          items:
            type: integer
          type: array
        mediaKey:
          items:
            type: integer
          type: array
        mimetype:
          type: string
        url:
          type: string
    EditMessage:
      type: object
      properties:
        chat:
          type: string
        message:
          type: string
        messageId:
          type: string
    ErrorResponse:
      type: object
      required:
      - success
      - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
            message:
              type: string
        meta:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
            path:
              type: string
            method:
              type: string
    MarkRead:
      type: object
      properties:
        id:
          items:
            type: string
          type: array
        number:
          type: string
    Message:
      type: object
      properties:
        chat:
          type: string
        messageId:
          type: string
    MessageStatus:
      type: object
      properties:
        id:
          type: string
    React:
      type: object
      properties:
        id:
          type: string
        number:
          type: string
        reaction:
          type: string
