{
    "openapi": "3.0.3",
    "info": {
        "title": "API da plataforma de campanhas WhatsApp",
        "version": "1.0.0",
        "description": "API REST para integrar contatos, campanhas, relatórios e webhooks.\n\nAutenticação: `Authorization: Bearer <token>` (crie tokens em Integrações, no painel). Cada token tem escopos e um limite de requisições por minuto (cabeçalhos `X-RateLimit-Limit` e `X-RateLimit-Remaining`; ao exceder, 429 com `Retry-After`).\n\nTodas as respostas seguem o envelope `{success, data, meta, error, correlation_id}`. A API respeita os limites do plano, o consentimento e a lista de descadastro.\n\nWebhooks: cada entrega traz `X-Webhook-Signature: t=<timestamp>,v1=<hex>`, onde v1 = HMAC-SHA256(segredo, \"<timestamp>.<corpo>\"). Responda 2xx em até 10 s; falhas são repetidas em 1 min, 5 min, 30 min, 2 h e 6 h."
    },
    "servers": [
        {
            "url": "https://api.saas.streamvox.com.br/api/v1"
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "wa_xxxxxxxx_..."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "details": {
                        "type": "object",
                        "nullable": true
                    }
                }
            },
            "Pagination": {
                "type": "object",
                "properties": {
                    "page": {
                        "type": "integer"
                    },
                    "per_page": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "last_page": {
                        "type": "integer"
                    }
                }
            },
            "Me": {
                "type": "object",
                "properties": {
                    "account": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string",
                                "description": "ID público (ULID)",
                                "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                            },
                            "name": {
                                "type": "string"
                            },
                            "status": {
                                "type": "string"
                            },
                            "timezone": {
                                "type": "string"
                            }
                        }
                    },
                    "token": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string",
                                "description": "ID público (ULID)",
                                "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                            },
                            "name": {
                                "type": "string"
                            },
                            "prefix": {
                                "type": "string"
                            },
                            "scopes": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "rate_limit_per_minute": {
                                "type": "integer"
                            },
                            "expires_at": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                            }
                        }
                    },
                    "limits": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "integer",
                            "nullable": true
                        }
                    }
                }
            },
            "Instance": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "name": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "awaiting_connection",
                            "connected",
                            "disconnected",
                            "error",
                            "suspended"
                        ]
                    },
                    "phone": {
                        "type": "string",
                        "nullable": true
                    },
                    "profile_name": {
                        "type": "string",
                        "nullable": true
                    },
                    "connected_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "disconnected_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "disconnect_reason": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "Contact": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "name": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string",
                        "example": "5511999998888"
                    },
                    "email": {
                        "type": "string",
                        "nullable": true
                    },
                    "company": {
                        "type": "string",
                        "nullable": true
                    },
                    "consent_status": {
                        "type": "string",
                        "enum": [
                            "pending",
                            "granted",
                            "revoked"
                        ]
                    },
                    "opted_out": {
                        "type": "boolean"
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "custom_fields": {
                        "type": "object"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                }
            },
            "ContactInput": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string",
                        "description": "Com ou sem DDI (padrão Brasil)"
                    },
                    "email": {
                        "type": "string"
                    },
                    "company": {
                        "type": "string"
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "custom_fields": {
                        "type": "object"
                    },
                    "consent_evidence": {
                        "type": "string",
                        "description": "Como a autorização foi obtida. Sem evidência, o contato fica pendente e não recebe campanhas."
                    }
                },
                "required": [
                    "name",
                    "phone"
                ]
            },
            "ContactUpdate": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "email": {
                        "type": "string"
                    },
                    "company": {
                        "type": "string"
                    },
                    "tags": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "custom_fields": {
                        "type": "object"
                    }
                }
            },
            "ConsentInput": {
                "type": "object",
                "properties": {
                    "evidence": {
                        "type": "string"
                    }
                },
                "required": [
                    "evidence"
                ]
            },
            "OptOutInput": {
                "type": "object",
                "properties": {
                    "phone": {
                        "type": "string"
                    },
                    "reason": {
                        "type": "string"
                    }
                },
                "required": [
                    "phone"
                ]
            },
            "OptOut": {
                "type": "object",
                "properties": {
                    "phone": {
                        "type": "string"
                    },
                    "suppressed": {
                        "type": "boolean"
                    },
                    "already_suppressed": {
                        "type": "boolean"
                    }
                }
            },
            "List": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "name": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "contacts": {
                        "type": "integer"
                    }
                }
            },
            "ListInput": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    }
                },
                "required": [
                    "name"
                ]
            },
            "ListContactsInput": {
                "type": "object",
                "properties": {
                    "contacts": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "maxItems": 500
                    }
                },
                "required": [
                    "contacts"
                ]
            },
            "ListAdded": {
                "type": "object",
                "properties": {
                    "added": {
                        "type": "integer"
                    },
                    "not_found": {
                        "type": "integer"
                    }
                }
            },
            "Template": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "name": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string"
                    },
                    "body": {
                        "type": "string"
                    },
                    "version": {
                        "type": "integer"
                    }
                }
            },
            "Campaign": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "name": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "pause_reason": {
                        "type": "string",
                        "nullable": true
                    },
                    "audience_type": {
                        "type": "string"
                    },
                    "schedule_type": {
                        "type": "string"
                    },
                    "instance_id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "content": {
                        "type": "string"
                    },
                    "include_opt_out": {
                        "type": "boolean"
                    },
                    "rate_per_minute": {
                        "type": "integer"
                    },
                    "next_run_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "messages": {
                        "type": "object",
                        "description": "Contagem por situação (detalhe)",
                        "additionalProperties": {
                            "type": "integer"
                        }
                    }
                }
            },
            "CampaignInput": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "instance_id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "content": {
                        "type": "string",
                        "description": "Aceita variáveis como {primeiro_nome}"
                    },
                    "template_id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "media_id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "include_opt_out": {
                        "type": "boolean"
                    },
                    "rate_per_minute": {
                        "type": "integer"
                    },
                    "stop_failure_pct": {
                        "type": "integer"
                    },
                    "schedule_now": {
                        "type": "boolean"
                    },
                    "variables": {
                        "type": "object",
                        "properties": {
                            "produto": {
                                "type": "string"
                            },
                            "link": {
                                "type": "string"
                            },
                            "cupom": {
                                "type": "string"
                            }
                        }
                    },
                    "audience": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "contacts",
                                    "groups"
                                ]
                            },
                            "all_contacts": {
                                "type": "boolean"
                            },
                            "lists": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "tags": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                },
                                "description": "Nomes de tags"
                            },
                            "groups": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "group_lists": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "schedule": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "immediate",
                                    "scheduled",
                                    "recurring"
                                ]
                            },
                            "starts_at": {
                                "type": "string",
                                "example": "2026-12-10T09:00"
                            },
                            "ends_at": {
                                "type": "string"
                            },
                            "timezone": {
                                "type": "string",
                                "example": "America/Sao_Paulo"
                            },
                            "freq": {
                                "type": "string",
                                "enum": [
                                    "daily",
                                    "weekly",
                                    "monthly"
                                ]
                            },
                            "interval": {
                                "type": "integer"
                            },
                            "weekdays": {
                                "type": "array",
                                "items": {
                                    "type": "integer"
                                },
                                "description": "1 = segunda … 7 = domingo"
                            },
                            "monthday": {
                                "type": "integer"
                            },
                            "time": {
                                "type": "string",
                                "example": "09:00"
                            }
                        }
                    },
                    "window": {
                        "type": "object",
                        "properties": {
                            "start": {
                                "type": "string",
                                "example": "08:00"
                            },
                            "end": {
                                "type": "string",
                                "example": "20:00"
                            },
                            "days": {
                                "type": "array",
                                "items": {
                                    "type": "integer"
                                }
                            },
                            "skip_holidays": {
                                "type": "boolean"
                            }
                        }
                    }
                },
                "required": [
                    "name",
                    "instance_id",
                    "content"
                ]
            },
            "Message": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "contact_id": {
                        "type": "string",
                        "nullable": true
                    },
                    "destination": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "skip_reason": {
                        "type": "string",
                        "nullable": true
                    },
                    "queued_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "accepted_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "delivered_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "read_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "failed_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "error": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "Schedule": {
                "type": "object",
                "properties": {
                    "planned_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "status": {
                        "type": "string"
                    },
                    "run_id": {
                        "type": "string",
                        "nullable": true
                    },
                    "run_status": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "Report": {
                "type": "object",
                "properties": {
                    "period": {
                        "type": "object"
                    },
                    "funnel": {
                        "type": "object"
                    },
                    "by_status": {
                        "type": "object"
                    },
                    "skip_reasons": {
                        "type": "object"
                    },
                    "daily": {
                        "type": "object"
                    },
                    "campaigns": {
                        "type": "array",
                        "items": {
                            "type": "object"
                        }
                    }
                }
            },
            "Subscription": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "status": {
                        "type": "string"
                    },
                    "plan": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string",
                                "description": "ID público (ULID)",
                                "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "price_cents": {
                        "type": "integer"
                    },
                    "interval_months": {
                        "type": "integer"
                    },
                    "trial_ends_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "current_period_start": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "current_period_end": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "cancel_at_period_end": {
                        "type": "boolean"
                    }
                }
            },
            "Invoice": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "number": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "kind": {
                        "type": "string"
                    },
                    "total_cents": {
                        "type": "integer"
                    },
                    "paid_cents": {
                        "type": "integer"
                    },
                    "due_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "paid_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "payment_url": {
                        "type": "string"
                    }
                }
            },
            "Webhook": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "url": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "contact.created",
                                "contact.consent_granted",
                                "contact.opted_out",
                                "message.received",
                                "message.delivered",
                                "message.read",
                                "campaign.completed",
                                "campaign.paused",
                                "instance.connected",
                                "instance.disconnected",
                                "invoice.paid"
                            ]
                        }
                    },
                    "active": {
                        "type": "boolean"
                    },
                    "disabled_reason": {
                        "type": "string",
                        "nullable": true
                    },
                    "consecutive_failures": {
                        "type": "integer"
                    },
                    "last_success_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "last_failure_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                }
            },
            "WebhookInput": {
                "type": "object",
                "properties": {
                    "url": {
                        "type": "string",
                        "description": "HTTPS público"
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "contact.created",
                                "contact.consent_granted",
                                "contact.opted_out",
                                "message.received",
                                "message.delivered",
                                "message.read",
                                "campaign.completed",
                                "campaign.paused",
                                "instance.connected",
                                "instance.disconnected",
                                "invoice.paid"
                            ]
                        }
                    },
                    "description": {
                        "type": "string"
                    }
                },
                "required": [
                    "url",
                    "events"
                ]
            },
            "WebhookUpdate": {
                "type": "object",
                "properties": {
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "active": {
                        "type": "boolean"
                    }
                }
            },
            "WebhookCreated": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/Webhook"
                    },
                    {
                        "type": "object",
                        "properties": {
                            "secret": {
                                "type": "string",
                                "description": "Exibido uma única vez"
                            }
                        }
                    }
                ]
            },
            "Delivery": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "event": {
                        "type": "string"
                    },
                    "event_id": {
                        "type": "string",
                        "description": "ID público (ULID)",
                        "example": "01JD8X4Q7Y2V9K3M5N6P8R0S1T"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "pending",
                            "delivered",
                            "retrying",
                            "failed"
                        ]
                    },
                    "attempts": {
                        "type": "integer"
                    },
                    "response_status": {
                        "type": "integer",
                        "nullable": true
                    },
                    "response_ms": {
                        "type": "integer",
                        "nullable": true
                    },
                    "error": {
                        "type": "string",
                        "nullable": true
                    },
                    "next_attempt_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "delivered_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                }
            },
            "PrivacyExport": {
                "type": "object",
                "description": "contact, consent (com histórico), suppression, tags, lists, interactions, messages, tasks, automations"
            },
            "Erased": {
                "type": "object",
                "properties": {
                    "erased": {
                        "type": "boolean"
                    },
                    "suppressed": {
                        "type": "boolean"
                    }
                }
            },
            "Deleted": {
                "type": "object",
                "properties": {
                    "deleted": {
                        "type": "boolean"
                    }
                }
            },
            "Queued": {
                "type": "object",
                "properties": {
                    "queued": {
                        "type": "boolean"
                    }
                }
            },
            "Secret": {
                "type": "object",
                "properties": {
                    "secret": {
                        "type": "string"
                    }
                }
            },
            "InstanceList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Instance"
                }
            },
            "ContactList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Contact"
                }
            },
            "ListList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/List"
                }
            },
            "TemplateList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Template"
                }
            },
            "CampaignList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Campaign"
                }
            },
            "MessageList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Message"
                }
            },
            "ScheduleList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Schedule"
                }
            },
            "InvoiceList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Invoice"
                }
            },
            "WebhookList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Webhook"
                }
            },
            "DeliveryList": {
                "type": "array",
                "items": {
                    "$ref": "#/components/schemas/Delivery"
                }
            }
        },
        "responses": {
            "Unauthorized": {
                "description": "Token ausente, inválido, expirado ou revogado",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "success": {
                                    "type": "boolean"
                                },
                                "data": {
                                    "nullable": true
                                },
                                "meta": {
                                    "type": "object",
                                    "nullable": true,
                                    "properties": {
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    }
                                },
                                "error": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Error"
                                        }
                                    ],
                                    "nullable": true
                                },
                                "correlation_id": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "Sem escopo/permissão, API fora do plano ou conta suspensa (escrita)",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "success": {
                                    "type": "boolean"
                                },
                                "data": {
                                    "nullable": true
                                },
                                "meta": {
                                    "type": "object",
                                    "nullable": true,
                                    "properties": {
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    }
                                },
                                "error": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Error"
                                        }
                                    ],
                                    "nullable": true
                                },
                                "correlation_id": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "ValidationError": {
                "description": "Dados inválidos (detalhes por campo em error.details.fields)",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "success": {
                                    "type": "boolean"
                                },
                                "data": {
                                    "nullable": true
                                },
                                "meta": {
                                    "type": "object",
                                    "nullable": true,
                                    "properties": {
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    }
                                },
                                "error": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Error"
                                        }
                                    ],
                                    "nullable": true
                                },
                                "correlation_id": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "RateLimited": {
                "description": "Limite de requisições atingido",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "success": {
                                    "type": "boolean"
                                },
                                "data": {
                                    "nullable": true
                                },
                                "meta": {
                                    "type": "object",
                                    "nullable": true,
                                    "properties": {
                                        "pagination": {
                                            "$ref": "#/components/schemas/Pagination"
                                        }
                                    }
                                },
                                "error": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Error"
                                        }
                                    ],
                                    "nullable": true
                                },
                                "correlation_id": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "paths": {
        "/me": {
            "get": {
                "tags": [
                    "Autenticação"
                ],
                "summary": "Dados do token, da conta e limites do plano",
                "operationId": "get_me",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Me"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/instances": {
            "get": {
                "tags": [
                    "Conexões"
                ],
                "summary": "Lista as conexões WhatsApp",
                "operationId": "get_instances",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/InstanceList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `instances:read`.",
                "x-scope": "instances:read"
            }
        },
        "/instances/{id}": {
            "get": {
                "tags": [
                    "Conexões"
                ],
                "summary": "Detalha uma conexão",
                "operationId": "get_instances_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Instance"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `instances:read`.",
                "x-scope": "instances:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da conexão",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/contacts": {
            "get": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Lista contatos com filtros",
                "operationId": "get_contacts",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ContactList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:read`.",
                "x-scope": "contacts:read",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Página (padrão 1)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Itens por página (1 a 100, padrão 25)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Busca por nome, telefone, e-mail ou empresa",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "consent",
                        "in": "query",
                        "required": false,
                        "description": "pending | granted | revoked",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "tag",
                        "in": "query",
                        "required": false,
                        "description": "Nome da tag",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "list",
                        "in": "query",
                        "required": false,
                        "description": "ID da lista",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "post": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Cria um contato (consentimento opcional, com evidência)",
                "operationId": "post_contacts",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Contact"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContactInput"
                            }
                        }
                    }
                }
            }
        },
        "/contacts/{id}": {
            "get": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Detalha um contato",
                "operationId": "get_contacts_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Contact"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:read`.",
                "x-scope": "contacts:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "patch": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Atualiza nome, e-mail, empresa, campos e tags",
                "operationId": "patch_contacts_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Contact"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ContactUpdate"
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Exclui um contato (o descadastro, se houver, é preservado)",
                "operationId": "delete_contacts_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Deleted"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/contacts/{id}/consent": {
            "post": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Registra a autorização do contato",
                "operationId": "post_contacts_id_consent",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Contact"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ConsentInput"
                            }
                        }
                    }
                }
            }
        },
        "/opt-outs": {
            "post": {
                "tags": [
                    "Contatos"
                ],
                "summary": "Descadastra um telefone (lista de supressão)",
                "operationId": "post_opt_outs",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/OptOut"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/OptOutInput"
                            }
                        }
                    }
                }
            }
        },
        "/contacts/{id}/privacy-export": {
            "get": {
                "tags": [
                    "LGPD"
                ],
                "summary": "Todos os dados guardados sobre o contato (pedido de acesso do titular)",
                "operationId": "get_contacts_id_privacy_export",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/PrivacyExport"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/contacts/{id}/erase": {
            "post": {
                "tags": [
                    "LGPD"
                ],
                "summary": "Exclui definitivamente os dados do contato; o telefone fica só na supressão",
                "operationId": "post_contacts_id_erase",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Erased"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/lists": {
            "get": {
                "tags": [
                    "Listas"
                ],
                "summary": "Lista as listas de contatos",
                "operationId": "get_lists",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ListList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:read`.",
                "x-scope": "contacts:read"
            },
            "post": {
                "tags": [
                    "Listas"
                ],
                "summary": "Cria uma lista",
                "operationId": "post_lists",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/List"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ListInput"
                            }
                        }
                    }
                }
            }
        },
        "/lists/{id}/contacts": {
            "post": {
                "tags": [
                    "Listas"
                ],
                "summary": "Adiciona contatos (até 500 por chamada)",
                "operationId": "post_lists_id_contacts",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ListAdded"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da lista",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ListContactsInput"
                            }
                        }
                    }
                }
            }
        },
        "/lists/{id}/contacts/{contact}": {
            "delete": {
                "tags": [
                    "Listas"
                ],
                "summary": "Remove um contato da lista",
                "operationId": "delete_lists_id_contacts_contact",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Deleted"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `contacts:write`.",
                "x-scope": "contacts:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da lista",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "contact",
                        "in": "path",
                        "required": true,
                        "description": "ID do contato",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/templates": {
            "get": {
                "tags": [
                    "Templates"
                ],
                "summary": "Lista templates de mensagem",
                "operationId": "get_templates",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/TemplateList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `templates:read`.",
                "x-scope": "templates:read",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Busca",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "description": "Categoria",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns": {
            "get": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Lista campanhas",
                "operationId": "get_campaigns",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/CampaignList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:read`.",
                "x-scope": "campaigns:read",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Página",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "draft, scheduled, running, paused, completed…",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "Busca",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "post": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Cria uma campanha (rascunho ou já agendada com schedule_now)",
                "operationId": "post_campaigns",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Campaign"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:write`.",
                "x-scope": "campaigns:write",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CampaignInput"
                            }
                        }
                    }
                }
            }
        },
        "/campaigns/{id}": {
            "get": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Detalha uma campanha com a contagem por situação",
                "operationId": "get_campaigns_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Campaign"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:read`.",
                "x-scope": "campaigns:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns/{id}/schedule": {
            "post": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Agenda (ou envia agora) a campanha",
                "operationId": "post_campaigns_id_schedule",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Campaign"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:write`.",
                "x-scope": "campaigns:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns/{id}/pause": {
            "post": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Pausa a campanha",
                "operationId": "post_campaigns_id_pause",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Campaign"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:write`.",
                "x-scope": "campaigns:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns/{id}/resume": {
            "post": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Retoma a campanha",
                "operationId": "post_campaigns_id_resume",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Campaign"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:write`.",
                "x-scope": "campaigns:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns/{id}/cancel": {
            "post": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Cancela a campanha",
                "operationId": "post_campaigns_id_cancel",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Campaign"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:write`.",
                "x-scope": "campaigns:write",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns/{id}/messages": {
            "get": {
                "tags": [
                    "Campanhas"
                ],
                "summary": "Mensagens da campanha e a situação de cada uma",
                "operationId": "get_campaigns_id_messages",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/MessageList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:read`.",
                "x-scope": "campaigns:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Página (padrão 1)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Itens por página (1 a 100, padrão 25)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Situação",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/campaigns/{id}/schedules": {
            "get": {
                "tags": [
                    "Agendamentos"
                ],
                "summary": "Ocorrências programadas e executadas",
                "operationId": "get_campaigns_id_schedules",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/ScheduleList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `campaigns:read`.",
                "x-scope": "campaigns:read",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID da campanha",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reports/summary": {
            "get": {
                "tags": [
                    "Relatórios"
                ],
                "summary": "Funil, situação das mensagens e desempenho por campanha",
                "operationId": "get_reports_summary",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Report"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `reports:read`.",
                "x-scope": "reports:read",
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "AAAA-MM-DD",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "AAAA-MM-DD",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "campaign_id",
                        "in": "query",
                        "required": false,
                        "description": "Filtrar por campanha",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "instance_id",
                        "in": "query",
                        "required": false,
                        "description": "Filtrar por conexão",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/subscription": {
            "get": {
                "tags": [
                    "Assinatura"
                ],
                "summary": "Assinatura vigente",
                "operationId": "get_subscription",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Subscription"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `billing:read`.",
                "x-scope": "billing:read"
            }
        },
        "/invoices": {
            "get": {
                "tags": [
                    "Assinatura"
                ],
                "summary": "Faturas da conta",
                "operationId": "get_invoices",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/InvoiceList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `billing:read`.",
                "x-scope": "billing:read",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Página (padrão 1)",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Itens por página (1 a 100, padrão 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ]
            }
        },
        "/webhooks": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Lista webhooks e eventos disponíveis",
                "operationId": "get_webhooks",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/WebhookList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage"
            },
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Cria um webhook (o segredo é exibido uma única vez)",
                "operationId": "post_webhooks",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/WebhookCreated"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookInput"
                            }
                        }
                    }
                }
            }
        },
        "/webhooks/{id}": {
            "patch": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Altera eventos ou ativa/desativa",
                "operationId": "patch_webhooks_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Webhook"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do webhook",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookUpdate"
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Exclui um webhook",
                "operationId": "delete_webhooks_id",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Deleted"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do webhook",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/webhooks/{id}/test": {
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Envia um evento de teste",
                "operationId": "post_webhooks_id_test",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Queued"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do webhook",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/webhooks/{id}/rotate-secret": {
            "post": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Gera novo segredo de assinatura",
                "operationId": "post_webhooks_id_rotate_secret",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/Secret"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do webhook",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/webhooks/{id}/deliveries": {
            "get": {
                "tags": [
                    "Webhooks"
                ],
                "summary": "Últimas entregas e tentativas",
                "operationId": "get_webhooks_id_deliveries",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Sucesso",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/DeliveryList"
                                        },
                                        "meta": {
                                            "type": "object",
                                            "nullable": true,
                                            "properties": {
                                                "pagination": {
                                                    "$ref": "#/components/schemas/Pagination"
                                                }
                                            }
                                        },
                                        "error": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Error"
                                                }
                                            ],
                                            "nullable": true
                                        },
                                        "correlation_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                },
                "description": "Escopo necessário: `webhooks:manage`.",
                "x-scope": "webhooks:manage",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "ID do webhook",
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        }
    }
}