{
    "openapi": "3.1.0",
    "info": {
        "title": "Jawib Public API v1",
        "version": "2.7.0",
        "description": "Jawib REST API for WhatsApp connections, customer isolation, messaging, conversations, receipts, webhooks, and supported legacy analytics resources."
    },
    "servers": [
        {
            "url": "https://playjawib.com/api",
            "description": "Production"
        }
    ],
    "paths": {
        "/v1/messages": {
            "post": {
                "operationId": "v1.messages.store",
                "tags": [
                    "PublicApi"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "connection_id": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 64
                                    },
                                    "to": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z0-9@._:-]+$",
                                        "maxLength": 160
                                    },
                                    "text": {
                                        "type": "string",
                                        "maxLength": 4000
                                    }
                                },
                                "required": [
                                    "to",
                                    "text"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "connection_id": {
                                                    "type": "string"
                                                },
                                                "sent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "delivered_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "read_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "status",
                                                "connection_id",
                                                "sent_at",
                                                "delivered_at",
                                                "read_at",
                                                "created_at"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "An error\n\nAn error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "description": "Error overview.",
                                                    "examples": [
                                                        "Use /api/v2/messages for inbox-enabled connections."
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "message"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "message": {
                                                    "type": "string",
                                                    "description": "Error overview.",
                                                    "examples": [
                                                        "The connection is not ready to send."
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "message"
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "An error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "description": "Error overview.",
                                            "examples": [
                                                "Sending allowance exceeded for this connection."
                                            ]
                                        }
                                    },
                                    "required": [
                                        "message"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationException"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique 8–128-character operation key. Retrying the same request returns the recorded result without executing a second send.",
                        "schema": {
                            "type": "string",
                            "minLength": 8,
                            "maxLength": 128,
                            "pattern": "^[A-Za-z0-9._:-]+$"
                        }
                    }
                ]
            }
        },
        "/v1/messages/{message}": {
            "get": {
                "operationId": "v1.messages.show",
                "tags": [
                    "PublicApi"
                ],
                "parameters": [
                    {
                        "name": "message",
                        "in": "path",
                        "required": true,
                        "description": "The message ID",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "connection_id": {
                                                    "type": "string"
                                                },
                                                "sent_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "delivered_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "read_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "status",
                                                "connection_id",
                                                "sent_at",
                                                "delivered_at",
                                                "read_at",
                                                "created_at"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/ModelNotFoundException"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v1/summaries": {
            "get": {
                "operationId": "v1.summaries.index",
                "tags": [
                    "PublicApi"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "group": {
                                                        "type": [
                                                            "object",
                                                            "null"
                                                        ],
                                                        "properties": {
                                                            "id": {
                                                                "type": "integer"
                                                            },
                                                            "name": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ]
                                                            }
                                                        },
                                                        "required": [
                                                            "id",
                                                            "name"
                                                        ]
                                                    },
                                                    "mode": {
                                                        "type": "string"
                                                    },
                                                    "completed_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "result": {
                                                        "type": "array",
                                                        "items": []
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "group",
                                                    "mode",
                                                    "completed_at",
                                                    "result"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v1/analytics": {
            "get": {
                "operationId": "v1.analytics.index",
                "tags": [
                    "PublicApi"
                ],
                "parameters": [
                    {
                        "name": "days",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 30
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "summary": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "anyOf": [
                                                            {
                                                                "type": "string"
                                                            },
                                                            {
                                                                "type": "integer"
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "replies": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            }
                                                                        ]
                                                                    },
                                                                    "messages_with_mentions": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            }
                                                                        ]
                                                                    },
                                                                    "reactions": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            }
                                                                        ]
                                                                    }
                                                                },
                                                                "required": [
                                                                    "replies",
                                                                    "messages_with_mentions",
                                                                    "reactions"
                                                                ]
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "text": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    },
                                                                    "media": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    },
                                                                    "poll": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    }
                                                                },
                                                                "required": [
                                                                    "text",
                                                                    "media",
                                                                    "poll"
                                                                ]
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "joins": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "text": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "media": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "poll": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "text",
                                                                                    "media",
                                                                                    "poll"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    },
                                                                    "leaves": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "text": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "media": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "poll": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "text",
                                                                                    "media",
                                                                                    "poll"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    },
                                                                    "promotions": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "text": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "media": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "poll": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "text",
                                                                                    "media",
                                                                                    "poll"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    },
                                                                    "demotions": {
                                                                        "anyOf": [
                                                                            {
                                                                                "type": "string"
                                                                            },
                                                                            {
                                                                                "type": "integer"
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "replies": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "messages_with_mentions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "reactions": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "replies",
                                                                                    "messages_with_mentions",
                                                                                    "reactions"
                                                                                ]
                                                                            },
                                                                            {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "text": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "media": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    },
                                                                                    "poll": {
                                                                                        "anyOf": [
                                                                                            {
                                                                                                "type": "string"
                                                                                            },
                                                                                            {
                                                                                                "type": "integer"
                                                                                            },
                                                                                            {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "replies": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "messages_with_mentions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    },
                                                                                                    "reactions": {
                                                                                                        "anyOf": [
                                                                                                            {
                                                                                                                "type": "string"
                                                                                                            },
                                                                                                            {
                                                                                                                "type": "integer"
                                                                                                            }
                                                                                                        ]
                                                                                                    }
                                                                                                },
                                                                                                "required": [
                                                                                                    "replies",
                                                                                                    "messages_with_mentions",
                                                                                                    "reactions"
                                                                                                ]
                                                                                            }
                                                                                        ]
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "text",
                                                                                    "media",
                                                                                    "poll"
                                                                                ]
                                                                            }
                                                                        ]
                                                                    },
                                                                    "net_members": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "joins",
                                                                    "leaves",
                                                                    "promotions",
                                                                    "demotions",
                                                                    "net_members"
                                                                ]
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "label": {
                                                                        "type": "string",
                                                                        "enum": [
                                                                            "high",
                                                                            "medium",
                                                                            "low"
                                                                        ]
                                                                    },
                                                                    "events": {
                                                                        "type": "integer"
                                                                    },
                                                                    "observed_days": {
                                                                        "type": "integer",
                                                                        "minimum": 0
                                                                    }
                                                                },
                                                                "required": [
                                                                    "label",
                                                                    "events",
                                                                    "observed_days"
                                                                ]
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "current_messages": {
                                                                        "type": "integer"
                                                                    },
                                                                    "previous_messages": {
                                                                        "type": "integer"
                                                                    },
                                                                    "percent_change": {
                                                                        "type": [
                                                                            "integer",
                                                                            "null"
                                                                        ]
                                                                    },
                                                                    "sufficient_data": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "current_messages",
                                                                    "previous_messages",
                                                                    "percent_change",
                                                                    "sufficient_data"
                                                                ]
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "date": {
                                                                        "type": "string"
                                                                    },
                                                                    "messages": {
                                                                        "type": "integer"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "date",
                                                                    "messages"
                                                                ]
                                                            },
                                                            {
                                                                "type": "null"
                                                            },
                                                            {
                                                                "type": "object",
                                                                "properties": {
                                                                    "hour": {
                                                                        "type": "integer"
                                                                    },
                                                                    "messages": {
                                                                        "type": "integer"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "hour",
                                                                    "messages"
                                                                ]
                                                            }
                                                        ]
                                                    }
                                                },
                                                "groups": {
                                                    "type": "string"
                                                },
                                                "daily": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "summary",
                                                "groups",
                                                "daily"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v1/campaigns": {
            "get": {
                "operationId": "v1.campaigns.index",
                "tags": [
                    "PublicApi"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string"
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "targets_count": {
                                                        "type": "string"
                                                    },
                                                    "deliveries_count": {
                                                        "type": "string"
                                                    },
                                                    "starts_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "completed_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "status",
                                                    "kind",
                                                    "targets_count",
                                                    "deliveries_count",
                                                    "starts_at",
                                                    "completed_at"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/groups/{group}/messages": {
            "post": {
                "summary": "Send a group message",
                "description": "Required scope: messages:write + groups:write. See docs/group-messaging-api.md for opt-in and retention semantics. Also requires messages:write. Destination and connection come from the owned group. OTP is forbidden. Images up to 5 MiB; other media up to 10 MiB. Audio has no caption; codecs are not transcoded.",
                "parameters": [
                    {
                        "name": "group",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique 8–128-character operation key. Retrying the same request returns the recorded result without executing a second send.",
                        "schema": {
                            "type": "string",
                            "minLength": 8,
                            "maxLength": 128,
                            "pattern": "^[A-Za-z0-9._:-]+$"
                        }
                    }
                ],
                "responses": {
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "Send accepted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/PublicMessage"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Gateway send failed."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "type"
                                ],
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "text",
                                            "image",
                                            "audio",
                                            "video",
                                            "document",
                                            "reaction"
                                        ]
                                    },
                                    "text": {
                                        "type": "string",
                                        "maxLength": 65536
                                    },
                                    "caption": {
                                        "type": "string",
                                        "maxLength": 1024
                                    },
                                    "media_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "pattern": "^https://"
                                    },
                                    "media": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "filename": {
                                        "type": "string",
                                        "maxLength": 180
                                    },
                                    "voice_note": {
                                        "type": "boolean",
                                        "default": false,
                                        "description": "Only for audio. true sends PTT and requires a valid mono OGG/Opus stream. No transcoding. Incoming content resources/webhooks also expose voice_note."
                                    }
                                }
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "type",
                                    "media"
                                ],
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "text",
                                            "image",
                                            "audio",
                                            "video",
                                            "document",
                                            "reaction"
                                        ]
                                    },
                                    "text": {
                                        "type": "string",
                                        "maxLength": 65536
                                    },
                                    "caption": {
                                        "type": "string",
                                        "maxLength": 1024
                                    },
                                    "media_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "pattern": "^https://"
                                    },
                                    "media": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "filename": {
                                        "type": "string",
                                        "maxLength": 180
                                    },
                                    "voice_note": {
                                        "type": "boolean",
                                        "default": false,
                                        "description": "Only for audio. true sends PTT and requires a valid mono OGG/Opus stream. No transcoding. Incoming content resources/webhooks also expose voice_note."
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "get": {
                "summary": "List group messages",
                "description": "Required scope: groups:messages:read. See docs/group-messaging-api.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "group",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "after_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/groups/{group}/messages/{groupMessage}/media": {
            "get": {
                "summary": "Download group-message media",
                "description": "Required scope: groups:media:read. See docs/group-messaging-api.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "group",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "groupMessage",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/groups/{group}/sent-messages/{message}/receipts": {
            "get": {
                "summary": "List observed participant receipts",
                "description": "Required scope: groups:receipts:read. See docs/group-messaging-api.md for opt-in and retention semantics. message is the UUID returned by sending. Observed participants only; meta.complete is always false. Missing receipts do not establish unread status. Cursor after_id pages recipient rows; use signed receipt webhooks for updates to earlier rows.",
                "parameters": [
                    {
                        "name": "group",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "message",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "after_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/connections": {
            "post": {
                "summary": "Create a WhatsApp connection",
                "description": "Required scope: connections:pair. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique 8–128-character operation key. Retrying the same request returns the recorded result without executing a second send.",
                        "schema": {
                            "type": "string",
                            "minLength": 8,
                            "maxLength": 128,
                            "pattern": "^[A-Za-z0-9._:-]+$"
                        }
                    }
                ],
                "responses": {
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "202": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "privacy_accepted"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "method": {
                                        "type": "string",
                                        "enum": [
                                            "qr",
                                            "code"
                                        ],
                                        "default": "qr"
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "Required for code pairing, international phone number."
                                    },
                                    "privacy_accepted": {
                                        "type": "boolean",
                                        "const": true
                                    },
                                    "inbox_enabled": {
                                        "type": "boolean",
                                        "default": true
                                    },
                                    "group_inbox_enabled": {
                                        "type": "boolean",
                                        "default": false
                                    },
                                    "return_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "pattern": "^https://"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "get": {
                "summary": "List connections",
                "description": "Required scope: connections:read. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "after_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/connections/{connection}": {
            "get": {
                "summary": "Retrieve a connection",
                "description": "Required scope: connections:read. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "connection",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "delete": {
                "summary": "Disconnect WhatsApp",
                "description": "Required scope: connections:write. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "connection",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "patch": {
                "summary": "Update inbox settings",
                "description": "Required scope: connections:write. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "connection",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "minProperties": 1,
                                "properties": {
                                    "inbox_enabled": {
                                        "type": "boolean"
                                    },
                                    "group_inbox_enabled": {
                                        "type": "boolean"
                                    },
                                    "inbox_reply_mode": {
                                        "type": "string",
                                        "enum": [
                                            "internal",
                                            "external",
                                            "human"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/connections/{connection}/pairing": {
            "get": {
                "summary": "Retrieve QR, phone code, and hosted pairing URL",
                "description": "Required scope: connections:pair. See docs/private-inbox.md for opt-in and retention semantics. Returns QR/code only for an active attempt; credentials expire after 3 minutes. Responses use Cache-Control: no-store. See docs/whatsapp-infrastructure.md.",
                "parameters": [
                    {
                        "name": "connection",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The phone belongs to another workspace or the attempt was superseded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Gateway temporarily unavailable."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/conversations": {
            "get": {
                "summary": "List private conversations",
                "description": "Required scope: conversations:read. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "after_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    },
                    {
                        "name": "connection_id",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/conversations/{conversation}/messages": {
            "get": {
                "summary": "List retained conversation messages",
                "description": "Required scope: conversations:read. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "conversation",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "after_id",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 50
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/conversations/{conversation}": {
            "patch": {
                "summary": "Update conversation reply mode",
                "description": "Required scope: conversations:write. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "conversation",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "reply_mode"
                                ],
                                "properties": {
                                    "reply_mode": {
                                        "type": "string",
                                        "enum": [
                                            "internal",
                                            "external",
                                            "human"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/conversations/{conversation}/messages/{privateMessage}/media": {
            "get": {
                "summary": "Download conversation media",
                "description": "Required scope: media:read. See docs/private-inbox.md for opt-in and retention semantics.",
                "parameters": [
                    {
                        "name": "conversation",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "privateMessage",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource not found or inbox capture is disabled."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid request fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/messages": {
            "post": {
                "summary": "Send text, image, audio, video, document, reaction, or OTP",
                "description": "Requires messages:write; OTP also accepts a key with messages:write:otp only. OTP codes are not retained. Regular message content is retained encrypted for a limited period only when inbox capture is enabled. Upload media directly or provide a public HTTPS URL. Images: up to 5 MiB. Other media: up to 10 MiB. Audio has no caption and is not transcoded. Group sending also requires groups:write and does not support OTP.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "connection_id",
                                    "to",
                                    "type"
                                ],
                                "properties": {
                                    "connection_id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "to": {
                                        "type": "string",
                                        "description": "International phone, private JID, or owned group JID (requires groups:write).",
                                        "example": "+249900000000"
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "text",
                                            "image",
                                            "audio",
                                            "video",
                                            "document",
                                            "reaction",
                                            "otp"
                                        ]
                                    },
                                    "text": {
                                        "type": "string",
                                        "maxLength": 65536
                                    },
                                    "caption": {
                                        "type": "string",
                                        "maxLength": 1024
                                    },
                                    "media_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "pattern": "^https://"
                                    },
                                    "media": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "filename": {
                                        "type": "string",
                                        "maxLength": 180
                                    },
                                    "otp_code": {
                                        "type": "string",
                                        "pattern": "^\\d{4,8}$",
                                        "writeOnly": true
                                    },
                                    "voice_note": {
                                        "type": "boolean",
                                        "default": false,
                                        "description": "Only for audio. true sends PTT and requires a valid mono OGG/Opus stream. No transcoding. Incoming content resources/webhooks also expose voice_note."
                                    },
                                    "sender_type": {
                                        "type": "string",
                                        "enum": [
                                            "automation",
                                            "human"
                                        ],
                                        "default": "automation",
                                        "description": "human requires conversations:write; automation requires external reply mode for inbox-enabled connections."
                                    },
                                    "otp_ttl_seconds": {
                                        "type": "integer",
                                        "minimum": 60,
                                        "maximum": 900
                                    }
                                }
                            }
                        },
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "connection_id",
                                    "to",
                                    "type",
                                    "media"
                                ],
                                "properties": {
                                    "connection_id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "to": {
                                        "type": "string",
                                        "description": "International phone, private JID, or owned group JID (requires groups:write).",
                                        "example": "+249900000000"
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "text",
                                            "image",
                                            "audio",
                                            "video",
                                            "document",
                                            "reaction",
                                            "otp"
                                        ]
                                    },
                                    "text": {
                                        "type": "string",
                                        "maxLength": 65536
                                    },
                                    "caption": {
                                        "type": "string",
                                        "maxLength": 1024
                                    },
                                    "media_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "pattern": "^https://"
                                    },
                                    "media": {
                                        "type": "string",
                                        "format": "binary"
                                    },
                                    "filename": {
                                        "type": "string",
                                        "maxLength": 180
                                    },
                                    "otp_code": {
                                        "type": "string",
                                        "pattern": "^\\d{4,8}$",
                                        "writeOnly": true
                                    },
                                    "voice_note": {
                                        "type": "boolean",
                                        "default": false,
                                        "description": "Only for audio. true sends PTT and requires a valid mono OGG/Opus stream. No transcoding. Incoming content resources/webhooks also expose voice_note."
                                    },
                                    "sender_type": {
                                        "type": "string",
                                        "enum": [
                                            "automation",
                                            "human"
                                        ],
                                        "default": "automation",
                                        "description": "human requires conversations:write; automation requires external reply mode for inbox-enabled connections."
                                    },
                                    "otp_ttl_seconds": {
                                        "type": "integer",
                                        "minimum": 60,
                                        "maximum": 900
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Message accepted with a tracking ID; the response does not include message content.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/PublicMessage"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid message or media fields."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The WhatsApp gateway could not send the message."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique 8–128-character operation key. Retrying the same request returns the recorded result without executing a second send.",
                        "schema": {
                            "type": "string",
                            "minLength": 8,
                            "maxLength": 128,
                            "pattern": "^[A-Za-z0-9._:-]+$"
                        }
                    }
                ]
            }
        },
        "/v2/messages/{message}": {
            "get": {
                "summary": "Retrieve message status",
                "parameters": [
                    {
                        "name": "message",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Message accepted with a tracking ID; the response does not include message content.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/PublicMessage"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Message not found."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/groups": {
            "get": {
                "summary": "List groups in this data boundary",
                "parameters": [
                    {
                        "name": "connection_id",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Returns internal group identifiers and metadata without WhatsApp JIDs."
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/groups/{group}/metrics": {
            "get": {
                "summary": "Retrieve aggregate group metrics",
                "parameters": [
                    {
                        "name": "group",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "days",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 90,
                            "default": 30
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Aggregate metrics without message content."
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid or expired API key."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "The key does not have the required scope."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "API request allowance exceeded."
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/customers": {
            "get": {
                "summary": "List customers",
                "description": "Required scope: customers:read. Key owner: company. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "summary": "Create a customer",
                "description": "Required scope: customers:write. Key owner: company. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [
                    {
                        "name": "Idempotency-Key",
                        "in": "header",
                        "required": true,
                        "description": "A unique 8–128-character operation key. Retrying the same request returns the recorded result without executing a second send.",
                        "schema": {
                            "type": "string",
                            "minLength": 8,
                            "maxLength": 128,
                            "pattern": "^[A-Za-z0-9._:-]+$"
                        }
                    }
                ],
                "responses": {
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created. For key issuance, data.token is shown once; for webhook registration, data.secret is shown once."
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 160
                                    },
                                    "external_id": {
                                        "type": "string",
                                        "maxLength": 120
                                    }
                                },
                                "required": [
                                    "name",
                                    "external_id"
                                ]
                            },
                            "example": {
                                "name": "Example Customer",
                                "external_id": "customer-123"
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/customers/{customer}/keys": {
            "get": {
                "summary": "List customer keys",
                "description": "Required scope: customers:read. Key owner: company. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "summary": "Issue a customer key",
                "description": "Required scope: customers:write. Key owner: company. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created. For key issuance, data.token is shown once; for webhook registration, data.secret is shown once."
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "scopes": {
                                        "type": "array",
                                        "minItems": 1,
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "connections:pair",
                                                "connections:read",
                                                "connections:write",
                                                "messages:write",
                                                "messages:read",
                                                "messages:write:otp",
                                                "conversations:read",
                                                "conversations:write",
                                                "media:read",
                                                "groups:read",
                                                "groups:write",
                                                "groups:messages:read",
                                                "groups:media:read",
                                                "groups:receipts:read",
                                                "webhooks:read",
                                                "webhooks:write"
                                            ]
                                        }
                                    }
                                }
                            },
                            "example": {
                                "scopes": [
                                    "connections:pair",
                                    "connections:read",
                                    "connections:write",
                                    "messages:write",
                                    "messages:read",
                                    "conversations:read",
                                    "groups:read",
                                    "groups:write",
                                    "groups:messages:read",
                                    "groups:receipts:read",
                                    "webhooks:read",
                                    "webhooks:write"
                                ]
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/customers/{customer}/keys/{key}": {
            "delete": {
                "summary": "Revoke a customer key",
                "description": "Required scope: customers:write. Key owner: company. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/customers/{customer}": {
            "patch": {
                "summary": "Update customer status",
                "description": "Required scope: customers:write. Key owner: company. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "active",
                                            "suspended"
                                        ]
                                    }
                                },
                                "required": [
                                    "status"
                                ]
                            },
                            "example": {
                                "status": "suspended"
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/webhooks": {
            "get": {
                "summary": "List webhook endpoints",
                "description": "Required scope: webhooks:read. Key owner: customer. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            },
            "post": {
                "summary": "Create a webhook endpoint",
                "description": "Required scope: webhooks:write. Key owner: customer. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once. Content event registration requires the corresponding conversations:read, groups:messages:read, or groups:receipts:read scope.",
                "parameters": [],
                "responses": {
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Created. For key issuance, data.token is shown once; for webhook registration, data.secret is shown once."
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "url": {
                                        "type": "string",
                                        "format": "uri",
                                        "description": "Public HTTPS address; private networks are rejected."
                                    },
                                    "events": {
                                        "type": "array",
                                        "minItems": 1,
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                "group.message.content",
                                                "group.message.outbound",
                                                "group.message.receipt",
                                                "message.received",
                                                "message.outbound",
                                                "conversation.updated",
                                                "connection.updated",
                                                "message.sent",
                                                "message.delivered",
                                                "message.read",
                                                "message.failed",
                                                "group.message.received",
                                                "group.snapshot.updated",
                                                "summary.completed",
                                                "alert.opened",
                                                "campaign.updated",
                                                "*"
                                            ]
                                        }
                                    }
                                },
                                "required": [
                                    "url",
                                    "events"
                                ]
                            },
                            "example": {
                                "name": "Application events",
                                "url": "https://example.com/webhooks/jawib",
                                "events": [
                                    "message.received",
                                    "message.read",
                                    "group.message.receipt"
                                ]
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/webhooks/{endpoint}": {
            "delete": {
                "summary": "Disable a webhook endpoint",
                "description": "Required scope: webhooks:write. Key owner: customer. Customer keys never cross customer boundaries. Subscription must be active. Secrets are returned once.",
                "parameters": [
                    {
                        "name": "endpoint",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Invalid key"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Scope or subscription is not available"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Resource is outside this key account"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Validation failed"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "API error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "message"
                                    ],
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Subscription quota reached"
                                        },
                                        "code": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "bearerAuth": []
                    }
                ]
            }
        },
        "/v2/customers/{customer}/bootstrap": {
            "post": {
                "tags": [
                    "Customers"
                ],
                "summary": "Provision isolated customer key and signed webhook atomically",
                "description": "Requires a partner company key with customers:write. Use a stable UUID request_id for retries. The same request and callback recover the same encrypted credentials for up to 24 hours, until acknowledgment. A changed callback or acknowledged/revoked/expired receipt returns 409. A new request can replace expired unclaimed or revoked credentials; existing usable credentials are never silently rotated. Call acknowledgment after durable encrypted storage. Keep all credentials server-side.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "request_id",
                                    "webhook_url"
                                ],
                                "properties": {
                                    "request_id": {
                                        "type": "string",
                                        "format": "uuid"
                                    },
                                    "webhook_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "description": "Public HTTPS callback URL. SSRF protections apply."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Customer credentials and webhook secret; Cache-Control: private, no-store"
                    },
                    "403": {
                        "description": "Missing customers:write scope"
                    },
                    "404": {
                        "description": "Customer is not owned by this partner"
                    },
                    "409": {
                        "description": "Bootstrap receipt conflict, expired, acknowledged or revoked"
                    }
                }
            }
        },
        "/v2/customers/{customer}/bootstrap/acknowledge": {
            "post": {
                "tags": [
                    "Customers"
                ],
                "summary": "Acknowledge persisted bootstrap credentials",
                "description": "Requires a partner company key with customers:write. Call only after securely storing the child credentials. Repeated acknowledgments are safe and erase the recoverable secret payload.",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "parameters": [
                    {
                        "name": "customer",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "request_id"
                                ],
                                "properties": {
                                    "request_id": {
                                        "type": "string",
                                        "format": "uuid"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Acknowledged; recoverable secrets erased"
                    },
                    "403": {
                        "description": "Missing customers:write scope"
                    },
                    "404": {
                        "description": "Customer is not owned by this partner"
                    },
                    "409": {
                        "description": "Bootstrap receipt conflict, expired, acknowledged or revoked"
                    }
                }
            }
        }
    },
    "components": {
        "responses": {
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            },
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            }
        },
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "jwb_ API key",
                "description": "Create a key in your integration settings. The full token is shown only once."
            }
        },
        "schemas": {
            "MessageStatus": {
                "type": "string",
                "enum": [
                    "accepted",
                    "sent",
                    "delivered",
                    "read",
                    "failed"
                ]
            },
            "PublicMessage": {
                "type": "object",
                "required": [
                    "id",
                    "type",
                    "status"
                ],
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "text",
                            "image",
                            "audio",
                            "video",
                            "document",
                            "reaction",
                            "otp"
                        ]
                    },
                    "status": {
                        "$ref": "#/components/schemas/MessageStatus"
                    },
                    "reply_to": {
                        "type": "string",
                        "maxLength": 255,
                        "description": "WhatsApp message_id from retained history in this exact chat. Requires content-read scope and opt-in. Not a numeric history row or public send UUID. Not for OTP/reactions."
                    },
                    "mentions": {
                        "type": "array",
                        "maxItems": 50,
                        "uniqueItems": true,
                        "items": {
                            "type": "string",
                            "pattern": "^[0-9]+@(s\\.whatsapp\\.net|lid)$"
                        },
                        "description": "Group members only. Supported on text/image/video/document; actual membership checked at send time. Visible @tags appended if absent."
                    },
                    "reaction_to": {
                        "type": "string",
                        "maxLength": 255,
                        "description": "Required for type=reaction; scoped WhatsApp message_id. Same content-read and opt-in requirements as reply_to."
                    },
                    "emoji": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 32,
                        "description": "Must be present for type=reaction. One emoji grapheme adds/replaces a reaction; empty string or null removes our reaction. Text/media/mentions/reply_to forbidden on reactions."
                    },
                    "voice_note": {
                        "type": "boolean"
                    },
                    "destination_type": {
                        "type": "string",
                        "enum": [
                            "private",
                            "group"
                        ]
                    },
                    "group_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "receipt_scope": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "failure_code": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "sent_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "delivered_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "read_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            }
        }
    }
}
