openapi: 3.0.0
info:
  title: WUZAPI
  description: "WUZAPI implements a multi user and multi device REST API for WhatsApp.\n\n<h2>Authentication</h2><ul><li>Standard Endpoints: Include the token header with a valid user token (matches tokens stored in the users database table).</li><li>Admin Endpoints: Use the Authorization header with the admin token (set in .env as WUZAPI_ADMIN_TOKEN).</li></ul><h2>Admin Setup:</h2>You can manage users and do some tests by using the builtin dashboard [here](/dashboard).<h3>Add a Sample User via API</h3>Run this command to create a test user:<pre><code>curl -X POST http://localhost:8080/admin/users \\ \n-H \"Authorization: $WUZAPI_ADMIN_TOKEN\" \\ \n-H \"Content-Type: application/json\" \\ \n-d '{\"name\": \"John\", \"token\": \"Z1234ABCCXD\"}' </code> </pre>\n\n<h2>Webhook Configuration</h2>To receive WhatsApp messages:<ul><li>Host your own server (to process incoming messages).</li><li>Set its URL as the webhook via the [webhook](#Webhook) API call.</li></ul><h2>Phone number format:</h2><ul><li>Required: Country code (e.g. <b>5491155553934</b> for Argentina</li><li>Do not prefix with a plus sign (+), as natively whatsapp requires no plus sign prefix.</li></ul>"
  version: '3.0.0'
  termsOfService: ''
   
schemes:
  - http

servers:
  - url: '/'
    description: Current host

paths:
  /health:
    get:
      tags:
        - System
      summary: Health check
      description: Endpoint to verify if the API is running correctly and retrieve service statistics.
      responses:
        200:
          description: API is healthy
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                    description: Overall service status
                  timestamp:
                    type: string
                    format: date-time
                    example: "2025-01-15T10:30:00Z"
                    description: Current timestamp
                  uptime:
                    type: string
                    example: "24h15m30s"
                    description: Time the service has been running
                  active_connections:
                    type: integer
                    example: 5
                    description: Total number of active managed connections
                  total_users:
                    type: integer
                    example: 10
                    description: Total number of registered users
                  connected_users:
                    type: integer
                    example: 4
                    description: Number of users connected to WhatsApp
                  logged_in_users:
                    type: integer
                    example: 3
                    description: Number of users logged into WhatsApp
                  memory_stats:
                    type: object
                    description: Memory usage statistics
                    properties:
                      alloc_mb:
                        type: integer
                        example: 45
                        description: Currently allocated memory in MB
                      total_alloc_mb:
                        type: integer
                        example: 250
                        description: Total memory allocated since startup in MB
                      sys_mb:
                        type: integer
                        example: 72
                        description: Memory obtained from the system in MB
                      num_gc:
                        type: integer
                        example: 15
                        description: Number of garbage collection cycles
                  goroutines:
                    type: integer
                    example: 42
                    description: Number of running goroutines
                  version:
                    type: string
                    example: "3.0.0"
                    description: API version (optional)
                required:
                  - status
                  - timestamp
  /admin/users:
    get:
      tags:
        - Admin
      summary: List users
      description: Retrieve a list of users from the database, displaying also connection status and other info.
      security:
        - AdminAuth: []
      responses:
        200:
          description: A JSON array of user objects
          content:
            application/json:
              schema:
                example: { "code": 200, "data": [ { "connected": true, "events": "All", "expiration": 0, "id": "bec45bb93cbd24cbec32941ec3c93a12", "jid": "5491155551122:12@s.whatsapp.net", "loggedIn": true, "name": "Some User", "proxy_url": "", "qrcode": "", "token": "d030sl9aDL39sl3075zz", "webhook": "https://some.domain/webhook" } ], "success": true }
    post:
      tags:
        - Admin
      summary: Create a new user
      description: Add a new user to the database.
      security:
        - AdminAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/CreateUser'
      responses:
        201:
          description: User created
          content:
            application/json:
              schema:
                $ref: '#/definitions/User'
              example:
                code: 201
                data:
                  id: "5663e0c52063ec35d0ba45f7c2011c06"
                  name: "John Doe"
                  token: "1234ABCD"
                  webhook: "https://webhook.site/1234567890"
                  events: "All"
                  proxy_config:
                    enabled: true
                    proxy_url: "https://serverproxy.com:9080"
                  s3_config:
                    enabled: true
                    endpoint: "https://s3.amazonaws.com"
                    region: "us-east-1"
                    bucket: "my-bucket"
                    access_key: "***"
                    path_style: true
                    public_url: "https://s3.amazonaws.com"
                    media_delivery: "both"
                    retention_days: 30
                  history: 0
  /admin/users/{id}:
    get:
      tags:
        - Admin
      summary: List users
      description: Retrieve a list of users from the database, displaying also connection status and other info.
      security:
        - AdminAuth: [ ]
      parameters:
        - name: id
          in: path
          required: true
          description: ID of the user to request
          schema:
            type: string
            example: 4e4942c7dee1deef99ab8fd9f7350de5
      responses:
        200:
          description: A JSON array of user objects
          content:
            application/json:
              schema:
                example: { "code": 200, "data": [ { "connected": true, "events": "All", "expiration": 0, "id": "bec45bb93cbd24cbec32941ec3c93a12", "jid": "5491155551122:12@s.whatsapp.net", "loggedIn": true, "name": "Some User", "proxy_url": "", "qrcode": "", "token": "d030sl9aDL39sl3075zz", "webhook": "https://some.domain/webhook" } ], "success": true }
    delete:
      tags:
        - Admin
      summary: Delete a user from DB
      description: Deletes a user by their ID.
      security:
        - AdminAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: ID of the user to delete
          schema:
            type: string
            example: 4e4942c7dee1deef99ab8fd9f7350de5
      responses:
        200:
          description: User deleted
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"id":"6b927654cada7635a4586bf8fad260a3"},"details":"User deleted successfully","success":true}
  /admin/users/{id}/full:
    delete:
      tags:
        - Admin
      summary: Delete a user from DB and S3, logout and disconnect from whatsapp and clear it up from memory
      description: Deletes a user by their ID, including login out, disconnect and memory cleanup Also removes all user files from S3.
      security:
        - AdminAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: ID of the user to delete
          schema:
            type: string
            example: 4e4942c7dee1deef99ab8fd9f7350de5
      responses:
        200:
          description: User deleted
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"id":"4e4942c7dee1deef99ab8fd9f7350de5","jid":"","name":"mariano"},"details":"User instance removed completely","success":true}
  /newsletter/list:
    get:
      tags:
        - Newsletter
      summary: List subscribed newsletters
      description: Returns complete list of subscribed newsletters
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code": 200, "data": {"Newsletter": [{"id": "120363144038483540@newsletter", "state": {"type": "active" }, "thread_metadata": {"creation_time": "1688746895", "description": {"id": "1689653839450668", "text": "WhatsApp's official channel. Follow for our latest feature launches, updates, exclusive drops and more.", "update_time": "1689653839450668" }, "invite": "0029Va4K0PZ5a245NkngBA2M", "name": {"id": "1688746895480511", "text": "WhatsApp", "update_time": "1688746895480511" }, "picture": {"direct_path": "/v/t61.24694-24/416962407_970228831134395_8869146381947923973_n.jpg?ccb=11-4&oh=01_Q5AaIRyTfP806JEGJDm0XWU5E-D4LcA-Wj3csSwh1jJTVanC&oe=67D550F1&_nc_sid=5e03e0&_nc_cat=110", "id": "1707950960975554", "type": "IMAGE", "url": "" }, "preview": {"direct_path": "/v/t61.24694-24/416962407_970228831134395_8869146381947923973_n.jpg?stp=dst-jpg_s192x192_tt6&ccb=11-4&oh=01_Q5AaIawuPXJUw9grRFJZtAJEc6QNm0XpqJq4X1Ssi9xNI0Qf&oe=67D550F1&_nc_sid=5e03e0&_nc_cat=110", "id": "1707950960975554", "type": "PREVIEW", "url": "" }, "settings": {"reaction_codes": {"value": "ALL" } }, "subscribers_count": "0", "verification": "verified" }, "viewer_metadata": {"mute": "on", "role": "subscriber" } } ] }, "success": true }
  /webhook:
    get:
      tags:
        - Webhook
      summary: Shows webhook 
      description: |
        Gets the configured webhook and subscribed events.

        ## Webhook

        The following _webhook_ endpoints are used to get or set the webhook that will be called whenever a message or event is received. Available event types are:

        * Message
        * ReadReceipt
        * Presence
        * HistorySync
        * ChatPresence
        * All (subscribes to all event types)
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "subscribe": [ "Message", "ReadReceipt" ], "webhook": "https://example.net/webhook" }, "success": true }

    post:
      tags:
        - Webhook
      summary: Sets webhook 
      description: |
        Sets the webhook that will be used to POST information when messages are received and configures the events to subscribe to.

        ## Webhook

        The following _webhook_ endpoints are used to get or set the webhook that will be called whenever a message or event is received. Available event types are:

        * Message
        * ReadReceipt
        * Presence
        * HistorySync
        * ChatPresence
        * All (subscribes to all event types)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/WebhookSet'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "WebhookURL": "https://example.net/webhook", "Events": ["Message", "ReadReceipt"] }, "success": true }
    delete:
      tags:
        - Webhook
      summary: Deletes webhook 
      description: Removes the configured webhook and clears events for the user
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Webhook and events deleted successfully" }, "success": true }
    put:
      tags:
        - Webhook
      summary: Updates webhook
      description: |
        Updates the webhook URL, events, and activation status.

        ## Webhook

        The following _webhook_ endpoints are used to get or set the webhook that will be called whenever a message or event is received. Available event types are:

        * Message
        * ReadReceipt
        * Presence
        * HistorySync
        * ChatPresence
        * All (subscribes to all event types)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/WebhookUpdate'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "WebhookURL": "https://example.net/webhook", "Events": ["Message", "ReadReceipt"], "active": true }, "success": true }
  /session/connect:
    post:
      tags:
        - Session 
      summary: connects to WhatsApp servers
      description: "Initiates connection to WhatsApp servers.\n\nIf there is no previous session created, it will generate a QR code that can be retrieved via the [qr](#/Session/get_session_qr) API call.\n\nIf the optional Subscribe is supplied it will limit webhooks to the specified event types: Message,ReadReceipt,Presence,HistorySync,ChatPresence.\n\nIf no Subscribe is supplied it will subscribe to All events.\n\nIf Immediate is set to false, the action will wait for 10 seconds to retrieve actual connection status from whatsapp, otherwise it will return immediatly.\n\nWhen setting Immediate to true you should check for actual connection status after a few seconds via the [status](#/Session/get_session_status) API call as your connection might fail if the session was closed from another device."
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Connect'

      responses:
        200:
          description: Response

          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "details": "Connected!", "events": "Message", "jid": "5491155555555.0:53@s.whatsapp.net", "webhook": "https://some.site/webhook?request=parameter" }, "success": true }
  /session/disconnect:
    post:
      tags:
        - Session 
      summary: disconnects from WhatsApp servers
      description: Closes connection to WhatsApp servers. Session is not terminated, that means that calling connect again will reuse the previous session avoiding QR code scanning 
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Disconnected" }, "success": true }
  /session/logout:
    post:
      tags:
        - Session 
      summary: Logs out from WhatsApp 
      description: Closes connection to WhatsApp servers and terminate session. That means that next time connect is issued, QR scan will be needed from phone to connect again
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Logged out" }, "success": true }
  /session/status:
    get:
      tags:
        - Session 
      summary: Gets connection and session status
      description: Gets status from connection, including websocket connection and logged in status (session)
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Connected": true, "LoggedIn": true }, "success": true }
  /session/pairphone:
    post:
      tags:
        - Session
      summary: Gets pair by phone code
      description: Gets the code to enter into whatsapp client when pairing by phone number instead of QR code
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Pairphone'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "LinkingCode" : "9H3J-H3J8" }, "success": true }
  /session/qr:
    get:
      tags:
        - Session 
      summary: Gets QR code for scanning
      description: Gets QR code if the user is connected but not logged in. If the user is already logged in, QRCode will be empty.
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "QRCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDolAAAABlBMVEX///8AAABVwtN+AAAEw0lEQVR42uyZPa7zqhaGX0ThLmsCkZlGCktMKaU76FxmSkgUmQZWJkA6CuT3avlLvrNvvRMX9x6KXWQ/UhCsn2cR/Lv+v5YhudQ6njEs1bBjqGYDwlJJpoOAArtUbK4Pi5jN3qPAlCkstcAeBazMUaoj78RpxGW4yWYzWVfmzwFLlLX4O+VkkucN5tFDOxiIAvfoA/X4uVQ4sgUcCBTYCG7AEGGKvbdrBabQ8OOyvg3ovm4ynqfLXJ9rvi+303ie5vm/gvZXgK6BLC7fo5hiG4KwW7b6I/2+DJi1+ybVFQyx6o6bbKPVDCyjTwcBZB9uevBtAEafhiosCFH/4kNA8i1gg02B3KxezGbzEjUCDgIwYppR3SNdgtY3H0M1j8xFzCscvg/8uQvZAB9piidv1RXfZhbHdAwAlzsCNCaJDdMF4WQeeSGACZ8BMNl4FZYJA7j2YalPPhhngetHAaZPcyBg2wyYdAk0fKQ5yPja5PcBzTZW4uxJ2bTGwmxnu/BH4vwSgEsYItcCH+VZJt/AYhmHatbXdX8d2JvaTVzxCVW2aVhqheXSqvnR9b4L6AoUx3zX+jZd5rDB5jbLuv0txd8GRs+liuv+TsKloQWujxxRYf5s8gOA7fMVK9PQuDtMNCx2ibIdCMCy1s0yQU6Od9bqim1BuzoOAgzTHOiKv0d5Mt+XClN8DBxN/wxg2G2DbDYNJExCqE+Ne8poXoLxdUA/w5VrnxBQ9fjlqaJMwWgPAzLjtfKRW4A21ojnStX0dX2d5PeB0fawu2pChcuM4bk+tLmbMn0GMJslb5ptDXySbb5W1+0SyVcJOgRIQxSc7X0RUSvGs2DSeaz4gwCMNi/7XNACZc0KbPBtruv2KQA+DVFladBvt4xywhmh1Xd2fx8wzGTUltqCWrHWgqL7Jg8E0hSiFJfbUJ/Fpx3L1OHsVR8+APgoZMclUKvcft2+zTBrwjHArosim4ZcfW4Y4lVWnYXg2A8C9C5aEFXDoEJzmXFyfZoH/p0Wvw7oXoZbNQ823ase1wk2DQ3u7XK/BkzOqovwpM68Ko+jUyPFu6F8H4DvqsAuaUMZJ6+azjTPdS32KMBkLnpQ3VPnbsZgiktALW91/wDQEV5V7gT4JT6L62GRzeV0EDDC7rVFax2ZW6Aa6V5h/FEAgBlSbLrMVScU1s09+jxwG/9q87cB/Yxw3acBsk2Yw+nPf9Y1p88ARlNPtvPkF3LlPQYp8MtSx/FtpF8H4DNrZd8fOtTOxJSzXdo/c/fXAbN2DLeKs1dxHeEZZVWaju/3h18CcDk3qePZpllglDZ89MCq8nIQoDPAVaPi3iAFFwS1xjjr+HcYwD+hri216vBZzQbbZsE44RhAp+sQxfTpApGCoV1NOfsl4pX+nwC65a1uLnkK9TSuVTOhaQ4cBOzvtDcZXU5Bdl28SrF9HqrZJhwD7O/VsZpi7xSz7pXW6ahQ1/dB/RrYf2QhLBmr1lNINVRZfw9BBwArc4SszGlWWd2fxB9cFvJQYKnUUWAgV22y5v1e/ffHpiOAqMLCiOpymwNGtxvk9s8mfwcU2CiydqvJbdKuSX0K8a/KHQDsMQkyeVbtISFif8mRcfwRtF8F/l3/O+s/AQAA///lM0dZSaTeTQAAAABJRU5ErkJggg==" }, "success": true }
  /session/proxy:
    post:
      tags:
        - Session
      summary: Set Proxy Configuration
      description: |
        Sets or disables the proxy configuration for the user.
        Provide a JSON payload with "proxy_url" (e.g. "http://host:port" or "socks5://user:pass@host:port") and "enable" (boolean).
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                proxy_url:
                  type: string
                  description: Proxy URL in format "http://host:port" or "socks5://user:pass@host:port"
                enable:
                  type: boolean
                  description: Whether to enable or disable the proxy.
              required:
                - proxy_url
                - enable
      responses:
        "200":
          description: Proxy configured successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  Details:
                    type: string
                    example: Proxy configured successfully
                  ProxyURL:
                    type: string
                    example: socks5://user:pass@host:port
        "400":
          description: Bad Request
        "500":
          description: Internal Server Error
  /session/s3/config:
    post:
      tags:
        - Session
      summary: Configure S3 Storage
      description: |
        Configures S3 storage settings for the user to store media files.
        Supports AWS S3, MinIO, Backblaze B2, and other S3-compatible services.
        When enabled, media files will be uploaded to S3 and can be accessed via public URLs.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/S3Config'
      responses:
        200:
          description: S3 configuration saved successfully
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "S3 configuration saved successfully", "Enabled": true }, "success": true }
        400:
          description: Bad Request
        500:
          description: Internal Server Error
    get:
      tags:
        - Session
      summary: Get S3 Configuration
      description: Retrieves the current S3 storage configuration for the user.
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: S3 configuration retrieved successfully
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "enabled": true, "endpoint": "https://s3.amazonaws.com", "region": "us-east-1", "bucket": "my-bucket", "access_key": "***", "path_style": false, "public_url": "", "media_delivery": "both", "retention_days": 30 }, "success": true }
        500:
          description: Internal Server Error
    delete:
      tags:
        - Session
      summary: Delete S3 Configuration
      description: Removes the S3 storage configuration for the user and reverts to default base64 media delivery.
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: S3 configuration deleted successfully
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "S3 configuration deleted successfully" }, "success": true }
        500:
          description: Internal Server Error
  /session/s3/test:
    post:
      tags:
        - Session
      summary: Test S3 Connection
      description: Tests the S3 connection using the current configuration to ensure it's working properly.
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: S3 connection test successful
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "S3 connection test successful", "Bucket": "my-bucket", "Region": "us-east-1" }, "success": true }
        400:
          description: S3 is not enabled or configuration error
        500:
          description: S3 connection test failed
  /session/history:
    get:
      tags:
        - Session
      summary: Request history sync
      description: Requests WhatsApp to sync message history for the connected session. Supports query parameters to customize the sync request.
      security:
        - ApiKeyAuth: []
      parameters:
        - name: count
          in: query
          description: Number of messages to sync (default 50)
          required: false
          schema:
              type: integer
              minimum: 1
              maximum: 1000
              example: 50
        - name: chat_jid
          in: query
          description: JID of the chat to sync history for (e.g., 120363313346913103@g.us for groups or 5521971532700@s.whatsapp.net for DMs)
          required: false
          schema:
            type: string
            example: 120363313346913103@g.us
        - name: oldest_msg_id
          in: query
          description: Message ID of the oldest message to start sync from
          required: false
          schema:
            type: string
            example: ABC123DEF456
        - name: oldest_msg_from_me
          in: query
          description: Whether the oldest message was sent by the current user
          required: false
          schema:
            type: boolean
            example: true
        - name: oldest_msg_timestamp
          in: query
          description: Timestamp of the oldest message in milliseconds
          required: false
          schema:
            type: integer
            example: 1640995200000
      responses:
        '200':
          description: History sync requested successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 200
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      details:
                        type: string
                        example: 'History sync request Sent'
                      timestamp:
                        type: integer
                        format: int64
                        description: Unix timestamp when the request was sent
                        example: 1640995200
                      count:
                        type: integer
                        description: Number of messages requested for sync
                        example: 50
                      chat_jid:
                        type: string
                        description: JID of the chat being synced
                        example: 120363313346913103@g.us
                      oldest_msg_id:
                        type: string
                        description: ID of the oldest message for sync
                        example: ABC123DEF456
                      oldest_msg_from_me:
                        type: boolean
                        description: Whether the oldest message was from the user
                        example: true
                      oldest_msg_timestamp:
                        type: integer
                        format: int64
                        description: Timestamp of the oldest message in milliseconds
                        example: 1640995200000
                example:
                  code: 200
                  success: true
                  data:
                    details: 'History sync request Sent'
                    timestamp: 1640995200
                    count: 50
                    chat_jid: '120363313346913103@g.us'
                    oldest_msg_id: 'ABC123DEF456'
                    oldest_msg_from_me: true
                    oldest_msg_timestamp: 1640995200000
        '400':
          description: Bad request or session not connected
        '500':
          description: Internal server error
  /session/hmac/config:
    post:
      tags:
        - Session 
      summary: Configure HMAC key for webhook signing
      description: "Sets HMAC key for webhook signature verification. Once configured, all webhooks will include x-hmac-signature header.\n\n**Security Notes:**\n- HMAC key must be at least 32 characters long\n- Key cannot be retrieved after saving\n- To update key, send new request with new key"
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                hmac_key:
                  type: string
                  description: HMAC key for webhook signing (min 32 chars)
                  example: "your_hmac_key_minimum_32_characters_long_here"
              required:
                - hmac_key
      responses:
        200:
          description: HMAC configuration saved
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "HMAC configuration saved successfully" }, "success": true }
        400:
          description: Invalid HMAC key
          content:
            application/json:
              schema:
                example: { "code": 400, "data": "HMAC key must be at least 32 characters long", "success": false }
    get:
      tags:
        - Session 
      summary: Get HMAC configuration status
      description: "Retrieves HMAC configuration status. For security reasons, the actual key is never returned - only masked with '***' if configured."
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: HMAC status
          content:
            application/json:
              schema:
                example: { "hmac_key": "***" }
    delete:
      tags:
        - Session 
      summary: Delete HMAC configuration
      description: "Removes HMAC configuration and disables webhook signing."
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: HMAC configuration removed
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "HMAC configuration deleted successfully" }, "success": true }
  /user/info:
    post:
      tags:
        - User
      summary: Gets information about users on WhatsApp
      description: Gets extra information about users on WhatsApp
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Checkuser'


      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Users": { "5491155553935@s.whatsapp.net": { "Devices": [], "PictureID": "", "Status": "", "VerifiedName": null }, "5491155553934@s.whatsapp.net": { "Devices": [ "5491155553934.0:0@s.whatsapp.net", "5491155955934.0:6@s.whatsapp.net", ], "PictureID": "1582328807", "Status": "🇦🇷", "VerifiedName": null } } }, "success": true } 
  /user/check:
    post:
      tags:
        - User
      summary: Checks if user has WhatsApp
      description: Checks if users have an account with WhatsApp
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Checkuser'


      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Users": [ { "IsInWhatsapp": true, "JID": "5491155553934@s.whatsapp.net", "Query": "5491155553934", "VerifiedName": "Company Name" }, { "IsInWhatsapp": false, "JID": "5491155553935@s.whatsapp.net", "Query": "5491155553935", "VerifiedName": "" } ] }, "success": true }
  /user/presence:
    post:
      tags:
        - User
      summary: Send user global presence
      description: Sends user presence Available or Unavailable
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/UserPresence'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code": 200, "data": {"Details": "Presence set successfuly"}, "success": true}
        400:
          description: Response
          content:
            application/json:
              schema:
                example: {"code": 400,"error": "Invalid presence type. Allowed values: 'available', 'unavailable'","success": false}
  /user/avatar:
    post:
      tags:
        - User
      summary: Gets profile picture information
      description: Gets information about users profile pictures on WhatsApp, either a thumbnail (Preview=true) or full picture.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Checkavatar'


      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "URL": "https://pps.whatsapp.net/v/t61.24694-24/227295214_112447507729487_4643695328050510566_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=ja432434a91e8f41d86d341bx889c217&oe=543222A4", "ID": "1645308319", "Type": "preview", "DirectPath": "/v/t61.24694-24/227295214_112447507729487_4643695328050510566_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=ja432434a91e8f41d86d341ba889c217&oe=543222A4" }
  /user/contacts:
    get:
      tags:
        - User
      summary: Gets all contacts for the account
      description: Gets complete list of contacts for the connected account
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "5491122223333@s.whatsapp.net": { "BusinessName": "", "FirstName": "", "Found": true, "FullName": "", "PushName": "FOP2" }, "549113334444@s.whatsapp.net": { "BusinessName": "", "FirstName": "", "Found": true, "FullName": "", "PushName": "Asternic" } } }
  /user/lid/{phone}:
    get:
      tags:
        - User
      summary: Get JID and LID for a WhatsApp number
      description: |
        Returns the **JID** (WhatsApp ID) and **LID** (Linked Device ID) associated with a given phone number.
        <br>Use this endpoint to identify contacts within WhatsApp.
      parameters:
        - name: phone
          in: path
          required: true
          description: Phone number in international format (without the + sign)
          schema:
            type: string
            example: "5511999999999"
      security:
        - UserTokenAuth: []
      responses:
        200:
          description: JID and LID successfully retrieved
          content:
            application/json:
              schema:
                type: object
                properties:
                  jid:
                    type: string
                    example: "5511999999999@s.whatsapp.net"
                    description: WhatsApp JID
                  lid:
                    type: string
                    example: "1234567890@lid"
                    description: Linked Device ID
        400:
          description: Invalid phone number format
        401:
          description: Invalid or missing token
        404:
          description: User not found
  /chat/delete:
    post:
      tags:
        - Chat 
      summary: Deletes a message sent by user
      description: Deletes a messages sent by the same user
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/DeleteMessage'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Message deleted" }, "success": true }
  /chat/markread:
    post:
      tags:
        - Chat 
      summary: Marks a message as read
      description: Marks one or more received messages as read
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/Markread'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Message(s) marked as read" }, "success": true }
  /chat/react:
    post:
      tags:
        - Chat 
      summary: Reacts to a message
      description: Sends a reaction to some message. Phone, Body and Id are mandatory. If reaction is for your own message, prefix Phone with 'me:'. Body should be the reaction emoji.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/ReactionText'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"3EB06F9067F80BAB89FF","Timestamp":"2022-05-10T12:49:08-03:00"},"success":true}
  /chat/send/text:
    post:
      tags:
        - Chat 
      summary: Sends a text message
      description: Sends a text message. Phone and Body are mandatory. If no Id is supplied, a random one will be generated. ContextInfo is optional and used when repyling to some message. StanzaId is the message id we are replying to and participant who wrote that message. If sending a new message, ContextInfo can be ommited altogether.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageText'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/edit:
    post:
      tags:
        - Chat
      summary: Edits a previously sent message
      description: Edits a message already sent by the same user. Provide the message ID and new content.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                Id:
                  type: string
                  description: The ID of the message to edit
                  example: "90B2F8B13FAC8A9CF6B06E99C7834DC5"
                Phone:
                  type: string
                  description: The WhatsApp number or JID (use 'me:' prefix if your own message)
                  example: "5491122223333"
                Body:
                  type: string
                  description: New message content
                  example: "This is the updated message"
              required:
                - Id
                - Phone
                - Body
      responses:
        200:
          description: Message edited successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 200
                  data:
                    type: object
                    properties:
                      Details:
                        type: string
                        example: Message updated
                  success:
                    type: boolean
                    example: true
        400:
          description: Invalid parameters or message not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 400
                  error:
                    type: string
                    example: Invalid message ID or new content
                  success:
                    type: boolean
                    example: false
  /chat/request-unavailable-message:
    post:
      tags:
        - Chat
      summary: Request unavailable message
      description: |
        Requests a copy of a message that couldn't be decrypted from the sender's primary device. 
        This is useful when you receive an encrypted message that your client was unable to decrypt.

        The response to this request will come as a normal message event with the `UnavailableRequestID` field set to the request message ID. 
        The sender's primary device will attempt to resend the message content.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chat:
                  type: string
                  description: Chat JID where the message was sent (e.g., "5511999999999@s.whatsapp.net" for individual chat or "120363123456789012@g.us" for group chat)
                  example: "5511999999999@s.whatsapp.net"
                sender:
                  type: string
                  description: JID of the user who sent the message
                  example: "5511999999999@s.whatsapp.net"
                id:
                  type: string
                  description: Message ID of the undecrypted message
                  example: "3EB0C767D2B2B2B2B2B2B2B2B2B2B2B2B2"
              required:
                - chat
                - sender
                - id
            examples:
              individual_chat:
                summary: Individual chat example
                value:
                  chat: "5511999999999@s.whatsapp.net"
                  sender: "5511999999999@s.whatsapp.net"
                  id: "3EB0C767D2B2B2B2B2B2B2B2B2B2B2B2B2"
              group_chat:
                summary: Group chat example
                value:
                  chat: "120363123456789012@g.us"
                  sender: "5511999999999@s.whatsapp.net"
                  id: "3EB0C767D2B2B2B2B2B2B2B2B2B2B2B2B2"
      responses:
        200:
          description: Unavailable message request sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 200
                  data:
                    type: object
                    properties:
                      success:
                        type: boolean
                        example: true
                      message:
                        type: string
                        example: "Unavailable message request sent successfully"
                      request_id:
                        type: string
                        example: "3EB0C767D2B2B2B2B2B2B2B2B2B2B2B2B2"
                      chat:
                        type: string
                        example: "5511999999999@s.whatsapp.net"
                      sender:
                        type: string
                        example: "5511999999999@s.whatsapp.net"
                      message_id:
                        type: string
                        example: "3EB0C767D2B2B2B2B2B2B2B2B2B2B2B2B2"
                      timestamp:
                        type: integer
                        example: 1640995200
                  success:
                    type: boolean
                    example: true
        400:
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 400
                  error:
                    type: string
                    example: "missing Chat in Payload"
                  success:
                    type: boolean
                    example: false
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 500
                  error:
                    type: string
                    example: "failed to send unavailable message request: context deadline exceeded"
                  success:
                    type: boolean
                    example: false
  /chat/send/image:
    post:
      tags:
        - Chat 
      summary: Sends an image/picture message
      description: Sends an image message (must be base64 encoded in image/png or image/jpeg formats)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageImage'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/audio:
    post:
      tags:
        - Chat 
      summary: Sends an audio message
      description: Sends an audio message (must be base64 encoded in opus format, mime type audio/ogg)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageAudio'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/document:
    post:
      tags:
        - Chat 
      summary: Sends a document message
      description: Sends any document (must be base64 encoded using application/octet-stream mime)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageDocument'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/template:
    post:
      tags:
        - Chat 
      summary: Sends a template message 
      description: Sends a template message, that can contain quick reply buttons, url buttons and call buttons
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageTemplate'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/video:
    post:
      tags:
        - Chat 
      summary: Sends a video message
      description: Sends a video message (must be base64 encoded in video/mp4 or video/3gpp format. Only H.264 video codec and AAC audio codec is supported.)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageVideo'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/sticker:
    post:
      tags:
        - Chat 
      summary: Sends a sticker message
      description: Sends a sticker message (must be base64 encoded in image/webp or video/mp4 format)
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageSticker'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/location:
    post:
      tags:
        - Chat 
      summary: Sends a location message
      description: Sends a location message
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageLocation'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/contact:
    post:
      tags:
        - Chat 
      summary: Sends a contact message
      description: Sends a contact message in VCARD format
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageContact'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/buttons:
    post:
      tags:
        - Chat
      summary: Sends a Buttons message
      description: Sends a Buttons message
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageButtons'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/list:
    post:
      tags:
        - Chat
      summary: Sends a List message
      description: Sends a List message
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessageList'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/send/poll:
    post:
      tags:
        - Chat
      summary: Sends a Poll to some group
      description: Sends a Poll message. Group should contain the gid (group id), similar to 120363312246943103@g.us.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/MessagePoll'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Sent","Id":"90B2F8B13FAC8A9CF6B06E99C7834DC5","Timestamp":"2022-04-20T12:49:08-03:00"},"success":true}
  /chat/downloadimage:
    post:
      tags:
        - Chat 
      summary: Downloads Image from message
      description: Downloads an Image from a message and returns it Base64 media encoded
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/DownloadMedia'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Data":"data:image/jpeg;base64,iVBORw0KGgoA5CYII...=","Mimetype":"image/jpeg"},"success":true}
  /chat/downloadsticker:
    post:
      tags:
        - Chat
      summary: Downloads Sticker from message
      description: Downloads a Sticker from a message and returns it Base64 media encoded
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/DownloadMedia'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Data":"data:image/webp;base64,iVBORw0KGgoA5CYII...=","Mimetype":"image/webp"},"success":true}
  /chat/downloadvideo:
    post:
      tags:
        - Chat 
      summary: Downloads Video from message
      description: Downloads a Video from a message and returns it Base64 media encoded
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/DownloadMedia'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Data":"data:video/mp4;base64,iVBORw0KGgoA5CYII...=","Mimetype":"video/mp4"},"success":true}
  /chat/downloaddocument:
    post:
      tags:
        - Chat 
      summary: Downloads Document from message
      description: Downloads a Document from a message and returns it Base64 media encoded
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/DownloadMedia'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Data":"data:application/pdf;base64,iVBORw0KGgoA5CYII...=","Mimetype":"application/pdf"},"success":true}
  /chat/downloadaudio:
    post:
      tags:
        - Chat
      summary: Downloads Audio from message
      description: Downloads an Audio file from a message and returns it Base64 media encoded
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/DownloadMedia'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code": 200, "data": {"Data": "data:audio/ogg;base64,T2dnUwACAAAAAAA...=", "Mimetype": "audio/ogg"}, "success": true}
  /chat/presence:
    post:
      tags:
        - Chat 
      summary: Sets chat presence
      description: Sends indication if you are writing or not (state could be either "composing" or "paused"). Optional Media can be set to "audio" for indicating recording a message
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/ChatPresence'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Chat presence set successfuly" }, "success": true } 
  /chat/history:
    get:
      tags:
        - Chat
      summary: Get chat message history
      description: Retrieves message history for a specific chat. Returns messages in reverse chronological order (newest first). Requires message history to be enabled on the server.
      security:
        - ApiKeyAuth: []
      parameters:
        - name: chat_jid
          in: query
          required: true
          description: The JID (WhatsApp ID) of the chat to retrieve history for
          schema:
            type: string
            example: "5491155553333@s.whatsapp.net"
        - name: limit
          in: query
          required: false
          description: Maximum number of messages to retrieve (default is 50)
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 50
            example: 100
      responses:
        200:
          description: Message history retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 200
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: '#/definitions/HistoryMessage'
                example:
                  code: 200
                  success: true
                  data:
                    - id: 1
                      user_id: "abc123def456"
                      chat_jid: "5491155553333@s.whatsapp.net"
                      sender_jid: "5491155554444@s.whatsapp.net"
                      message_id: "3EB0C767D26A1B5F7C83"
                      timestamp: "2023-12-01T15:30:00Z"
                      message_type: "text"
                      text_content: "Hello, how are you?"
                      media_link: ""
                    - id: 2
                      user_id: "abc123def456"
                      chat_jid: "5491155553333@s.whatsapp.net"
                      sender_jid: "5491155553333@s.whatsapp.net"
                      message_id: "4FB1D878E37B2C6G8D94"
                      timestamp: "2023-12-01T15:25:00Z"
                      message_type: "image"
                      text_content: "Check out this photo!"
                      media_link: "https://example.com/media/image123.jpg"
        400:
          description: Bad request - missing or invalid parameters
          content:
            application/json:
              schema:
                example: { "code": 400, "error": "chat_jid is required", "success": false }
        501:
          description: Not implemented - message history is disabled
          content:
            application/json:
              schema:
                example: { "code": 501, "error": "message history is disabled", "success": false }
        500:
          description: Internal server error
          content:
            application/json:
              schema:
                example: { "code": 500, "error": "failed to get message history", "success": false }
  /status/set/text:
    post:
      tags:
        - Status
      summary: Set status message
      description: Updates the current user's status text, which is shown in the "About" section in the user profile.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/StatusText'

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: {"code":200,"data":{"Details":"Set"},"success":true}

  /call/reject:
    post:
      tags:
        - Call
      summary: Reject an incoming call
      description: Rejects an incoming WhatsApp call from a specific user. Requires the caller's JID and the call ID.
      security:
        - ApiKeyAuth: [ ]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/RejectCall'
      responses:
        200:
          description: Call rejected successfully
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Call rejected", "CallID": "ABCD1234567890" }, "success": true }
        400:
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                example: { "code": 400, "error": "missing call_from in Payload", "success": false }
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                example: { "code": 500, "error": "error rejecting call: connection failed", "success": false }
  /group/create:
    post:
      tags:
        - Group
      summary: Create a new WhatsApp group
      description: Creates a new WhatsApp group with the specified name and participants.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/CreateGroup'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "AnnounceVersionID": "1234567890", "DisappearingTimer": 0, "GroupCreated": "2023-12-01T10:00:00Z", "IsAnnounce": false, "IsEphemeral": false, "IsLocked": false, "JID": "120363123456789@g.us", "Name": "My New Group", "NameSetAt": "2023-12-01T10:00:00Z", "NameSetBy": "5491155554444@s.whatsapp.net", "OwnerJID": "5491155554444@s.whatsapp.net", "ParticipantVersionID": "1234567890", "Participants": [{"IsAdmin": true, "IsSuperAdmin": true, "JID": "5491155554444@s.whatsapp.net"}, {"IsAdmin": false, "IsSuperAdmin": false, "JID": "5491155553333@s.whatsapp.net"}] }, "success": true }
  /group/locked:
    post:
      tags:
        - Group
      summary: Set group locked status
      description: Configures whether only admins can modify group info (locked) or all participants can modify (unlocked).
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupLocked'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Group locked setting updated successfully" }, "success": true }
  /group/ephemeral:
    post:
      tags:
        - Group
      summary: Set disappearing timer for group messages
      description: Configures ephemeral/disappearing messages for the group. Messages will automatically disappear after the specified duration.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupEphemeral'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Disappearing timer set successfully" }, "success": true }
  /group/photo/remove:
    post:
      tags:
        - Group
      summary: Remove group photo
      description: Removes the current photo/image from the specified WhatsApp group.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/RemoveGroupPhoto'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Group photo removed successfully" }, "success": true }
  /group/list:
    get:
      tags:
        - Group 
      summary: List subscribed groups
      description: Returns complete list of subscribed groups
      security:
        - ApiKeyAuth: []

      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Groups": [ { "AnnounceVersionID": "1650572126123738", "DisappearingTimer": 0, "GroupCreated": "2022-04-21T17:15:26-03:00", "IsAnnounce": false, "IsEphemeral": false, "IsLocked": false, "JID": "120362023605733675@g.us", "Name": "Super Group", "NameSetAt": "2022-04-21T17:15:26-03:00", "NameSetBy": "5491155554444@s.whatsapp.net", "OwnerJID": "5491155554444@s.whatsapp.net", "ParticipantVersionID": "1650234126145738", "Participants": [ { "IsAdmin": true, "IsSuperAdmin": true, "JID": "5491155554444@s.whatsapp.net" }, { "IsAdmin": false, "IsSuperAdmin": false, "JID": "5491155553333@s.whatsapp.net" }, { "IsAdmin": false, "IsSuperAdmin": false, "JID": "5491155552222@s.whatsapp.net" } ], "Topic": "", "TopicID": "", "TopicSetAt": "0001-01-01T00:00:00Z", "TopicSetBy": "" } ] }, "success": true }
  /group/invitelink:
    get:
      tags:
        - Group 
      summary: Get Group Invite Link
      description: Gets the invite link for a group, optionally resetting it to create a new/different one
      security:
        - ApiKeyAuth: []
      parameters:
        - in: query
          name: groupJID
          schema:
            type: string
          required: true
          description: The JID of the group to retrieve information from
        - in: query
          name: reset
          schema:
            type: boolean
          required: false
          description: Whether to revoke the old invite link and generate a new one (default is false)
      responses:
        200:
          description: Successfull response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "InviteLink": "https://chat.whatsapp.com/HffXhYmzzyJGec61oqMXiz" }, "success": true }
  /group/info:
    get:
      tags:
        - Group 
      summary: Gets group information
      description: Retrieves information about a specific group
      security:
        - ApiKeyAuth: []
      parameters:
        - in: query
          name: groupJID
          schema:
            type: string
          required: true
          description: The JID of the group to retrieve information from
      responses:
        200:
          description: Successful response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "AnnounceVersionID": "1650572126123738", "DisappearingTimer": 0, "GroupCreated": "2022-04-21T17:15:26-03:00", "IsAnnounce": false, "IsEphemeral": false, "IsLocked": false, "JID": "120362023605733675@g.us", "Name": "Super Group", "NameSetAt": "2022-04-21T17:15:26-03:00", "NameSetBy": "5491155554444@s.whatsapp.net", "OwnerJID": "5491155554444@s.whatsapp.net", "ParticipantVersionID": "1650234126145738", "Participants": [ { "IsAdmin": true, "IsSuperAdmin": true, "JID": "5491155554444@s.whatsapp.net" }, { "IsAdmin": false, "IsSuperAdmin": false, "JID": "5491155553333@s.whatsapp.net" }, { "IsAdmin": false, "IsSuperAdmin": false, "JID": "5491155552222@s.whatsapp.net" } ], "Topic": "", "TopicID": "", "TopicSetAt": "0001-01-01T00:00:00Z", "TopicSetBy": "" }, "success": true }
  /group/photo:
    post:
      tags:
        - Group 
      summary: Changes group photo
      description: Allows you to change a group photo/image. Returns the Picture ID number
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupPhoto'
 
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Group Photo set successfully", "PictureID": "1222332123" }, "success": true }
  /group/leave:
    post:
      tags:
        - Group
      summary: Leave a WhatsApp group
      description: Removes the authenticated user from the specified group.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupLeave'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Left group successfully" }, "success": true }
  /group/name:
    post:
      tags:
        - Group
      summary: Change group name
      description: Updates the name of the specified WhatsApp group.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupName'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Group Name set successfully" }, "success": true }
  /group/topic:
    post:
      tags:
        - Group
      summary: Set group topic/description
      description: Updates the topic or description of the specified WhatsApp group.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupTopic'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Group Topic set successfully" }, "success": true }
  /group/announce:
    post:
      tags:
        - Group
      summary: Set group announce mode
      description: Enables or disables "announce" mode (admin-only messages) for the specified group.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupAnnounce'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Group Announce mode set successfully" }, "success": true }
  /group/join:
    post:
      tags:
        - Group
      summary: Join a WhatsApp group via invite code
      description: Joins the WhatsApp group using the given invite code.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupJoin'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Joined group successfully" }, "success": true }
  /group/inviteinfo:
    post:
      tags:
        - Group
      summary: Get information about a group invite code
      description: Returns details about a WhatsApp group given an invite code.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/GroupInviteInfo'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "InviteInfo": { "GroupName": "Test Group", "GroupJID": "120363312246943103@g.us" } }, "success": true }
  /group/updateparticipants:
    post:
      tags:
        - Group
      summary: Add, remove, promote or demote participants from a group
      description: Adds or removes participants from the specified WhatsApp group.
      security:
        - ApiKeyAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/definitions/UpdateGroupParticipants'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                example: { "code": 200, "data": { "Details": "Participants updated successfully" }, "success": true }

definitions:
  ContextInfo:
    type: object
    description: "Optional context info for replies"
    properties:
      StanzaId:
        type: string
        example: "3EB06F9067F80BAB89FF"
        description: "Message ID to reply to"
      Participant:
        type: string
        example: "5491155553935@s.whatsapp.net"
        description: "JID of original message sender"
      IsForwarded:
        type: boolean
        example: true
        description: "Set to true to mark the message as forwarded. This is the preferred method for forwarding messages."
      MentionedJID:
        type: array
        items:
          type: string
        example:
          ["5491155553935@s.whatsapp.net", "5491155553936@s.whatsapp.net"]
        description: "Array of JIDs to mention in the message. Use full WhatsApp JID format (number@s.whatsapp.net)."
  User:
    type: object
    properties:
      id:
        type: string
        example: 4e4942c7dee1deef99ab8fd9f7350de5
      name:
        type: string
        example: John Doe
      token:
        type: string
        example: "1234ABCD"
      webhook:
        type: string
        example: "https://webhook.site/1234567890"
      events:
        type: string
        example: "All"
      proxy_config:
        type: object
        properties:
          enabled:
            type: boolean
            example: true
          proxy_url:
            type: string
            example: "https://serverproxy.com:9080"
      s3_config:
        type: object
        properties:
          enabled:
            type: boolean
            example: true
          endpoint:
            type: string
            example: "https://s3.amazonaws.com"
          region:
            type: string
            example: "us-east-1"
          bucket:
            type: string
            example: "my-bucket"
          access_key:
            type: string
            example: "***"
          path_style:
            type: boolean
            example: true
          public_url:
            type: string
            example: "https://s3.amazonaws.com"
          media_delivery:
            type: string
            example: "both"
          retention_days:
            type: integer
            example: 30

  CreateUser:
    type: object
    required:
      - name
      - token
    properties:
      name:
        type: string
        example: John Doe
      token:
        type: string
        example: "1234ABCD"
      webhook:
        type: string
        example: "https://webhook.site/1234567890"
        description: "Webhook URL to receive events"
      events:
        type: string
        example: "All"
        description: "Events to subscribe to. Ex: 'All', 'Message', 'Presence'"
      proxyConfig:
        type: object
        properties:
          enabled:
            type: boolean
            example: true
            description: "Enable proxy for the user, default is false"
          proxyURL:
            type: string
            example: "https://serverproxy.com:9080"
            description: "Proxy URL to use for the user. Format: socks5://user:pass@host:port or http://host:port"
      s3Config:
        type: object
        properties:
          enabled:
            type: boolean
            example: true
            description: "Enable S3 for the user, default is false"
          endpoint:
            type: string
            example: "https://s3.amazonaws.com"
          region:
            type: string
            example: "us-east-1"
          bucket:
            type: string
            example: "my-bucket"
          accessKey:
            type: string
            example: "1234567890"
          secretKey:
            type: string
            example: "1234567890"
          pathStyle:
            type: boolean
            example: true
            description: "Enable path style for the user, default is false"
          publicURL:
            type: string
            example: "https://s3.amazonaws.com"
            description: "Public URL for the user"
          mediaDelivery:
            type: string
            example: "both"
            description: "Media delivery type for the user, default is both"
          retentionDays:
            type: integer
            example: 30
            description: "Retention days for the user, default is 30"
      history:
        type: integer
        example: 0
        description: "Number of messages to store in history per chat for this user. 0 means no history is saved, any positive number enables history storage for that many messages per chat. Default is 0"
        default: 0

  DeleteUser:
    type: object
    properties:
      id:
        type: string
        example: 4e4942c7dee1deef99ab8fd9f7350de5
  HistoryMessage:
    type: object
    properties:
      id:
        type: integer
        description: "Unique identifier for the message in the history database"
        example: 1
      user_id:
        type: string
        description: "ID of the user who owns this message history"
        example: "abc123def456"
      chat_jid:
        type: string
        description: "WhatsApp JID of the chat where this message was sent/received"
        example: "5491155553333@s.whatsapp.net"
      sender_jid:
        type: string
        description: "WhatsApp JID of the user who sent this message"
        example: "5491155554444@s.whatsapp.net"
      message_id:
        type: string
        description: "WhatsApp message ID"
        example: "3EB0C767D26A1B5F7C83"
      timestamp:
        type: string
        format: date-time
        description: "Timestamp when the message was sent/received"
        example: "2023-12-01T15:30:00Z"
      message_type:
        type: string
        description: "Type of message (text, image, audio, video, document, sticker, contact, location, etc.)"
        example: "text"
      text_content:
        type: string
        description: "Text content of the message (for text messages or captions)"
        example: "Hello, how are you?"
      media_link:
        type: string
        description: "Link to media file (for media messages)"
        example: "https://example.com/media/image123.jpg"
  GroupPhoto:
    type: object
    properties:
      GroupJID:
        type: string
        example: "120362023605733675@g.us"
      Image:
        type: string
        description: "Base64 encoded image data with data URL format. Supported format: JPEG!"
        example: "data:image/jpeg;base64,Akd9300..."
  GroupInfo:
    type: object
    properties:
      GroupJID:
        type: string
        example: "120362023605733675@g.us"
  GroupInviteLink:
    type: object
    properties:
      GroupJID:
        type: string
        example: "120362023605733675@g.us"
      Reset:
        type: boolean
        example: false
  Connect:
    type: object
    properties:
      Subscribe:
        type: string
        example: ["Message","ChatPresence"]
      Immediate:
        type: boolean
  DownloadMedia:
    type: object
    required:
      - Url
      - MediaKey
      - Mimetype
      - FileSHA256
      - FileLength
    properties:
      Url:
        type: string
      DirectPath:
        type: string
      MediaKey:
        type: string
      Mimetype:
        type: string
      FileEncSHA256:
        type: string
      FileSHA256:
        type: string
      FileLength:
        type: number
  ChatPresence:
    type: object
    required: 
      - Phone
      - State
    properties:
      Phone:
        type: string
        example: "5491155553935"
      State:
        type: string
        example: composing
      Media: 
        type: string
        example: audio
  StatusText:
    type: object
    required:
      - body
    properties:
      body:
        type: string
        example: Hi
  UserPresence:
    type: object
    required:
      - type
    properties:
      type:
        type: string
        example: available
  MessageContact:
    type: object
    required: 
      - Phone
      - Name
      - Vcard
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Name:
        type: string
        example: John
      Id:
        type: string
        example: "ABCDABCD1234"
      Vcard:
        type: string
        example: "BEGIN:VCARD\nVERSION:3.0\nN:Doe;John;;;\nFN:John Doe\nORG:Example.com Inc.;\nTITLE:Imaginary test person\nEMAIL;type=INTERNET;type=WORK;type=pref:johnDoe@example.org\nTEL;type=WORK;type=pref:+1 617 555 1212\nTEL;type=WORK:+1 (617) 555-1234\nTEL;type=CELL:+1 781 555 1212\nTEL;type=HOME:+1 202 555 1212\nitem1.ADR;type=WORK:;;2 Enterprise Avenue;Worktown;NY;01111;USA\nitem1.X-ABADR:us\nitem2.ADR;type=HOME;type=pref:;;3 Acacia Avenue;Hoitem2.X-ABADR:us\nEND:VCARD"
      ContextInfo:
        $ref: "#/definitions/ContextInfo"


  MessageLocation:
    type: object
    required: 
      - Phone
      - Latitude
      - Longitude
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Name:
        type: string
        example: Party
      Id:
        type: string
        example: "ABCDABCD1234"
      Latitude:
        type: float
        example: 48.858370
      Longitude:
        type: float
        example: 2.294481
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
  ReactionText:
    type: object
    required: 
      - Phone
      - Body
      - Id 
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Body:
        type: string
        example: "❤️"
      Id:
        type: string
        example: "me:3EB06F9067F80BAB89FF"

  MessagePoll:
    type: object
    required:
      - Group
      - Header
      - Options
    properties:
      Group:
        type: string
        example: "120363417042313103@g.us"
      Header:
        type: string
        example: "What's your favorite color"
      Options:
        type: array
        description: An array of options for the poll.
        items:
          type: string
          example: "Red"
      Id:
        type: string
        example: "3EB06F9067F80BAB89FF"

  MessageList:
    type: object
    required:
      - Phone
      - ButtonText
      - Desc
      - TopText
      - List
    properties:
      Phone:
        type: string
        example: "5521971532700"
      ButtonText:
        type: string
        example: Click Here
      Desc:
        type: string
        example: This is a list
      TopText:
        type: string
        example: This is a list
      FooterText:
        type: string
        example: This is a footer text
      List:
        type: array
        items:
          type: object
          properties:
            title:
              type: string
              example: menu button 1
            desc:
              type: string
              example: long description
            RowId:
              type: string
              example: 1

  MessageButtons:
    type: object
    required:
      - Phone
      - Body
    properties:
      Phone:
        type: string
        example: "5521971532700"
      Body:
        type: string
        example: How you doin
      Id:
        type: string
        example: "ABCDABCD1234"
      ContextInfo:
        type: object
        required:
          - StanzaId
          - Participant
        properties:
          StanzaId: 
            type: string
            example: "3EB06F9067F80BAB89FF" 
          Participant: 
            type: string
            example: "5491155553935@s.whatsapp.net"

  MessageText:
    type: object
    required:
      - Phone
      - Body
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Body:
        type: string
        example: How you doin
      LinkPreview:
        type: boolean
        description: "Set to true to enable link preview generation (default is false)"
        example: true
      Id:
        type: string
        example: "ABCDABCD1234"
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
      QuotedText:
        type: string
        description: "Text content of the message being replied to (for displaying quote preview)"
        example: "Original message text"
  MessageImage:
    type: object
    required: 
      - Phone
      - Image
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Image:
        type: string
        example: data:image/jpeg;base64,iVBORw0
      Caption:
        type: string
        example: Image Description
      Id:
        type: string
        example: "ABCDABCD1234"
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
  MessageAudio:
    type: object
    required:
      - Phone
      - Audio
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Audio:
        type: string
        example: "data:audio/ogg;base64,iVBORw0a"
      Id:
        type: string
        example: "ABCDABCD1234"
      PTT:
        type: boolean
        example: true
      MimeType:
        type: string
        example: "audio/ogg; codecs=opus"
      Seconds:
        type: integer
        format: uint32
        example: 15
      Waveform:
        type: array
        items:
          type: integer
          format: byte
        example: [0, 0, 0, 12, 20, 20, 22, 10, 5, 0, 0, 0]
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
  MessageVideo:
    type: object
    required: 
      - Phone
      - Video 
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Video:
        type: string
        example: "data:video/mp4;base64,iVBORw0"
      Caption:
        type: string
        example: "my video"
      Id:
        type: string
        example: "ABCDABCD1234"
      JpegThumbnail:
        type: string
        example: "AA00D010"
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
  MessageSticker:
    type: object
    required: 
      - Phone
      - Sticker
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Sticker:
        type: string
        example: "data:image/webp;base64,iVBORw0"
      Id:
        type: string
        example: "ABCDABCD1234"
      PngThumbnail:
        type: string
        example: "AA00D010"
      MimeType:
        type: string
        example: "image/webp"
      PackId:
        type: string
        example: "my.sticker.pack.id"
      PackName:
        type: string
        example: "My Pack"
      PackPublisher:
        type: string
        example: "Wuzapi"
      Emojis:
        type: array
        items:
          type: string
        example: ["😀", "🎉"]
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
        description: "Optional context info for replies, mentions, and forwarding"
  MessageDocument:
    type: object
    required: 
      - Phone
      - Document 
      - FileName 
    properties:
      Phone:
        type: string
        example: "5491155553935"
      Document:
        type: string
        example: data:application/octet-stream;base64,aG9sYSBxdWUKdGFsCmNvbW8KZXN0YXMK
      FileName:
        type: string
        example: file.txt
      Id:
        type: string
        example: "ABCDABCD1234"
      ContextInfo:
        $ref: "#/definitions/ContextInfo"
  MessageTemplate:
    type: object
    required: 
      - Phone
      - Content 
    properties:
      Id:
        type: string
        example: "ABCDABCD1234"
      Phone:
        type: string
        example: "5491155553935"
      Content:
        type: string
        example: Message title
      Footer:
        type: string
        example: Text below title, above buttons
      Buttons:
          type: object
          example: [{"DisplayText":"Yes","Type":"quickreply"},{"DisplayText":"No","Type":"quickreply"},{"DisplayText":"Visit Site","Type":"url","Url":"https://www.fop2.com"},{"DisplayText":"Callme","Type":"call","PhoneNumber":"1155553934"}]
          properties:
            DisplayText:
              type: string
              example: Text for Button
            Type:
              type: quickreply|url|call
      ContextInfo:
        type: object
        required:
          - StanzaId
          - Participant
        properties:
          StanzaId:
            type: string
            example: "3EB06F9067F80BAB89FF"
          Participant:
            type: string
            example: "5491155553935@s.whatsapp.net"
  DeleteMessage:
    type: object
    required:
      - Id
      - Phone
    properties:
      Id:
        type: string
        example: "1234-abcd-21234"
      Phone:
        type: string
        example: "5491155553934"
  Markread:
    type: object
    required:
      - Id
      - Chat
    properties:
      Id:
        type: object
        example: ["AABBCC11223344","DDEEFF55667788"]
      ChatPhone:
        type: string
        example: "5491155553934"
      SenderPhone:
        type: string
        example: "5491155553111"
  RejectCall:
    type: object
    required:
      - call_from
      - call_id
    properties:
      call_from:
        type: string
        description: The JID (WhatsApp ID) of the caller to reject
        example: "5491155553934@s.whatsapp.net"
      call_id:
        type: string
        description: The unique identifier of the call to reject
        example: "ABCD1234567890EFGH"
  Pairphone:
    type: object
    required:
      - Phone
    properties:
      Phone:
        type: string
        example: "5491155553934"
  Checkuser:
    type: object
    required:
      - Phone
    properties:
      Phone:
        type: object
        example: ["5491155553934","5491155553935"]
  Checkavatar:
    type: object
    required:
      - Phone
      - Preview
    properties:
      Phone:
        type: string 
        example: "5491155553934"
      Preview:
        type: bool
        example: true
  Webhook:
    type: object
    required:
      - WebhookURL
    properties:
      WebhookURL:
        type: string
        example: http://server/webhook

  WebhookSet:
    type: object
    required:
      - webhook
      - events
    properties:
      webhook:
        type: string
        description: The URL of the webhook
        example: "https://example.net/webhook"
      events:
        type: array
        items:
          type: string
        description: List of events to subscribe to
        example: ["Message", "ReadReceipt"]

  WebhookUpdate:
    type: object
    properties:
      webhook:
        type: string
        description: The URL of the webhook
        example: "https://example.net/webhook"
      events:
        type: array
        items:
          type: string
        description: List of events to subscribe to
        example: ["Message", "ReadReceipt"]
      Active:
        type: boolean
        description: Whether the webhook should be active or not
        example: true

  GroupLeave:
    type: object
    required:
      - GroupJID
    properties:
      GroupJID:
        type: string
        description: The JID of the group to leave (e.g., 120363312246943103@g.us)
        example: 120363312246943103@g.us

  GroupName:
    type: object
    required:
      - GroupJID
      - Name
    properties:
      GroupJID:
        type: string
        description: The JID of the group to rename
        example: 120363312246943103@g.us
      Name:
        type: string
        description: The new name for the group
        example: My New Group Name

  GroupTopic:
    type: object
    required:
      - GroupJID
      - Topic
    properties:
      GroupJID:
        type: string
        description: The JID of the group to set the topic for
        example: 120363312246943103@g.us
      Topic:
        type: string
        description: The new topic/description for the group
        example: Welcome to our project group!

  GroupAnnounce:
    type: object
    required:
      - GroupJID
      - Announce
    properties:
      GroupJID:
        type: string
        description: The JID of the group to set announce mode
        example: 120363312246943103@g.us
      Announce:
        type: boolean
        description: Whether to enable (true) or disable (false) announce mode
        example: true

  GroupJoin:
    type: object
    required:
      - Code
    properties:
      Code:
        type: string
        description: The invite code or link to join the group
        example: HffXhYmzzyJGec61oqMXiz

  GroupInviteInfo:
    type: object
    required:
      - Code
    properties:
      Code:
        type: string
        description: The group invite code to get information for
        example: HffXhYmzzyJGec61oqMXiz

  UpdateGroupParticipants:
    type: object
    required:
      - GroupJID
      - Action
      - Phone
    properties:
      GroupJID:
        type: string
        description: The JID of the group
        example: 120363312246943103@g.us
      Action:
        type: string
        description: Action to perform ("add" to add participants, "remove" to remove participants, "promote" to promote participants, "demote" to demote participants.)
        enum: [add, remove, promote, demote]
        example: add
      Phone:
        type: array
        items:
          type: string
          description: List of participant JIDs (e.g., 5491112345678@s.whatsapp.net or 5491112345678)
        example: [ "5491112345678", "5491123456789@s.whatsapp.net" ]

  CreateGroup:
    type: object
    required:
      - Name
      - Participants
    properties:
      Name:
        type: string
        description: The name for the new group
        example: "My New Group"
      Participants:
        type: array
        items:
          type: string
          description: List of participant phone numbers (without country code prefix symbols)
        example: [ "5491112345678", "5491123456789" ]

  GroupLocked:
    type: object
    required:
      - GroupJID
      - Locked
    properties:
      GroupJID:
        type: string
        description: The JID of the group to configure
        example: "120363312246943103@g.us"
      Locked:
        type: boolean
        description: Whether to lock the group (true) or unlock it (false). When locked, only admins can modify group info.
        example: true

  GroupEphemeral:
    type: object
    required:
      - GroupJID
      - Duration
    properties:
      GroupJID:
        type: string
        description: The JID of the group to configure ephemeral messages
        example: "120363312246943103@g.us"
      Duration:
        type: string
        description: Duration for disappearing messages. Use "24h" for 24 hours, "7d" for 7 days, "90d" for 90 days, or "off" to disable.
        enum: ["24h", "7d", "90d", "off"]
        example: "24h"

  RemoveGroupPhoto:
    type: object
    required:
      - GroupJID
    properties:
      GroupJID:
        type: string
        description: The JID of the group to remove the photo from
        example: "120363312246943103@g.us"

  S3Config:
    type: object
    properties:
      enabled:
        type: boolean
        description: Whether S3 storage is enabled
        example: true
      endpoint:
        type: string
        description: S3 endpoint URL (leave empty for AWS S3)
        example: "https://s3.amazonaws.com"
      region:
        type: string
        description: S3 region
        example: "us-east-1"
      bucket:
        type: string
        description: S3 bucket name
        example: "my-whatsapp-media"
      access_key:
        type: string
        description: S3 access key ID
        example: "AKIAIOSFODNN7EXAMPLE"
      secret_key:
        type: string
        description: S3 secret access key
        example: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
      path_style:
        type: boolean
        description: Use path-style URLs (required for MinIO)
        example: false
      public_url:
        type: string
        description: Custom public URL for accessing files (optional, for CDN)
        example: "https://cdn.example.com"
      media_delivery:
        type: string
        description: Media delivery method
        enum: ["base64", "s3", "both"]
        example: "both"
      retention_days:
        type: integer
        description: Number of days to retain files (0 for no expiration)
        example: 30

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: token
    AdminAuth:
      type: apiKey
      in: header
      name: Authorization

security:
  - ApiKeyAuth: []
