openapi: 3.0.0
info:
  title: Evolution Foundation - Evolution Go - User
  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:
  /user/avatar:
    post:
      description: Get a user's avatar
      summary: Get a user's avatar
      responses:
        '200':
          description: User avatar retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  avatar:
                    type: string
                    format: base64
              example:
                success: true
                avatar: iVBORw0KGgoAAAANSUhEUgAA...
        '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. User information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/avatar
                  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: /user/avatar
                  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 user avatar
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/avatar
                  method: POST
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/avatar
                  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: /user/avatar
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetAvatar'
        description: Avatar data
  /user/block:
    post:
      description: Block a contact
      summary: Block a contact
      responses:
        '200':
          description: Contact blocked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  DHash: "1700000000000001"
                  JIDs:
                  - "5511999999999@s.whatsapp.net"
                  - "5511888888888@s.whatsapp.net"
                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. Contact information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/block
                  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: /user/block
                  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 block contact
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/block
                  method: POST
        '404':
          description: Not Found - Contact not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Contact not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/block
                  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: /user/block
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockUser'
        description: Block data
  /user/blocklist:
    get:
      description: Get a user's block list
      summary: Get a user's block list
      responses:
        '200':
          description: Block list retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  blockList:
                    type: array
                    items:
                      type: string
              example:
                data:
                  DHash: "1700000000000002"
                  JIDs:
                  - "5511999999999@s.whatsapp.net"
                  - "5511888888888@s.whatsapp.net"
                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
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/blocklist
                  method: GET
        '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: /user/blocklist
                  method: GET
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to get block list
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/blocklist
                  method: GET
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/blocklist
                  method: GET
        '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: /user/blocklist
                  method: GET
  /user/check:
    post:
      description: Check a user
      summary: Check a user
      responses:
        '200':
          description: User checked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  exists:
                    type: boolean
                  user:
                    type: object
              example:
                data:
                  Users:
                  - Query: "+5511999999999@s.whatsapp.net"
                    IsInWhatsapp: true
                    JID: "5511999999999@s.whatsapp.net"
                    RemoteJID: "5511999999999@s.whatsapp.net"
                    LID: "100000000000003@lid"
                    VerifiedName: ""
                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. User information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/check
                  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: /user/check
                  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 check user
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/check
                  method: POST
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/check
                  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: /user/check
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckUser'
        description: User data
  /user/contacts:
    get:
      description: Get a user's contacts
      summary: Get a user's contacts
      responses:
        '200':
          description: User contacts retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  contacts:
                    type: array
                    items:
                      type: object
              example:
                data:
                - Jid: "5511999999999@s.whatsapp.net"
                  Found: true
                  FirstName: ""
                  FullName: ""
                  PushName: "Contact Name"
                  BusinessName: ""
                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
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/contacts
                  method: GET
        '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: /user/contacts
                  method: GET
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to get user contacts
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/contacts
                  method: GET
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/contacts
                  method: GET
        '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: /user/contacts
                  method: GET
  /user/info:
    post:
      description: Get a user
      summary: Get a user
      responses:
        '200':
          description: User retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  user:
                    type: object
              example:
                data:
                  Users:
                    "5511999999999@s.whatsapp.net":
                      VerifiedName: null
                      Status: " "
                      PictureID: "123456789"
                      Devices:
                      - "5511999999999@s.whatsapp.net"
                      LID: "100000000000004@lid"
                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. User information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/info
                  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: /user/info
                  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 user
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/info
                  method: POST
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/info
                  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: /user/info
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckUser'
        description: User data
  /user/privacy:
    get:
      description: Get a user's privacy settings
      summary: Get a user's privacy settings
      responses:
        '200':
          description: Privacy settings retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  privacy:
                    type: object
              example:
                data:
                  GroupAdd: "all"
                  LastSeen: "none"
                  Status: "all"
                  Profile: "all"
                  ReadReceipts: "none"
                  CallAdd: "all"
                  Online: "match_last_seen"
                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
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/privacy
                  method: GET
        '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: /user/privacy
                  method: GET
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to get privacy settings
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/privacy
                  method: GET
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/privacy
                  method: GET
        '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: /user/privacy
                  method: GET
  /user/profile:
    post:
      description: Set a user's profile picture
      summary: Set a user's profile picture
      responses:
        '200':
          description: Profile picture set successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  image: "https://i.imgur.com/example.jpeg"
                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. Profile picture is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/profile
                  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: /user/profile
                  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 profile picture
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/profile
                  method: POST
        '404':
          description: Not Found - User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: User not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/profile
                  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: /user/profile
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetProfilePicture'
        description: Profile picture data
  /user/unblock:
    post:
      description: Unblock a contact
      summary: Unblock a contact
      responses:
        '200':
          description: Contact unblocked successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
              example:
                data:
                  DHash: "1700000000000003"
                  JIDs:
                  - "5511999999999@s.whatsapp.net"
                  - "5511888888888@s.whatsapp.net"
                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. Contact information is required.
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/unblock
                  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: /user/unblock
                  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 unblock contact
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/unblock
                  method: POST
        '404':
          description: Not Found - Contact not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Contact not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /user/unblock
                  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: /user/unblock
                  method: POST
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockUser'
        description: Block data
components:
  schemas:
    BlockUser:
      type: object
      properties:
        number:
          type: string
    CheckUser:
      type: object
      properties:
        number:
          items:
            type: string
          type: array
    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
    GetAvatar:
      type: object
      properties:
        number:
          type: string
        preview:
          type: boolean
    SetProfilePicture:
      type: object
      properties:
        image:
          type: string
