{
  "openapi": "3.0.3",
  "info": {
    "title": "WhatsApp Messaging Direct Cloud API — by Retention Stack",
    "description": "Direct Cloud API for WhatsApp messaging. Authenticate using your WhatsApp Session Token (Authorization: Bearer ch_live_...) for automatic session routing, or Account API Key (ak_live_...) for multi-session management. Start with /start to get your session token.",
    "version": "1.0.0",
    "contact": {
      "name": "Retention Stack support",
      "email": "support@retentionstack.agency",
      "url": "https://whatsapp-messaging.retentionstack.agency/docs"
    }
  },
  "components": {
    "schemas": {
      "Success": {
        "type": "object",
        "required": [
          "success",
          "data",
          "timestamp"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "description": "Operation-specific messaging-engine result. It can be an object, array, scalar or null; additional engine fields are preserved."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "success",
          "error",
          "timestamp"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INTERNAL_ERROR",
                  "VALIDATION_ERROR",
                  "UNAUTHORIZED",
                  "FORBIDDEN",
                  "NOT_FOUND",
                  "RATE_LIMIT_EXCEEDED",
                  "INVALID_API_KEY",
                  "API_KEY_INACTIVE",
                  "UPSTREAM_ERROR",
                  "RECIPIENT_LOOKUP_FAILED",
                  "CHANNEL_SUBSCRIPTION_REQUIRED"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {
                "description": "Optional recovery information. Validation errors may contain an array; application errors normally contain an object."
              }
            }
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ch_live_... | ak_live_...",
        "description": "Direct WhatsApp Session Token (Authorization: Bearer ch_live_...) or Account API Key (ak_live_...). Generated in your dashboard at https://whatsapp-messaging.retentionstack.agency/start."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request or session not ready. Inspect error.details for validation issues, currentStatus, nextSteps or nextStep; link WhatsApp before sending.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "Check the required request parameters and session status."
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid credentials. Supply a valid WhatsApp Session Token (Authorization: Bearer ch_live_...) or Account API Key (ak_live_...).",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "UNAUTHORIZED",
                "message": "API key is required"
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Session belongs to another account, or session creation exceeds your plan allowance. Reuse an owned session or change your plan.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "FORBIDDEN",
                "message": "Access denied to this session"
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "NotFound": {
        "description": "Session or resource not found. Inspect availableSessions when supplied; use names returned by session creation.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "NOT_FOUND",
                "message": "Session not found"
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "Conflict": {
        "description": "State conflict. A session may need connecting, or may already be connected during QR/pairing. Read the message and recovery details. A rare creation-name collision can be retried.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "Session is not connected yet. Start it and link WhatsApp."
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Messaging-service rate limit. A gateway quota rejection can use a different body and headers. Honor Retry-After when supplied; distinguish a short-window limit from an exhausted monthly quota.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "The messaging service rejected this request. Check the session status and request parameters."
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "InternalError": {
        "description": "API or messaging-service failure. A timeout or server error does not prove a send failed: inspect delivery acknowledgments before repeating a send.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "INTERNAL_ERROR",
                "message": "Internal server error"
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "UpstreamError": {
        "description": "Could not reach the messaging service, or the service returned 502. Save X-Request-Id. Check delivery status before retrying writes.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "UPSTREAM_ERROR",
                "message": "The messaging service is temporarily unavailable. Check delivery status before retrying a send."
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      },
      "OtherUpstreamError": {
        "description": "Additional messaging-service rejection. Upstream 4xx/5xx statuses are generally preserved (including 503/504); inspect error.code, message and optional upstreamStatus/upstreamReason. Gateway-generated errors can have a different body.",
        "headers": {
          "X-Request-Id": {
            "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "UPSTREAM_ERROR",
                "message": "The messaging service is temporarily unavailable. Check delivery status before retrying a send."
              },
              "timestamp": "2026-11-02T00:00:00.000Z"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "system"
        ],
        "description": "Check that the API process is running. No API key is required on the direct service. This does not check WhatsApp connectivity; check a session with getSession.",
        "responses": {
          "200": {
            "description": "Check that the API process is running. No API key is required on the direct service. This does not check WhatsApp connectivity; check a session with getSession.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "string"
                        },
                        "uptime": {
                          "type": "number"
                        },
                        "environment": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "status",
                        "timestamp",
                        "uptime",
                        "environment"
                      ],
                      "additionalProperties": false
                    },
                    "timestamp": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "data",
                    "timestamp"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "success": true,
                  "data": {
                    "status": "ok",
                    "timestamp": "2026-11-02T00:00:00.000Z",
                    "uptime": 120,
                    "environment": "production"
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "operationId": "getHealth",
        "summary": "Check API health",
        "security": []
      }
    },
    "/v1/sessions": {
      "post": {
        "operationId": "createSession",
        "summary": "Create session",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "201": {
            "description": "Session created and started. Save data.name; a requested name is ignored.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "timestamp"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "name",
                        "status"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "Engine session state; wait for WORKING before sending."
                        }
                      },
                      "additionalProperties": true
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "name": "session_example_1793577600000_ab12cd",
                    "status": "SCAN_QR_CODE",
                    "me": null
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The plan session allowance is reached, or (when starting by name) the session is owned by another account. Inspect availableSessions and nextRequest recovery details when supplied.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Session limit reached. Your plan allows 1 session(s)",
                    "details": {
                      "availableSessions": [
                        {
                          "name": "session_example_1793577600000_ab12cd",
                          "status": "SCAN_QR_CODE",
                          "nextRequest": {
                            "method": "GET",
                            "path": "/v1/session_example_1793577600000_ab12cd/auth/qr"
                          }
                        }
                      ]
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Create and start one WhatsApp session. The server generates its name; save data.name and use it for later calls. A supplied name is ignored. A 403 can mean your plan already has its maximum number of sessions; reuse a session from error.details.availableSessions. A rare generated-name collision returns 409; retry creation in that case.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "get": {
        "operationId": "listSessions",
        "summary": "List sessions",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "Owned sessions. Before creation, data is an empty array.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "timestamp"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": [],
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        },
        "description": "List only the sessions owned by your account. An empty data array means you have no sessions yet. Use each returned name in session parameters; status can be refreshed from the messaging service when available.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}": {
      "delete": {
        "operationId": "deleteSession",
        "summary": "Delete session",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Delete your session from the messaging service and the local session registry. This removes the API session; create and link a new session if you need it again.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "get": {
        "operationId": "getSession",
        "summary": "Get session",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read your session state. Use the name returned by session creation. Wait for WORKING before sending; if the session needs linking, request its QR or pairing code.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/me": {
      "get": {
        "operationId": "getSessionMe",
        "summary": "Get session me",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read the WhatsApp account linked to your session. This requires ownership of the session; account details depend on the messaging engine and whether linking is complete.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/start": {
      "post": {
        "operationId": "startSession",
        "summary": "Start session",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "description": "Session name to start. If omitted and you have no sessions, one will be auto-created. If omitted and you have existing sessions, you must specify which one to start.",
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "description": "Start a WhatsApp session"
              },
              "example": {
                "name": "me"
              }
            }
          },
          "description": "Start a WhatsApp session"
        },
        "responses": {
          "200": {
            "description": "Existing session started or its current connected state returned.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "timestamp"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "name",
                        "status"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "Engine session state; wait for WORKING before sending."
                        }
                      },
                      "additionalProperties": true
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "name": "session_example_1793577600000_ab12cd",
                    "status": "WORKING"
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "201": {
            "description": "Session created and started. Save data.name; a requested name is ignored.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "timestamp"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "name",
                        "status"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "description": "Engine session state; wait for WORKING before sending."
                        }
                      },
                      "additionalProperties": true
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "name": "session_example_1793577600000_ab12cd",
                    "status": "SCAN_QR_CODE",
                    "me": null
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The plan session allowance is reached, or (when starting by name) the session is owned by another account. Inspect availableSessions and nextRequest recovery details when supplied.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Session limit reached. Your plan allows 1 session(s)",
                    "details": {
                      "availableSessions": [
                        {
                          "name": "session_example_1793577600000_ab12cd",
                          "status": "SCAN_QR_CODE",
                          "nextRequest": {
                            "method": "GET",
                            "path": "/v1/session_example_1793577600000_ab12cd/auth/qr"
                          }
                        }
                      ]
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Start or recover your session using its name. Already connected sessions return their current state without restarting. An empty body auto-creates a session only when you have none; otherwise supply name. Auto-creation returns 201; existing sessions return 200.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/stop": {
      "post": {
        "operationId": "stopSession",
        "summary": "Stop session",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Session name to stop"
                  },
                  "logout": {
                    "description": "Logout the session when stopping (optional)",
                    "type": "boolean"
                  }
                },
                "required": [
                  "name"
                ],
                "description": "Stop an active WhatsApp session"
              },
              "example": {
                "name": "me"
              }
            }
          },
          "description": "Stop an active WhatsApp session"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Stop your named session. The optional logout flag also logs it out. Sending requires a running, linked session; start it again before sending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/logout": {
      "post": {
        "operationId": "logoutSession",
        "summary": "Logout session",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Session name to logout"
                  }
                },
                "required": [
                  "name"
                ],
                "description": "Logout from a WhatsApp session"
              },
              "example": {
                "name": "me"
              }
            }
          },
          "description": "Logout from a WhatsApp session"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Log WhatsApp out of your named session. Link the account again with a QR or pairing code before sending more messages.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/webhooks": {
      "post": {
        "operationId": "addSessionWebhook",
        "summary": "Add session webhook",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "webhookUrl": {
                    "type": "string",
                    "format": "uri",
                    "description": "URL to send webhook events"
                  },
                  "events": {
                    "description": "Specific events to subscribe to (e.g., message.create, presence.update)",
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "hmacKey": {
                    "description": "Optional HMAC key for webhook signature verification",
                    "type": "string"
                  },
                  "retries": {
                    "description": "Optional retry configuration for webhook delivery",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "policy": {
                            "description": "Retry policy: constant, linear, or exponential",
                            "type": "string",
                            "enum": [
                              "constant",
                              "linear",
                              "exponential"
                            ]
                          },
                          "delaySeconds": {
                            "description": "Initial delay between retries in seconds",
                            "type": "number"
                          },
                          "attempts": {
                            "description": "Maximum number of retry attempts",
                            "type": "number"
                          }
                        }
                      },
                      {
                        "nullable": true,
                        "enum": [
                          null
                        ],
                        "type": "string"
                      }
                    ]
                  },
                  "customHeaders": {
                    "description": "Optional custom headers to include in webhook requests",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Header name"
                        },
                        "value": {
                          "type": "string",
                          "description": "Header value"
                        }
                      },
                      "required": [
                        "name",
                        "value"
                      ]
                    }
                  }
                },
                "required": [
                  "webhookUrl"
                ],
                "description": "Webhook configuration for session events"
              },
              "example": {
                "webhookUrl": "https://your-server.example/webhooks/whatsapp",
                "events": [
                  "message",
                  "message.ack",
                  "session.status"
                ]
              }
            }
          },
          "description": "Webhook configuration for session events"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Register an HTTPS callback for your session. events defaults to [\"message\"]. Optional hmacKey, retries and customHeaders configure delivery. The callback receives event, session and payload fields. The default retry policy is exponential with delaySeconds=2 and attempts=3. Handle duplicate deliveries in your receiver.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteSessionWebhook",
        "summary": "Delete session webhook",
        "tags": [
          "Sessions"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "webhookUrl": {
                    "type": "string",
                    "format": "uri",
                    "description": "Webhook URL to delete"
                  }
                },
                "required": [
                  "webhookUrl"
                ],
                "description": "Delete webhook configuration"
              },
              "example": {
                "webhookUrl": "https://your-server.example/webhooks/whatsapp"
              }
            }
          },
          "description": "Delete webhook configuration"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Remove a callback by sending the same webhookUrl in the JSON body. A missing registration returns 404. Other callbacks on this session remain registered.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/{session}/auth/qr": {
      "get": {
        "operationId": "getQRCode",
        "summary": "Get QR code",
        "tags": [
          "Auth"
        ],
        "description": "Get a QR code for linking your session. STOPPED and FAILED sessions are recovered automatically. The default response wraps the engine QR object (including its data field) in data; format=binary returns image/png when QR data is available. A connected session returns 409; use it without linking again.",
        "parameters": [
          {
            "schema": {
              "default": "base64",
              "type": "string",
              "enum": [
                "binary",
                "base64"
              ]
            },
            "in": "query",
            "name": "format",
            "required": false,
            "description": "Response format: \"binary\" returns PNG image, \"base64\" returns JSON with base64 data (default)"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Session is already connected, or cannot enter a linkable state. Read the message and nextStep; do not log out a working session just to fetch a QR.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Session is already connected. No need to scan QR code or request pairing code.",
                    "details": {
                      "status": "WORKING",
                      "nextStep": "Use the existing connected session to send messages."
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Default JSON wraps the engine QR object. format=binary returns PNG bytes when QR data exists; otherwise JSON is returned. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data",
                    "timestamp"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "data": {
                          "type": "string",
                          "description": "Base64 image data, when provided by the engine. Prefix with data:image/png;base64, for an HTML image."
                        }
                      }
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB"
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/{session}/auth/pairing-code": {
      "post": {
        "operationId": "requestPairingCode",
        "summary": "Request pairing code",
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phoneNumber": {
                    "type": "string",
                    "pattern": "^\\d{10,15}$",
                    "description": "Phone number (10-15 digits)"
                  }
                },
                "required": [
                  "phoneNumber"
                ],
                "description": "Phone number for session authorization"
              },
              "example": {
                "phoneNumber": "15551234567"
              }
            }
          },
          "description": "Phone number for session authorization"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Session is already connected, or cannot enter a linkable state. Read the message and nextStep; do not log out a working session just to fetch a QR.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Session is already connected. No need to scan QR code or request pairing code.",
                    "details": {
                      "status": "WORKING",
                      "nextStep": "Use the existing connected session to send messages."
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Request a phone-number pairing code for your session. Supply 10–15 digits including the country code, without + or spaces, then enter the returned code in WhatsApp Linked Devices. STOPPED and FAILED sessions recover automatically. An already connected session returns 409.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/{session}/auth/passkey/challenge": {
      "get": {
        "operationId": "getPasskeyChallenge",
        "summary": "Get passkey challenge",
        "tags": [
          "Auth"
        ],
        "description": "Use when your session status is PASSKEY_REQUIRED. Returns the WebAuthn challenge (challenge, rpId, allowCredentials, userVerification, timeout). It must be signed in a browser on web.whatsapp.com, which the WhatsApp browser extension does for you. Returns 422 when no challenge is pending.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/{session}/auth/passkey": {
      "post": {
        "operationId": "submitPasskey",
        "summary": "Submit passkey assertion",
        "tags": [
          "Auth"
        ],
        "description": "Send the signed WebAuthn assertion exactly as returned by credential.toJSON(). Most sessions then move to WORKING; poll getSession to confirm. If the status becomes PASSKEY_CONFIRMATION_REQUIRED, continue with getPasskeyConfirmation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rawId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "public-key"
                    ]
                  },
                  "response": {
                    "type": "object",
                    "properties": {
                      "clientDataJSON": {
                        "type": "string",
                        "minLength": 1
                      },
                      "authenticatorData": {
                        "type": "string",
                        "minLength": 1
                      },
                      "signature": {
                        "type": "string",
                        "minLength": 1
                      },
                      "userHandle": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "nullable": true,
                            "enum": [
                              null
                            ],
                            "type": "string"
                          }
                        ]
                      }
                    },
                    "required": [
                      "clientDataJSON",
                      "authenticatorData",
                      "signature"
                    ]
                  }
                },
                "required": [
                  "id",
                  "rawId",
                  "type",
                  "response"
                ],
                "additionalProperties": {},
                "description": "WebAuthn assertion exactly as returned by credential.toJSON() on web.whatsapp.com"
              },
              "example": {
                "id": "AbCdEf0123456789_credential_id",
                "rawId": "AbCdEf0123456789_credential_id",
                "type": "public-key",
                "response": {
                  "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0In0",
                  "authenticatorData": "SZYN5YgOjGh0NBcPZHZgW4_krrmihjLHmVzzuoMdl2M",
                  "signature": "MEUCIQDexampleSignature",
                  "userHandle": null
                }
              }
            }
          },
          "description": "WebAuthn assertion exactly as returned by credential.toJSON() on web.whatsapp.com"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/{session}/auth/passkey/confirmation": {
      "get": {
        "operationId": "getPasskeyConfirmation",
        "summary": "Get passkey confirmation code",
        "tags": [
          "Auth"
        ],
        "description": "Use only when your session status is PASSKEY_CONFIRMATION_REQUIRED. Returns a 4-digit code to compare with the code shown on your phone.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/{session}/auth/passkey/confirm": {
      "post": {
        "operationId": "confirmPasskey",
        "summary": "Confirm passkey code",
        "tags": [
          "Auth"
        ],
        "description": "Call after you confirm the 4-digit code matches your phone. The session then continues linking; poll getSession until it is WORKING.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendText": {
      "post": {
        "operationId": "sendText",
        "summary": "Send text message",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Message text content"
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  },
                  "mentions": {
                    "description": "Optional array of contact IDs to mention",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "linkPreview": {
                    "description": "Enable link preview for links in the message",
                    "type": "boolean"
                  },
                  "linkPreviewHighQuality": {
                    "description": "Enable high-quality link preview (requires additional upload to WA servers)",
                    "type": "boolean"
                  }
                },
                "required": [
                  "chatId",
                  "text",
                  "session"
                ],
                "description": "Send a text message to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "text": "Your order is ready for collection.",
                "session": "me",
                "linkPreview": true,
                "linkPreviewHighQuality": false
              }
            }
          },
          "description": "Send a text message to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send text to a contact, group or channel. Put session in the body, using the name returned by session creation. linkPreview and linkPreviewHighQuality are optional. A successful response confirms acceptance only; use message.ack webhooks to confirm delivery or reading. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendImage": {
      "post": {
        "operationId": "sendImage",
        "summary": "Send image",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "caption": {
                    "description": "Optional caption for the media",
                    "type": "string"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  },
                  "mentions": {
                    "description": "Optional array of contact IDs to mention",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "file": {
                    "type": "object",
                    "properties": {
                      "mimetype": {
                        "description": "MIME type of the file (e.g., image/jpeg, application/pdf)",
                        "type": "string"
                      },
                      "filename": {
                        "description": "Original filename",
                        "type": "string"
                      },
                      "url": {
                        "description": "URL to download the file from",
                        "type": "string",
                        "format": "uri"
                      },
                      "data": {
                        "description": "Base64 encoded file data. Request body limit is 50 MB (about 37 MB of file); use url for larger files",
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "file"
                ],
                "description": "Send an image to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "file": {
                  "url": "https://your-server.example/assets/image.png",
                  "mimetype": "image/png",
                  "filename": "image.png"
                }
              }
            }
          },
          "description": "Send an image to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send an image with optional caption. Supply file.url for a downloadable image or file.data containing base64; replace example asset URLs with your own. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendFile": {
      "post": {
        "operationId": "sendFile",
        "summary": "Send file",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "caption": {
                    "description": "Optional caption for the media",
                    "type": "string"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  },
                  "mentions": {
                    "description": "Optional array of contact IDs to mention",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "file": {
                    "type": "object",
                    "properties": {
                      "mimetype": {
                        "description": "MIME type of the file (e.g., image/jpeg, application/pdf)",
                        "type": "string"
                      },
                      "filename": {
                        "description": "Original filename",
                        "type": "string"
                      },
                      "url": {
                        "description": "URL to download the file from",
                        "type": "string",
                        "format": "uri"
                      },
                      "data": {
                        "description": "Base64 encoded file data. Request body limit is 50 MB (about 37 MB of file); use url for larger files",
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "file"
                ],
                "description": "Send a file (document, PDF, etc.) to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "file": {
                  "url": "https://your-server.example/assets/receipt.pdf",
                  "mimetype": "application/pdf",
                  "filename": "receipt.pdf"
                }
              }
            }
          },
          "description": "Send a file (document, PDF, etc.) to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send a document or other file. Supply a downloadable file.url or base64 file.data, and include filename and mimetype where appropriate. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendVoice": {
      "post": {
        "operationId": "sendVoice",
        "summary": "Send voice message",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "file": {
                    "type": "object",
                    "properties": {
                      "mimetype": {
                        "description": "MIME type of the file (e.g., image/jpeg, application/pdf)",
                        "type": "string"
                      },
                      "filename": {
                        "description": "Original filename",
                        "type": "string"
                      },
                      "url": {
                        "description": "URL to download the file from",
                        "type": "string",
                        "format": "uri"
                      },
                      "data": {
                        "description": "Base64 encoded file data. Request body limit is 50 MB (about 37 MB of file); use url for larger files",
                        "type": "string"
                      }
                    }
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "file"
                ],
                "description": "Send a voice/audio message to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "file": {
                  "url": "https://your-server.example/assets/note.ogg",
                  "mimetype": "audio/ogg"
                }
              }
            }
          },
          "description": "Send a voice/audio message to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send a voice or audio file using a downloadable file.url or base64 file.data. Use a format supported by the messaging engine. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendVideo": {
      "post": {
        "operationId": "sendVideo",
        "summary": "Send video",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "caption": {
                    "description": "Optional caption for the media",
                    "type": "string"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  },
                  "mentions": {
                    "description": "Optional array of contact IDs to mention",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "file": {
                    "type": "object",
                    "properties": {
                      "mimetype": {
                        "description": "MIME type of the file (e.g., image/jpeg, application/pdf)",
                        "type": "string"
                      },
                      "filename": {
                        "description": "Original filename",
                        "type": "string"
                      },
                      "url": {
                        "description": "URL to download the file from",
                        "type": "string",
                        "format": "uri"
                      },
                      "data": {
                        "description": "Base64 encoded file data. Request body limit is 50 MB (about 37 MB of file); use url for larger files",
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "file"
                ],
                "description": "Send a video to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "file": {
                  "url": "https://your-server.example/assets/update.mp4",
                  "mimetype": "video/mp4"
                }
              }
            }
          },
          "description": "Send a video to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send a video with optional caption using a downloadable file.url or base64 file.data. Replace example asset URLs with your own. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendLocation": {
      "post": {
        "operationId": "sendLocation",
        "summary": "Send location",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "latitude": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90,
                    "description": "Latitude coordinate (-90 to 90)"
                  },
                  "longitude": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180,
                    "description": "Longitude coordinate (-180 to 180)"
                  },
                  "title": {
                    "description": "Optional location title/label",
                    "type": "string"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "latitude",
                  "longitude"
                ],
                "description": "Send a location/GPS coordinates to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "latitude": 19.076,
                "longitude": 72.8777
              }
            }
          },
          "description": "Send a location/GPS coordinates to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send latitude (−90 to 90 degrees) and longitude (−180 to 180 degrees), with an optional title. Put session and chatId in the body. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendContactVcard": {
      "post": {
        "operationId": "sendContactVcard",
        "summary": "Send contact vCard",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "contactsId": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Array of contact IDs to share (as vCard)"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "contactsId"
                ],
                "description": "Send contact information (vCard) to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "contactsId": [
                  "15557654321@c.us"
                ]
              }
            }
          },
          "description": "Send contact information (vCard) to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Share contact cards using contactsId, an array of WhatsApp contact IDs. Put session and destination chatId in the body. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendPoll": {
      "post": {
        "operationId": "sendPoll",
        "summary": "Send poll",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "poll": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "description": "Poll question"
                      },
                      "options": {
                        "minItems": 2,
                        "maxItems": 12,
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "Array of poll options (2-12)"
                      },
                      "multipleAnswers": {
                        "description": "Allow multiple answer selection",
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "name",
                      "options"
                    ],
                    "description": "Poll configuration with question and options"
                  },
                  "reply_to": {
                    "description": "Optional message ID to reply to",
                    "type": "string"
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "poll"
                ],
                "description": "Send a poll/survey to a contact, group, or channel"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "poll": {
                  "name": "Which delivery day works for you?",
                  "options": [
                    "Monday",
                    "Tuesday"
                  ],
                  "multipleAnswers": false
                }
              }
            }
          },
          "description": "Send a poll/survey to a contact, group, or channel"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Send a poll with a question and 2–12 text options. Set multipleAnswers to permit more than one answer. Put session and chatId in the body. Delivery is asynchronous; confirm with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/reply": {
      "post": {
        "operationId": "replyToMessage",
        "summary": "Reply to message",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Reply message text"
                  },
                  "reply_to": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Message ID to reply to (required)"
                  },
                  "mentions": {
                    "description": "Optional array of contact IDs to mention",
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "chatId",
                  "session",
                  "text",
                  "reply_to"
                ],
                "description": "Reply to a specific message in a chat"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me",
                "text": "Your order is ready for collection.",
                "reply_to": "true_15551234567@c.us_ABC123"
              }
            }
          },
          "description": "Reply to a specific message in a chat"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "Recipient resolution failed, or another upstream validation rejection. A lookup failure alone does not prove the number is unregistered. Check phone and session with GET /v1/contacts/check-exists; if registered, use its chatId. Do not automatically resend.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RECIPIENT_LOOKUP_FAILED",
                    "message": "Unable to resolve the recipient on WhatsApp. Verify the full international number before sending.",
                    "details": {
                      "upstreamStatus": 500,
                      "upstreamReason": "recipient_lookup",
                      "checkContactExists": {
                        "method": "GET",
                        "path": "/v1/contacts/check-exists",
                        "requiredQuery": [
                          "phone",
                          "session"
                        ]
                      }
                    }
                  },
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Reply to a specific message using its ID in reply_to. Obtain that ID from message history or an incoming webhook. Put session and destination chatId in the body. Confirm delivery with message.ack. Writes have no idempotency-key support; check delivery status after an uncertain outcome before retrying. A 422 RECIPIENT_LOOKUP_FAILED requires checking the recipient, not blindly resending.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sendSeen": {
      "post": {
        "operationId": "markMessageSeen",
        "summary": "Mark message as seen",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "messageId": {
                    "description": "Optional specific message ID to mark as seen",
                    "type": "string"
                  }
                },
                "required": [
                  "chatId",
                  "session"
                ],
                "description": "Mark message(s) as seen/read in a chat"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me"
              }
            }
          },
          "description": "Mark message(s) as seen/read in a chat"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Mark messages in chatId as read for your connected session. Optionally target a messageId obtained from history or a webhook. This changes the read state visible to the sender.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/startTyping": {
      "post": {
        "operationId": "startTyping",
        "summary": "Start typing indicator",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  }
                },
                "required": [
                  "chatId",
                  "session"
                ],
                "description": "Show typing indicator in a chat"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me"
              }
            }
          },
          "description": "Show typing indicator in a chat"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Show a typing indicator in chatId for your connected session. Call stopTyping when finished; this does not send a message.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/stopTyping": {
      "post": {
        "operationId": "stopTyping",
        "summary": "Stop typing indicator",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chatId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix."
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  }
                },
                "required": [
                  "chatId",
                  "session"
                ],
                "description": "Stop showing typing indicator in a chat"
              },
              "example": {
                "chatId": "15551234567",
                "session": "me"
              }
            }
          },
          "description": "Stop showing typing indicator in a chat"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Stop the typing indicator in chatId for your connected session. This does not send a message.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/reaction": {
      "put": {
        "operationId": "setReaction",
        "summary": "Set message reaction",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Message ID to add reaction to"
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "reaction": {
                    "type": "string",
                    "maxLength": 10,
                    "description": "Emoji reaction (e.g., \"😂\", \"❤️\")"
                  }
                },
                "required": [
                  "messageId",
                  "session",
                  "reaction"
                ],
                "description": "Add emoji reaction to a message"
              },
              "example": {
                "messageId": "true_15551234567@c.us_ABC123",
                "session": "me",
                "reaction": "👍"
              }
            }
          },
          "description": "Add emoji reaction to a message"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "React to an existing message using messageId from history or a webhook. reaction is the emoji to apply; an empty string removes the reaction.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/star": {
      "put": {
        "operationId": "starMessage",
        "summary": "Star or unstar message",
        "tags": [
          "Messages"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messageId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Message ID to star/unstar"
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  },
                  "star": {
                    "type": "boolean",
                    "description": "true to star the message, false to unstar"
                  }
                },
                "required": [
                  "messageId",
                  "session",
                  "star"
                ],
                "description": "Star or unstar a message"
              },
              "example": {
                "messageId": "true_15551234567@c.us_ABC123",
                "session": "me",
                "star": true
              }
            }
          },
          "description": "Star or unstar a message"
        },
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Set star=true to star a message or star=false to remove its star. Use messageId from history or a webhook and your connected session name.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/messages": {
      "get": {
        "operationId": "getMessages",
        "summary": "Get messages",
        "tags": [
          "Messages"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "chatId",
            "required": true,
            "description": "Phone number (e.g., \"1234567890\" or \"+1234567890\"), group ID (e.g., \"120363...@g.us\"), or channel ID (e.g., \"120363...@s.whatsapp.net\"). Phone numbers will be automatically formatted with @c.us suffix.",
            "example": "15551234567"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Number of messages to retrieve (default: 100, max: 1000)",
            "example": 20
          },
          {
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "false"
                  ]
                },
                {
                  "type": "boolean"
                }
              ]
            },
            "in": "query",
            "name": "downloadMedia",
            "required": false,
            "description": "Download media files with messages (default: false)"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read message history for chatId and session. limit defaults to 100 and accepts 1–1000. downloadMedia is optional. This endpoint has no documented offset or cursor parameter. Engine response fields vary.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/presence": {
      "post": {
        "operationId": "setPresence",
        "summary": "Set presence",
        "tags": [
          "Presence"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "presence": {
                    "type": "string",
                    "enum": [
                      "online",
                      "offline",
                      "typing",
                      "recording",
                      "paused"
                    ],
                    "description": "Presence status: online, offline, typing, recording, or paused"
                  },
                  "session": {
                    "type": "string",
                    "minLength": 1,
                    "description": "WhatsApp session name"
                  }
                },
                "required": [
                  "presence",
                  "session"
                ],
                "description": "Set presence/status in a chat"
              },
              "example": {
                "presence": "online",
                "session": "me"
              }
            }
          },
          "description": "Set presence/status in a chat"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Set global online or offline presence. The body session is required in addition to the path session; use the same name in both. Although the enum also lists typing, recording and paused, those states need a chatId that this request schema does not accept. Use startTyping and stopTyping for typing indicators.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "get": {
        "operationId": "getAllPresence",
        "summary": "Get all chats presence",
        "tags": [
          "Presence"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read cached presence information for your session. Subscribe to a contact first when you need updates; this response depends on presence events received by the messaging engine.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/presence/{chatId}": {
      "get": {
        "operationId": "getChatPresence",
        "summary": "Get chat presence",
        "tags": [
          "Presence"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\+?(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$"
            },
            "in": "path",
            "name": "chatId",
            "required": true,
            "description": "Chat ID in format: 1234567890@c.us or +1234567890@c.us",
            "example": "15551234567@c.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read presence information for chatId within your session. Obtain chatId from a contact check, message or webhook; subscribe to presence updates when needed.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/presence/{chatId}/subscribe": {
      "post": {
        "operationId": "subscribeChatPresence",
        "summary": "Subscribe to chat presence",
        "tags": [
          "Presence"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name (1-100 characters). With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^\\+?(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$"
            },
            "in": "path",
            "name": "chatId",
            "required": true,
            "description": "Chat ID in format: 1234567890@c.us or +1234567890@c.us",
            "example": "15551234567@c.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Subscribe your session to presence updates for chatId. Read current presence with the presence endpoints or receive presence.update webhook events.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups": {
      "post": {
        "operationId": "createGroup",
        "summary": "Create group",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Group name/subject (1-100 characters)"
                  },
                  "participants": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$",
                          "description": "Contact ID in format: 1234567890@c.us"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "description": "Array of participant contact IDs to add to the group (minimum 1)"
                  },
                  "description": {
                    "description": "Optional group description (max 500 characters)",
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "name",
                  "participants"
                ],
                "description": "Create a new WhatsApp group with name and initial participants"
              },
              "example": {
                "name": "Order updates",
                "participants": [
                  {
                    "id": "15551234567@c.us"
                  }
                ]
              }
            }
          },
          "description": "Create a new WhatsApp group with name and initial participants"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Create a WhatsApp group with a name and at least one participant. participants must be objects with an id, such as {\"id\":\"15551234567@c.us\"}. Use the returned group identifier for later group calls. Space out membership changes.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "get": {
        "operationId": "listGroups",
        "summary": "List groups (paginated, excludes participants)",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "default": 10,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Maximum number of groups to return (default: 10, max: 100)",
            "example": 20
          },
          {
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "in": "query",
            "name": "offset",
            "required": false,
            "description": "Number of groups to skip from the start (default: 0)",
            "example": 0
          },
          {
            "schema": {
              "default": "subject",
              "type": "string",
              "enum": [
                "id",
                "subject"
              ]
            },
            "in": "query",
            "name": "sortBy",
            "required": false,
            "description": "Field to sort by: id or subject (default: subject)"
          },
          {
            "schema": {
              "default": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "in": "query",
            "name": "sortOrder",
            "required": false,
            "description": "Sort order: asc (ascending) or desc (descending) (default: asc)"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "List groups visible to your connected session. Use a returned group ID, ending in @g.us, in groupId parameters. Results and fields depend on the messaging engine.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/count": {
      "get": {
        "operationId": "getGroupsCount",
        "summary": "Get groups count",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Count groups visible to your connected session. The response data is returned by the messaging engine.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/join": {
      "post": {
        "operationId": "joinGroup",
        "summary": "Join group",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Group invite code or full invite URL. Accepted formats:\n• Invite code only: \"invitecode\" (from https://chat.whatsapp.com/invitecode)\n• Full URL: \"https://chat.whatsapp.com/invitecode\"\nReturns: { \"id\": \"123123123@g.us\" }"
                  }
                },
                "required": [
                  "code"
                ]
              },
              "example": {
                "code": "AbCdEfGhIjKlMnOpQrStUv"
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Join a WhatsApp group using the code from its invite link. This changes group membership; avoid automatically repeating a request with an uncertain outcome.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/refresh": {
      "post": {
        "operationId": "refreshGroups",
        "summary": "Refresh groups",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Refresh the messaging engine’s group information for your session. Read the group list again after the refresh.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}": {
      "get": {
        "operationId": "getGroup",
        "summary": "Get group",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read a group using a groupId from listGroups or a group webhook. Your linked account must be able to access the group.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteGroup",
        "summary": "Delete group",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Request deletion of the group identified by groupId. WhatsApp permissions and engine support determine whether it succeeds. This is a destructive operation; check the resulting state before repeating it.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/leave": {
      "post": {
        "operationId": "leaveGroup",
        "summary": "Leave group",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Leave the group identified by groupId using your linked WhatsApp account. This changes membership; confirm state before repeating a request with an uncertain outcome.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/subject": {
      "put": {
        "operationId": "setGroupSubject",
        "summary": "Set group subject",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "New group name/subject (1-100 characters)"
                  }
                },
                "required": [
                  "subject"
                ],
                "description": "Update group title/subject"
              },
              "example": {
                "subject": "Project updates"
              }
            }
          },
          "description": "Update group title/subject"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Change the group title to subject (1–100 characters). Your linked account needs the WhatsApp permissions required by the group settings.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/description": {
      "put": {
        "operationId": "setGroupDescription",
        "summary": "Set group description",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "New group description (max 500 characters)"
                  }
                },
                "required": [
                  "description"
                ],
                "description": "Update group description"
              },
              "example": {
                "description": "Updates for the project team."
              }
            }
          },
          "description": "Update group description"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Change the group description (at most 500 characters). Your linked account needs the WhatsApp permissions required by the group settings.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/settings/security/info-admin-only": {
      "put": {
        "operationId": "setInfoAdminOnly",
        "summary": "Set info admin-only",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "adminsOnly": {
                    "type": "boolean",
                    "description": "Set to true to restrict group info edits to admins only"
                  }
                },
                "required": [
                  "adminsOnly"
                ],
                "description": "Update group info admin-only setting"
              },
              "example": {
                "adminsOnly": true
              }
            }
          },
          "description": "Update group info admin-only setting"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Set adminsOnly=true to restrict group-info edits to administrators, or false to allow participants. Your linked account must have administrator permission.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "get": {
        "operationId": "getInfoAdminOnly",
        "summary": "Get info admin-only setting",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read whether only administrators can edit group information. Use the same groupId returned by group listing or creation.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/settings/security/messages-admin-only": {
      "put": {
        "operationId": "setMessagesAdminOnly",
        "summary": "Set messages admin-only",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "adminsOnly": {
                    "type": "boolean",
                    "description": "Set to true to restrict message sending to admins only"
                  }
                },
                "required": [
                  "adminsOnly"
                ],
                "description": "Update group messages admin-only setting"
              },
              "example": {
                "adminsOnly": true
              }
            }
          },
          "description": "Update group messages admin-only setting"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Set adminsOnly=true to restrict posting to administrators, or false to allow participants. Your linked account must have administrator permission.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "get": {
        "operationId": "getMessagesAdminOnly",
        "summary": "Get messages admin-only setting",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read whether only administrators can send messages to this group. Your linked account must be able to access the group.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/participants": {
      "get": {
        "operationId": "getGroupParticipants",
        "summary": "Get participants",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "List group participants. Use returned contact IDs for membership and administrator operations; check whether a participant is already present before adding them.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/participants/add": {
      "post": {
        "operationId": "addGroupParticipants",
        "summary": "Add participants",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "participants": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$",
                          "description": "Contact ID in format: 1234567890@c.us"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "description": "Array of contact IDs to add to the group"
                  }
                },
                "required": [
                  "participants"
                ],
                "description": "Add participants to an existing group"
              },
              "example": {
                "participants": [
                  {
                    "id": "15551234567@c.us"
                  }
                ]
              }
            }
          },
          "description": "Add participants to an existing group"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Add participants using objects with an id, not plain strings. Verify phone numbers with checkContactExists first. Space out additions and avoid re-adding current participants; WhatsApp can restrict excessive changes.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/participants/remove": {
      "post": {
        "operationId": "removeGroupParticipants",
        "summary": "Remove participants",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "participants": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$",
                          "description": "Contact ID in format: 1234567890@c.us"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "description": "Array of contact IDs to remove from the group"
                  }
                },
                "required": [
                  "participants"
                ],
                "description": "Remove participants from the group"
              },
              "example": {
                "participants": [
                  {
                    "id": "15551234567@c.us"
                  }
                ]
              }
            }
          },
          "description": "Remove participants from the group"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Remove participants using objects with an id from the group participant list. Your linked account needs administrator permission. This changes group membership.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/admin/promote": {
      "post": {
        "operationId": "promoteToAdmin",
        "summary": "Promote to admin",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "participants": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$",
                          "description": "Contact ID in format: 1234567890@c.us"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "description": "Array of contact IDs to promote to admin"
                  }
                },
                "required": [
                  "participants"
                ],
                "description": "Promote participants to group admin"
              },
              "example": {
                "participants": [
                  {
                    "id": "15551234567@c.us"
                  }
                ]
              }
            }
          },
          "description": "Promote participants to group admin"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Promote existing group participants to administrators using their contact IDs. Your linked account must have permission to manage administrators.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/admin/demote": {
      "post": {
        "operationId": "demoteFromAdmin",
        "summary": "Demote from admin",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "participants": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^(\\d+@[csg]\\.us|\\d+@s\\.whatsapp\\.net)$",
                          "description": "Contact ID in format: 1234567890@c.us"
                        }
                      },
                      "required": [
                        "id"
                      ]
                    },
                    "description": "Array of contact IDs to demote from admin"
                  }
                },
                "required": [
                  "participants"
                ],
                "description": "Demote group admins to regular participants"
              },
              "example": {
                "participants": [
                  {
                    "id": "15551234567@c.us"
                  }
                ]
              }
            }
          },
          "description": "Demote group admins to regular participants"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Remove administrator privileges from existing participants using their contact IDs. Your linked account must have permission to manage administrators.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/invite-code": {
      "get": {
        "operationId": "getGroupInviteCode",
        "summary": "Get invite code",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read the group invite code. Your linked account must have permission to access it. Treat invite codes as sensitive: anyone with a valid invitation may be able to join.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/invite-code/revoke": {
      "post": {
        "operationId": "revokeGroupInviteCode",
        "summary": "Revoke invite code",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Revoke the current group invitation and request a replacement. Previously shared invite links can stop working. Your linked account needs administrator permission.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/groups/{groupId}/picture": {
      "get": {
        "operationId": "getGroupPicture",
        "summary": "Get group picture",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read the group picture information available to your linked account. The response format depends on the messaging engine.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "setGroupPicture",
        "summary": "Set group picture",
        "tags": [
          "Groups"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "Direct URL to the image file"
                      },
                      "mimetype": {
                        "type": "string",
                        "enum": [
                          "image/jpeg",
                          "image/png",
                          "image/gif",
                          "image/webp"
                        ],
                        "description": "Image MIME type. Accepted values: image/jpeg, image/png, image/gif, image/webp"
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "description": "Image file object with URL and optional MIME type"
                  }
                },
                "required": [
                  "file"
                ]
              },
              "example": {
                "file": {
                  "url": "https://your-server.example/assets/image.png",
                  "mimetype": "image/png",
                  "filename": "image.png"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Replace the group picture using file.url or base64 file.data. Your linked account needs permission and the messaging engine must support this operation.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteGroupPicture",
        "summary": "Delete group picture",
        "tags": [
          "Groups"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "groupId",
            "required": true,
            "description": "Group ID in format: 120363...@g.us",
            "example": "120363024802736123@g.us"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Remove the group picture. Your linked account needs permission and the messaging engine must support this operation.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/channels": {
      "get": {
        "operationId": "listChannels",
        "summary": "List channels",
        "tags": [
          "Channels"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "List channels visible to your session, optionally filtered by role. Use the returned channel ID unchanged for channel-specific calls.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "post": {
        "operationId": "createChannel",
        "summary": "Create channel",
        "tags": [
          "Channels"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "description": "Channel name (1-255 characters)"
                  },
                  "description": {
                    "description": "Optional channel description (max 1000 characters)",
                    "type": "string",
                    "maxLength": 1000
                  },
                  "picture": {
                    "description": "Optional channel profile picture",
                    "type": "object",
                    "properties": {
                      "mimetype": {
                        "type": "string",
                        "description": "MIME type of the image"
                      },
                      "filename": {
                        "type": "string",
                        "description": "Filename of the image"
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "URL to the channel picture"
                      }
                    },
                    "required": [
                      "mimetype",
                      "filename",
                      "url"
                    ]
                  }
                },
                "required": [
                  "name"
                ],
                "description": "Create a new WhatsApp channel"
              },
              "example": {
                "name": "Order updates"
              }
            }
          },
          "description": "Create a new WhatsApp channel"
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Create a WhatsApp channel with a name and optional description or picture. This changes the linked account’s channels; use the returned channel identifier for later calls.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/channels/{channelId}": {
      "get": {
        "operationId": "getChannel",
        "summary": "Get channel",
        "tags": [
          "Channels"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "channelId",
            "required": true,
            "description": "Channel ID",
            "example": "120363024802736123@newsletter"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read channel information using a channelId returned by channel listing or creation. Access depends on the linked account and WhatsApp permissions.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteChannel",
        "summary": "Delete channel",
        "tags": [
          "Channels"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "channelId",
            "required": true,
            "description": "Channel ID",
            "example": "120363024802736123@newsletter"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Delete the channel identified by channelId. Your linked account must have the required WhatsApp permissions. This is destructive; verify state before retrying an uncertain result.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/sessions/{session}/channels/{channelId}/messages/preview": {
      "get": {
        "operationId": "getChannelPreviewMessages",
        "summary": "Get channel preview messages",
        "tags": [
          "Channels"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "downloadMedia",
            "required": false,
            "description": "Download media with messages (true/false)"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Number of messages to preview",
            "example": "20"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "path",
            "name": "channelId",
            "required": true,
            "description": "Channel ID",
            "example": "120363024802736123@newsletter"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Successful operation. The messaging engine may return 200 or 201. The stable envelope is documented; engine data varies. This example illustrates the envelope, not a fixed engine payload. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                },
                "example": {
                  "success": true,
                  "data": {},
                  "timestamp": "2026-11-02T00:00:00.000Z"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "description": "Read preview messages for a channel. Optional limit and downloadMedia query parameters are passed to the messaging engine; their engine-specific limits are not enforced by this proxy.",
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/v1/contacts/check-exists": {
      "get": {
        "operationId": "checkContactExists",
        "summary": "Check if phone number exists on WhatsApp",
        "tags": [
          "Contacts"
        ],
        "description": "Check a phone number of 10–15 digits, including country code and without +, using your session. Unlike most endpoints, success is the unwrapped engine object: numberExists and, when available, chatId. Use the returned chatId unchanged. A lookup error does not prove the number is unregistered.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "pattern": "^\\d{10,15}$"
            },
            "in": "query",
            "name": "phone",
            "required": true,
            "description": "Phone number (10-15 digits)",
            "example": "15551234567"
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "in": "query",
            "name": "session",
            "required": true,
            "description": "WhatsApp session name. With a session token (ch_live_...), `me` targets that token's session; with an account key, use the session name.",
            "example": "me"
          }
        ],
        "responses": {
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "502": {
            "$ref": "#/components/responses/UpstreamError"
          },
          "2XX": {
            "description": "Unwrapped messaging-engine result; this success response has no success/data envelope. Use chatId unchanged when provided. Rarely 204 with no body.",
            "headers": {
              "X-Request-Id": {
                "description": "Request identifier generated by this API. Include it with the timestamp when contacting support. Gateway-rejected requests may not reach the API.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "numberExists": {
                      "type": "boolean"
                    },
                    "chatId": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "numberExists": true,
                  "chatId": "15551234567@c.us"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/OtherUpstreamError"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://wp-rapidapi.retentionstack.agency",
      "description": "Direct Cloud API production server. Authenticate with Authorization: Bearer ch_live_... or ak_live_..."
    }
  ],
  "tags": [
    {
      "name": "Sessions",
      "description": "Manage WhatsApp sessions"
    },
    {
      "name": "Auth",
      "description": "Session authentication (QR, pairing code, captcha)"
    },
    {
      "name": "Messages",
      "description": "Send and receive messages"
    },
    {
      "name": "Presence",
      "description": "Online presence and typing indicators"
    },
    {
      "name": "Groups",
      "description": "Create and manage WhatsApp groups"
    },
    {
      "name": "Channels",
      "description": "WhatsApp Channels (newsletters)"
    },
    {
      "name": "Contacts",
      "description": "Check recipient registration and contact identifiers"
    },
    {
      "name": "system",
      "description": "Health and diagnostics"
    }
  ],
  "externalDocs": {
    "description": "Quickstart, errors, limits and integration guides",
    "url": "https://whatsapp-messaging.retentionstack.agency/docs"
  }
}
