{
  "openapi": "3.1.0",
  "info": {
    "title": "Documentação de API da Klivvo",
    "version": "1.0.0",
    "description": "Use o menu lateral para encontrar o módulo que deseja integrar, como Contatos, Pipelines, Automações ou Avaliações. Os módulos com API pública mostram as operações disponíveis, com parâmetros, exemplos e respostas. Os demais indicam que o acesso está no painel.\n\n## Autenticação\n\n**CRM.** Use uma chave de integração da conta no cabeçalho `Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO`. Solicite a emissão à equipe administradora da conta e guarde a chave no servidor.\n\n**Widgets On-site.** Cadastre o domínio da loja no painel da Klivvo e obtenha o token público do widget. Envie esse token na query string `pk`. Nos endpoints de envio, você também pode usar `X-Widget-Token` com o token de sessão gerado pelo widget. As operações que aceitam esse cabeçalho indicam a opção na seção de autenticação.\n\nA origem precisa corresponder ao domínio autorizado da loja. Em chamadas feitas pelo site, o próprio navegador envia o cabeçalho `Origin`.\n\n```bash\ncurl --get 'https://app.klivvo.com.br/api/onsite/widgets/widget' \\\n  --data-urlencode 'pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com'\n```\n\n## Formato das requisições\n\nUse `Content-Type: application/json` ao enviar dados. Para instalar o widget ou o SDK, use os scripts JavaScript descritos em **Instalação e tracking**. Os [guias de integração](https://help.klivvo.com.br/) mostram como instalar cada script e configurar consentimento.\n\n## Respostas e erros\n\nO corpo de sucesso depende da operação. Consultas retornam a configuração ou os dados disponíveis. Envios podem retornar um identificador, como `id` ou `consent_id`. Os exemplos de resposta ficam ao lado de cada operação.\n\n| HTTP | Quando ocorre |\n| --- | --- |\n| `200` | Consulta ou envio concluído. |\n| `201` | Registro criado. |\n| `400` | Dados obrigatórios ausentes ou inválidos. |\n| `401` | Credencial ausente, inválida ou inativa. |\n| `403` | Origem não autorizada. |\n| `429` | Limite de requisições atingido. Aguarde antes de repetir. |\n| `500` | Falha no processamento. |\n\n## Ambiente de teste\n\nUse uma conta de homologação e dados fictícios para testar operações de escrita. Você pode baixar o [arquivo OpenAPI](/openapi/klivvo.json) para importar no seu cliente de API."
  },
  "servers": [
    {
      "url": "https://app.klivvo.com.br",
      "description": "Produção"
    }
  ],
  "tags": [
    {
      "name": "Contatos",
      "description": "Listagem, consulta, busca, cadastro, atualização e exclusão de contatos da conta. A disponibilidade das rotas depende da implantação da API no ambiente."
    },
    {
      "name": "Empresas",
      "description": "Empresas e dados cadastrais vinculados ao CRM.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Pipelines",
      "description": "Consulta paginada de pipelines, etapas e negócios da conta, com status, valores e datas."
    },
    {
      "name": "Segmentos",
      "description": "Segmentos, tipos e contagem de membros da conta."
    },
    {
      "name": "Tags",
      "description": "Etiquetas de classificação dos contatos da conta."
    },
    {
      "name": "Conversas",
      "description": "Conversas e mensagens do atendimento."
    },
    {
      "name": "Chamadas",
      "description": "Histórico de chamadas e disponibilidade de gravações e transcrições."
    },
    {
      "name": "Agentes de IA",
      "description": "Cadastro básico do agente de atendimento."
    },
    {
      "name": "Widgets On-site",
      "description": "Configuração pública dos widgets instalados na loja."
    },
    {
      "name": "Pop-ups",
      "description": "Configuração e desempenho dos pop-ups.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Banners",
      "description": "Configuração e métricas das barras promocionais.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Prova social",
      "description": "Configuração dos widgets de prova social e suas métricas.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Produtos recomendados",
      "description": "Configuração das recomendações exibidas na loja.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Vitrines digitais",
      "description": "Configuração das vitrines e produtos associados.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Formulários",
      "description": "Envio de respostas de formulários pelos visitantes da loja.\n\nA API registra respostas. A consulta e a extração das respostas ficam no painel."
    },
    {
      "name": "Retorno de solicitações",
      "description": "Registro de pedidos de retorno enviados pela loja.\n\nA API recebe pedidos de retorno. O acompanhamento e a consulta ficam no painel."
    },
    {
      "name": "Avaliações",
      "description": "Consulta de avaliações publicadas e envio de novas avaliações."
    },
    {
      "name": "Notificações push",
      "description": "Envios de notificações e indicadores dos dispositivos inscritos.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "E-mail marketing",
      "description": "Envios, entregas e métricas de campanhas por e-mail.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Campanhas",
      "description": "Campanhas e indicadores de execução.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Newsletter",
      "description": "Inscrição voluntária pelo pop-up de newsletter.\n\nA API recebe inscrições. A consulta da base de assinantes usa o painel."
    },
    {
      "name": "Modelos",
      "description": "Modelos de comunicação usados nas campanhas.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Automações",
      "description": "Fluxos, gatilhos e histórico de execuções.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Produtos",
      "description": "Dados do catálogo de produtos e identificadores da loja.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Carrinhos abandonados",
      "description": "Carrinhos acompanhados pela loja e dados de recuperação.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Analytics",
      "description": "Indicadores e relatórios da operação.\n\n**API de integração indisponível.** Este módulo tem operações no painel da Klivvo, e ainda não tem endpoints publicados para integrações externas."
    },
    {
      "name": "Tracking",
      "description": "Instalação do SDK e envio de eventos da loja.\n\nA API recebe eventos. A extração do histórico usa os recursos disponíveis no painel."
    },
    {
      "name": "Instalação",
      "description": "Script do widget On-site para incluir na loja."
    },
    {
      "name": "Privacidade",
      "description": "Registro de consentimentos e de solicitações dos titulares.\n\nOs endpoints públicos registram solicitações e escolhas. A consulta e a exportação de registros são restritas ao painel."
    }
  ],
  "paths": {
    "/cdn/logflow-widget.js": {
      "get": {
        "tags": [
          "Instalação"
        ],
        "summary": "Obter script de instalação",
        "operationId": "obterScriptWidget",
        "description": "Arquivo JavaScript incluído no cabeçalho da loja ou no Google Tag Manager. Para inicializar o widget, informe o token público no atributo `data-token` conforme o guia de instalação.",
        "responses": {
          "200": {
            "description": "Script do widget.",
            "content": {
              "application/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/widget/track.js": {
      "get": {
        "tags": [
          "Tracking"
        ],
        "summary": "Obter SDK de tracking",
        "operationId": "obterSdkTracking",
        "description": "Script de rastreamento da loja. No modo auto, escuta o dataLayer e os eventos da página. No modo lib, disponibiliza window.klivvo para disparos por tags próprias, incluindo track e identify. Habilite Customer Tracking no painel. O widget On-site tem uma instalação separada.",
        "parameters": [
          {
            "name": "pk",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Token público lido pelo SDK para autenticar os envios."
            },
            "example": "SEU_TOKEN_PUBLICO"
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Modo de captura.",
              "enum": [
                "auto",
                "lib"
              ],
              "default": "auto"
            },
            "example": "lib"
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Perfil de seletores da sua plataforma.",
              "enum": [
                "wake",
                "shopify",
                "vtex",
                "nuvemshop",
                "tray"
              ],
              "default": "wake"
            },
            "example": "shopify"
          }
        ],
        "responses": {
          "200": {
            "description": "Script JavaScript do Customer Tracking.",
            "content": {
              "application/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/live-events/ingest": {
      "post": {
        "tags": [
          "Tracking"
        ],
        "summary": "Enviar evento da loja",
        "operationId": "enviarEventoLoja",
        "description": "Recebe eventos para o Customer Tracking. Para uma instalação padrão, prefira o SDK. Use a chamada direta quando precisar enviar um evento da sua integração. Quando o rastreamento estiver desligado ou o evento for ignorado, a resposta pode trazer skipped: true.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/live-events/ingest?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"event_name\":\"view_item\",\"event_data\":{\"product_id\":\"SKU-123\"},\"page_url\":\"https://loja.exemplo.com/produtos/sku-123\"}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_name": {
                    "type": "string",
                    "description": "Nome do evento da loja.",
                    "maxLength": 100
                  },
                  "event_data": {
                    "type": "object",
                    "description": "Dados do evento.",
                    "additionalProperties": true
                  },
                  "page_url": {
                    "type": "string",
                    "description": "URL atual da loja.",
                    "format": "uri",
                    "maxLength": 2048
                  },
                  "session_id": {
                    "type": "string",
                    "description": "Identificador de sessão.",
                    "maxLength": 128
                  },
                  "visitor_id": {
                    "type": "string",
                    "description": "Identificador do visitante.",
                    "maxLength": 128
                  }
                },
                "required": [
                  "event_name"
                ]
              },
              "example": {
                "event_name": "view_item",
                "event_data": {
                  "product_id": "SKU-123"
                },
                "page_url": "https://loja.exemplo.com/produtos/sku-123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Requisição processada.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "routing": {
                      "type": "object"
                    },
                    "skipped": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                },
                "example": {
                  "ok": true,
                  "skipped": true,
                  "reason": "customer_tracking_disabled"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "404": {
            "description": "Conta não encontrada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "tenant_not_found"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/onsite/widgets/widget": {
      "get": {
        "tags": [
          "Widgets On-site"
        ],
        "summary": "Consultar widgets publicados",
        "operationId": "consultarWidgetsOnsite",
        "description": "Retorna a configuração pública dos widgets On-site. O token público identifica a conta, e a origem da requisição deve corresponder a um domínio autorizado. No navegador da loja, a origem é enviada pelo próprio navegador.",
        "security": [
          {
            "TokenPublico": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --get 'https://app.klivvo.com.br/api/onsite/widgets/widget' \\\n  --data-urlencode 'pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com'"
          }
        ],
        "responses": {
          "200": {
            "description": "Configuração retornada. `enabled: false` indica que não há widgets On-site configurados.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetsOnsite"
                },
                "examples": {
                  "semWidgets": {
                    "summary": "Loja sem widgets configurados",
                    "value": {
                      "enabled": false,
                      "source": "onsite_widgets",
                      "empty": true
                    }
                  },
                  "comWidgets": {
                    "summary": "Resumo de uma loja com banner de cookies",
                    "value": {
                      "enabled": true,
                      "source": "onsite_widgets",
                      "cookies": {
                        "enabled": true,
                        "appearance": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "description": "Erro ao consultar a configuração.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Erro ao buscar widgets on-site"
                }
              }
            }
          }
        }
      }
    },
    "/api/callback/submit": {
      "post": {
        "tags": [
          "Retorno de solicitações"
        ],
        "summary": "Solicitar retorno",
        "operationId": "solicitarRetorno",
        "description": "Registra um pedido de retorno feito pelo visitante. O retorno é tratado no painel da loja.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/callback/submit?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"name\":\"Ana Exemplo\",\"phone\":\"+551100000000\",\"preferred_time\":\"Tarde\",\"page_url\":\"https://loja.exemplo.com/produtos/sku-123\"}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phone": {
                    "type": "string",
                    "description": "Telefone informado pelo visitante.",
                    "maxLength": 30
                  },
                  "name": {
                    "type": "string",
                    "description": "Nome informado pelo visitante.",
                    "maxLength": 200
                  },
                  "message": {
                    "type": "string",
                    "description": "Mensagem informada pelo visitante.",
                    "maxLength": 2000
                  },
                  "preferred_time": {
                    "type": "string",
                    "description": "Horário ou período sugerido pelo visitante.",
                    "maxLength": 120
                  },
                  "widget_id": {
                    "type": "string",
                    "description": "Identificador do widget de origem.",
                    "maxLength": 80
                  },
                  "page_url": {
                    "type": "string",
                    "description": "URL da página em que ocorreu a interação.",
                    "format": "uri",
                    "maxLength": 1000
                  }
                },
                "required": [
                  "phone"
                ]
              },
              "example": {
                "name": "Ana Exemplo",
                "phone": "+551100000000",
                "preferred_time": "Tarde",
                "page_url": "https://loja.exemplo.com/produtos/sku-123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Requisição processada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistroCriado"
                },
                "example": {
                  "ok": true,
                  "id": "83b6a8e7-cfd2-46fa-8c64-28ef46f271d9"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/formularios/submit": {
      "post": {
        "tags": [
          "Formulários"
        ],
        "summary": "Enviar formulário da loja",
        "operationId": "enviarFormularioLoja",
        "description": "Registra o formulário enviado pelo visitante. Informe pelo menos um campo válido entre nome, e-mail, telefone e mensagem.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/formularios/submit?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"name\":\"Ana Exemplo\",\"email\":\"ana@exemplo.com\",\"message\":\"Gostaria de saber mais sobre o produto.\",\"page_url\":\"https://loja.exemplo.com/produtos/sku-123\"}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Nome informado pelo visitante.",
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string",
                    "description": "E-mail informado pelo visitante.",
                    "format": "email",
                    "maxLength": 254
                  },
                  "phone": {
                    "type": "string",
                    "description": "Telefone informado pelo visitante.",
                    "maxLength": 30
                  },
                  "message": {
                    "type": "string",
                    "description": "Mensagem informada pelo visitante.",
                    "maxLength": 2000
                  },
                  "widget_id": {
                    "type": "string",
                    "description": "Identificador do widget de origem.",
                    "maxLength": 80
                  },
                  "page_url": {
                    "type": "string",
                    "description": "URL da página em que ocorreu a interação.",
                    "format": "uri",
                    "maxLength": 1000
                  }
                }
              },
              "example": {
                "name": "Ana Exemplo",
                "email": "ana@exemplo.com",
                "message": "Gostaria de saber mais sobre o produto.",
                "page_url": "https://loja.exemplo.com/produtos/sku-123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Requisição processada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistroCriado"
                },
                "example": {
                  "ok": true,
                  "id": "83b6a8e7-cfd2-46fa-8c64-28ef46f271d9"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/product-reviews/widget": {
      "get": {
        "tags": [
          "Avaliações"
        ],
        "summary": "Consultar avaliações publicadas",
        "operationId": "consultarAvaliacoesPublicadas",
        "description": "Retorna os widgets de avaliações ativos e suas avaliações públicas, conforme a página e o produto informados. A configuração de visibilidade é definida no painel da loja.",
        "security": [
          {
            "TokenPublico": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          },
          {
            "name": "product_id",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Identificador do produto."
            },
            "example": "SKU-123"
          },
          {
            "name": "page_type",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Tipo de página. Use product para uma página de produto."
            },
            "example": "product"
          },
          {
            "name": "page_url",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "URL da página.",
              "format": "uri"
            },
            "example": "https://loja.exemplo.com/produtos/sku-123"
          }
        ],
        "responses": {
          "200": {
            "description": "Widgets e avaliações visíveis na página informada.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enabled": {
                      "type": "boolean"
                    },
                    "widgets": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  },
                  "required": [
                    "enabled",
                    "widgets"
                  ]
                },
                "example": {
                  "enabled": false,
                  "widgets": []
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/product-reviews/submit": {
      "post": {
        "tags": [
          "Avaliações"
        ],
        "summary": "Enviar avaliação",
        "operationId": "enviarAvaliacao",
        "description": "Recebe uma avaliação enviada pelo visitante. O registro é criado para moderação no painel.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/product-reviews/submit?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"author_name\":\"Ana Exemplo\",\"rating\":5,\"comment\":\"O produto chegou no prazo.\",\"product_id\":\"SKU-123\"}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "author_name": {
                    "type": "string",
                    "description": "Nome do autor da avaliação.",
                    "maxLength": 120
                  },
                  "title": {
                    "type": "string",
                    "description": "Título da avaliação.",
                    "maxLength": 200
                  },
                  "comment": {
                    "type": "string",
                    "description": "Texto da avaliação.",
                    "maxLength": 4000
                  },
                  "rating": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "product_id": {
                    "type": "string",
                    "description": "Identificador do produto quando a avaliação for de produto."
                  },
                  "widget_id": {
                    "type": "string",
                    "description": "Identificador do widget de origem.",
                    "maxLength": 80
                  }
                },
                "required": [
                  "author_name",
                  "comment",
                  "rating"
                ]
              },
              "example": {
                "author_name": "Ana Exemplo",
                "rating": 5,
                "comment": "O produto chegou no prazo.",
                "product_id": "SKU-123"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Requisição processada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegistroCriado"
                },
                "example": {
                  "ok": true,
                  "id": "83b6a8e7-cfd2-46fa-8c64-28ef46f271d9"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/newsletter/popup-subscribe": {
      "post": {
        "tags": [
          "Newsletter"
        ],
        "summary": "Cadastrar assinante do pop-up",
        "operationId": "cadastrarAssinantePopup",
        "description": "Registra a inscrição voluntária realizada no bloco de newsletter do pop-up. A inscrição atualiza o contato e o associa ao segmento Newsletter.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/newsletter/popup-subscribe?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"email\":\"ana@exemplo.com\",\"name\":\"Ana Exemplo\",\"page_url\":\"https://loja.exemplo.com/produtos/sku-123\"}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "E-mail informado pelo visitante.",
                    "format": "email"
                  },
                  "name": {
                    "type": "string",
                    "description": "Nome informado pelo visitante.",
                    "maxLength": 200
                  },
                  "popup_id": {
                    "type": "string",
                    "description": "ID do pop-up em que houve a inscrição.",
                    "maxLength": 128
                  },
                  "page_url": {
                    "type": "string",
                    "description": "URL da página em que ocorreu a interação.",
                    "format": "uri",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "email"
                ]
              },
              "example": {
                "email": "ana@exemplo.com",
                "name": "Ana Exemplo",
                "page_url": "https://loja.exemplo.com/produtos/sku-123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Requisição processada.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "skipped": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok"
                  ]
                },
                "example": {
                  "ok": true,
                  "customer_id": "83b6a8e7-cfd2-46fa-8c64-28ef46f271d9"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/cookie-consent": {
      "post": {
        "tags": [
          "Privacidade"
        ],
        "summary": "Registrar consentimento de cookies",
        "operationId": "registrarConsentimento",
        "description": "Registra uma escolha real do visitante e retorna o identificador do consentimento. Envie a escolha após a interação com o banner. Para testes que gravam dados, use uma conta e um ambiente de homologação.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/cookie-consent?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"action\":\"custom\",\"categories\":{\"analytics\":true,\"marketing\":false}}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EscolhaDeCookies"
              },
              "example": {
                "action": "custom",
                "categories": {
                  "analytics": true,
                  "marketing": false
                },
                "pageUrl": "https://loja.exemplo.com/produtos"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Consentimento registrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConsentimentoRegistrado"
                },
                "example": {
                  "ok": true,
                  "consent_id": "83b6a8e7-cfd2-46fa-8c64-28ef46f271d9"
                }
              }
            }
          },
          "400": {
            "description": "Corpo ausente, JSON inválido ou campos rejeitados.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_json"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "413": {
            "description": "Corpo da requisição acima do limite aceito.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "payload_too_large"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "description": "Falha ao registrar a escolha.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "ok": false,
                  "error": "persist_failed"
                }
              }
            }
          }
        }
      }
    },
    "/api/cookie-dsar": {
      "post": {
        "tags": [
          "Privacidade"
        ],
        "summary": "Registrar solicitação de privacidade",
        "operationId": "registrarSolicitacaoPrivacidade",
        "description": "Registra uma solicitação feita pelo titular dos dados. O status inicial é pendente e deve ser acompanhado pela equipe responsável no painel da loja.",
        "security": [
          {
            "TokenPublico": []
          },
          {
            "SessaoWidget": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/OrigemDaLoja"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/cookie-dsar?pk=SEU_TOKEN_PUBLICO' \\\n  --header 'Origin: https://loja.exemplo.com' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"type\":\"access\",\"email\":\"ana@exemplo.com\",\"name\":\"Ana Exemplo\",\"message\":\"Gostaria de solicitar acesso aos meus dados.\"}'"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "Tipo de solicitação.",
                    "enum": [
                      "opt_out",
                      "download",
                      "access",
                      "delete",
                      "other"
                    ],
                    "default": "opt_out"
                  },
                  "email": {
                    "type": "string",
                    "description": "E-mail informado pelo visitante.",
                    "format": "email",
                    "maxLength": 320
                  },
                  "name": {
                    "type": "string",
                    "description": "Nome informado pelo visitante.",
                    "maxLength": 200
                  },
                  "message": {
                    "type": "string",
                    "description": "Mensagem informada pelo visitante.",
                    "maxLength": 2000
                  },
                  "page_url": {
                    "type": "string",
                    "description": "URL da página em que ocorreu a interação.",
                    "format": "uri",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "email"
                ]
              },
              "example": {
                "type": "access",
                "email": "ana@exemplo.com",
                "name": "Ana Exemplo",
                "message": "Gostaria de solicitar acesso aos meus dados."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Requisição processada.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "type",
                        "status",
                        "created_at"
                      ]
                    }
                  },
                  "required": [
                    "ok",
                    "request"
                  ]
                },
                "example": {
                  "ok": true,
                  "request": {
                    "id": "83b6a8e7-cfd2-46fa-8c64-28ef46f271d9",
                    "type": "access",
                    "status": "pending",
                    "created_at": "2026-12-05T10:30:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/DadosInvalidos"
          },
          "401": {
            "$ref": "#/components/responses/CredencialInvalida"
          },
          "403": {
            "$ref": "#/components/responses/OrigemNaoAutorizada"
          },
          "429": {
            "$ref": "#/components/responses/LimiteDeRequisicoes"
          },
          "500": {
            "$ref": "#/components/responses/ErroInterno"
          }
        }
      }
    },
    "/api/v1/contacts": {
      "get": {
        "tags": [
          "Contatos"
        ],
        "summary": "Listar contatos",
        "operationId": "listarContatos",
        "description": "Permissão: `contacts:read`. Retorna os registros da conta vinculada à chave. A paginação usa uma ordem estável por identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/contacts?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contato"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Ana Exemplo",
                      "email": "ana@exemplo.com",
                      "phone": null,
                      "opted_in": true,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Contatos"
        ],
        "summary": "Criar contato",
        "operationId": "criarContato",
        "description": "Permissão: `contacts:write`. Cria um contato com e-mail obrigatório. O cadastro começa com opted_in igual a false.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request POST 'https://app.klivvo.com.br/api/v1/contacts' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"email\":\"ana@exemplo.com\",\"name\":\"Ana Exemplo\",\"phone\":\"+55 (11) 91234-5678\"}'"
          }
        ],
        "responses": {
          "201": {
            "description": "Contato criado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Contato"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                    "name": "Ana Exemplo",
                    "email": "ana@exemplo.com",
                    "phone": null,
                    "opted_in": false,
                    "created_at": "2026-12-05T10:30:00Z",
                    "updated_at": "2026-12-05T10:30:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Dados do contato inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "409": {
            "description": "Já existe um contato com esse e-mail na conta ou o lote repete o mesmo endereço.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "contact_email_conflict"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CriarContato"
              },
              "example": {
                "email": "ana@exemplo.com",
                "name": "Ana Exemplo",
                "phone": "+55 (11) 91234-5678"
              }
            }
          }
        }
      }
    },
    "/api/v1/pipelines": {
      "get": {
        "tags": [
          "Pipelines"
        ],
        "summary": "Listar pipelines",
        "operationId": "listarPipelines",
        "description": "Permissão: `pipelines:read`. Retorna os registros da conta vinculada à chave. A paginação usa uma ordem estável por identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/pipelines?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Pipeline"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Vendas",
                      "description": null,
                      "pipeline_type": "deals",
                      "is_default": true,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pipelines/{id}/stages": {
      "get": {
        "tags": [
          "Pipelines"
        ],
        "summary": "Listar etapas de um pipeline",
        "operationId": "listarEtapas",
        "description": "Permissão: `pipelines:read`. Retorna os registros da conta vinculada à chave. A paginação usa uma ordem estável por identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PipelineId"
          },
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/pipelines/2833cf06-56dd-45ec-9be8-86c1d52be281/stages?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Etapa"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "pipeline_id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Qualificação",
                      "position": 1,
                      "is_conclusion": false,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "404": {
            "description": "Pipeline não encontrado na conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "pipeline_not_found"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/pipelines/{id}/deals": {
      "get": {
        "tags": [
          "Pipelines"
        ],
        "summary": "Listar negócios de um pipeline",
        "operationId": "listarNegocios",
        "description": "Permissão: `pipelines:read`. Retorna os registros da conta vinculada à chave. A paginação usa uma ordem estável por identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/PipelineId"
          },
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/pipelines/2833cf06-56dd-45ec-9be8-86c1d52be281/deals?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Negocio"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "pipeline_id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "stage_id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "contact_id": null,
                      "title": "Negócio de exemplo",
                      "value": "150.00",
                      "currency": "BRL",
                      "status": "open",
                      "expected_close_date": null,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "404": {
            "description": "Pipeline não encontrado na conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "pipeline_not_found"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/segments": {
      "get": {
        "tags": [
          "Segmentos"
        ],
        "summary": "Listar segmentos",
        "operationId": "listarSegmentos",
        "description": "Permissão: `segments:read`. Retorna os registros da conta vinculada à chave. A paginação usa uma ordem estável por identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/segments?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Segmento"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Clientes recorrentes",
                      "slug": "clientes-recorrentes",
                      "description": null,
                      "type": "dynamic",
                      "source": "manual",
                      "member_count": 12,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tags": {
      "get": {
        "tags": [
          "Tags"
        ],
        "summary": "Listar tags",
        "operationId": "listarTags",
        "description": "Permissão: `tags:read`. Retorna os registros da conta vinculada à chave. A paginação usa uma ordem estável por identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/tags?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TagCRM"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "VIP",
                      "color": "#78716c",
                      "created_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/conversations": {
      "get": {
        "tags": [
          "Conversas"
        ],
        "summary": "Listar conversas",
        "operationId": "listarConversas",
        "description": "Permissão: `conversations:read`. Retorna canal, status e referências de cada conversa da conta vinculada à chave. A paginação usa a ordem do identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/conversations?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Conversa"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "channel": "widget",
                      "status": "open",
                      "contact_id": null,
                      "team_id": null,
                      "last_message_at": "2026-12-05T10:30:00Z",
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/conversations/{id}/messages": {
      "get": {
        "tags": [
          "Conversas"
        ],
        "summary": "Listar mensagens de uma conversa",
        "operationId": "listarMensagens",
        "description": "Permissão: `messages:read`. Retorna remetente, conteúdo, tipo e data das mensagens da conversa. O histórico exclui notas internas e URLs de anexos. A paginação usa a ordem do identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/ConversaId"
          },
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/conversations/2833cf06-56dd-45ec-9be8-86c1d52be281/messages?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MensagemAtendimento"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be282",
                      "conversation_id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "sender": "agent",
                      "body": "Olá! Como posso ajudar?",
                      "type": "text",
                      "created_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Identificador da conversa ou parâmetros de paginação inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "404": {
            "description": "Conversa não encontrada nesta conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "conversation_not_found"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls": {
      "get": {
        "tags": [
          "Chamadas"
        ],
        "summary": "Listar chamadas",
        "operationId": "listarChamadas",
        "description": "Permissão: `calls:read`. Retorna contato, data e indicadores de disponibilidade de gravação e transcrição. A paginação usa a ordem do identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/calls?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ChamadaAtendimento"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "contact": "Ana Exemplo",
                      "occurred_at": "2026-12-05T10:30:00Z",
                      "has_recording": false,
                      "has_transcript": true
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai-agents": {
      "get": {
        "tags": [
          "Agentes de IA"
        ],
        "summary": "Listar agentes de IA",
        "operationId": "listarAgentesIA",
        "description": "Permissão: `ai-agents:read`. Retorna o cadastro básico do agente de atendimento da conta, incluindo nome, idioma e status de ativação. A paginação usa a ordem do identificador. Quando next_cursor for null, a consulta chegou à última página.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl 'https://app.klivvo.com.br/api/v1/ai-agents?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AgenteAtendimento"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Assistente",
                      "enabled": true,
                      "language": "pt-BR",
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_pagination"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/contacts/{id}": {
      "get": {
        "tags": [
          "Contatos"
        ],
        "summary": "Consultar contato",
        "operationId": "consultarContato",
        "description": "Permissão: `contacts:read`. Retorna um contato pelo identificador.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Identificador do contato.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request GET 'https://app.klivvo.com.br/api/v1/contacts/2833cf06-56dd-45ec-9be8-86c1d52be281' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Contato encontrado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Contato"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                    "name": "Ana Exemplo",
                    "email": "ana@exemplo.com",
                    "phone": null,
                    "opted_in": true,
                    "created_at": "2026-12-05T10:30:00Z",
                    "updated_at": "2026-12-05T10:30:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Identificador inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact_id"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "404": {
            "description": "Contato não encontrado nesta conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "contact_not_found"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Contatos"
        ],
        "summary": "Atualizar contato",
        "operationId": "atualizarContato",
        "description": "Permissão: `contacts:write`. Altera os campos enviados. Envie null para limpar nome ou telefone.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Identificador do contato.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request PATCH 'https://app.klivvo.com.br/api/v1/contacts/2833cf06-56dd-45ec-9be8-86c1d52be281' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"name\":\"Ana Atualizada\",\"phone\":null}'"
          }
        ],
        "responses": {
          "200": {
            "description": "Contato atualizado.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Contato"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                    "name": "Ana Atualizada",
                    "email": "ana@exemplo.com",
                    "phone": null,
                    "opted_in": true,
                    "created_at": "2026-12-05T10:30:00Z",
                    "updated_at": "2026-12-05T10:30:00Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Identificador ou dados do contato inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "404": {
            "description": "Contato não encontrado nesta conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "contact_not_found"
                }
              }
            }
          },
          "409": {
            "description": "Já existe um contato com esse e-mail na conta ou o lote repete o mesmo endereço.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "contact_email_conflict"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AtualizarContato"
              },
              "example": {
                "name": "Ana Atualizada",
                "phone": null
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Contatos"
        ],
        "summary": "Excluir contato",
        "operationId": "excluirContato",
        "description": "Permissão: `contacts:delete`. Exclui definitivamente o contato especificado.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Identificador do contato.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request DELETE 'https://app.klivvo.com.br/api/v1/contacts/2833cf06-56dd-45ec-9be8-86c1d52be281' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO'"
          }
        ],
        "responses": {
          "200": {
            "description": "Contato excluído.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "id"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "id": "2833cf06-56dd-45ec-9be8-86c1d52be281"
                }
              }
            }
          },
          "400": {
            "description": "Identificador inválido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact_id"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "404": {
            "description": "Contato não encontrado nesta conta.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "contact_not_found"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/contacts/search": {
      "post": {
        "tags": [
          "Contatos"
        ],
        "summary": "Buscar contatos",
        "operationId": "buscarContatos",
        "description": "Permissão: `contacts:read`. Busca por trecho do nome ou do e-mail, sem distinção entre maiúsculas e minúsculas. Envie limit e cursor na URL para paginar.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request POST 'https://app.klivvo.com.br/api/v1/contacts/search?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"query\":\"Ana\"}'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contato"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Ana Exemplo",
                      "email": "ana@exemplo.com",
                      "phone": null,
                      "opted_in": true,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Busca ou paginação inválida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact_query"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                }
              },
              "example": {
                "query": "Ana"
              }
            }
          }
        }
      }
    },
    "/api/v1/contacts/search-by-cellphone": {
      "post": {
        "tags": [
          "Contatos"
        ],
        "summary": "Buscar por celular",
        "operationId": "buscarContatosPorCelular",
        "description": "Permissão: `contacts:read`. Busca pelo número sem pontuação. Aceita números brasileiros locais ou com código 55. Envie limit e cursor na URL para paginar.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/LimiteCRM"
          },
          {
            "$ref": "#/components/parameters/CursorCRM"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request POST 'https://app.klivvo.com.br/api/v1/contacts/search-by-cellphone?limit=25' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"phone\":\"+55 (11) 91234-5678\"}'"
          }
        ],
        "responses": {
          "200": {
            "description": "Página de registros.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contato"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "uuid"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Ana Exemplo",
                      "email": "ana@exemplo.com",
                      "phone": "+55 (11) 91234-5678",
                      "opted_in": true,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Busca ou paginação inválida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact_phone"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "phone"
                ],
                "properties": {
                  "phone": {
                    "type": "string",
                    "maxLength": 32,
                    "description": "Número com 8 a 15 dígitos. Aceita espaços, parênteses, hífens e sinal de mais no início."
                  }
                }
              },
              "example": {
                "phone": "+55 (11) 91234-5678"
              }
            }
          }
        }
      }
    },
    "/api/v1/contacts/batch": {
      "post": {
        "tags": [
          "Contatos"
        ],
        "summary": "Criar contatos em lote",
        "operationId": "criarContatosEmLote",
        "description": "Permissão: `contacts:write`. Cria de 1 a 100 contatos por requisição. O lote é atômico. Se algum item falhar ou houver e-mail duplicado, nenhum contato é criado.",
        "security": [
          {
            "ChaveDeIntegracao": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "cURL",
            "source": "curl --request POST 'https://app.klivvo.com.br/api/v1/contacts/batch' \\\n  --header 'Authorization: Bearer SUA_CHAVE_DE_INTEGRACAO' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"contacts\":[{\"email\":\"ana@exemplo.com\",\"name\":\"Ana Exemplo\"}]}'"
          }
        ],
        "responses": {
          "201": {
            "description": "Contatos criados na ordem do envio.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contato"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "2833cf06-56dd-45ec-9be8-86c1d52be281",
                      "name": "Ana Exemplo",
                      "email": "ana@exemplo.com",
                      "phone": null,
                      "opted_in": false,
                      "created_at": "2026-12-05T10:30:00Z",
                      "updated_at": "2026-12-05T10:30:00Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Formato do lote ou dados de um contato inválidos.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_contact_batch"
                }
              }
            }
          },
          "401": {
            "description": "Chave inválida, ausente ou revogada.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "invalid_api_key"
                }
              }
            }
          },
          "403": {
            "description": "A chave não tem a permissão exigida.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "insufficient_scope"
                }
              }
            }
          },
          "409": {
            "description": "Já existe um contato com esse e-mail na conta ou o lote repete o mesmo endereço.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "contact_email_conflict"
                }
              }
            }
          },
          "429": {
            "description": "Limite de requisições atingido.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "Muitas requisições. Tente novamente mais tarde."
                }
              }
            }
          },
          "503": {
            "description": "Integração temporariamente indisponível.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                },
                "example": {
                  "error": "integration_unavailable"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contacts"
                ],
                "properties": {
                  "contacts": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "$ref": "#/components/schemas/CriarContato"
                    }
                  }
                }
              },
              "example": {
                "contacts": [
                  {
                    "email": "ana@exemplo.com",
                    "name": "Ana Exemplo"
                  }
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "TokenPublico": {
        "type": "apiKey",
        "in": "query",
        "name": "pk",
        "description": "Token público do widget obtido no painel da sua loja."
      },
      "SessaoWidget": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Widget-Token",
        "description": "Token de sessão gerado pelo widget."
      },
      "ChaveDeIntegracao": {
        "type": "http",
        "scheme": "bearer",
        "description": "Chave de integração da conta. Use no servidor e mantenha a chave em segredo. As permissões exigidas aparecem em cada operação."
      }
    },
    "parameters": {
      "OrigemDaLoja": {
        "name": "Origin",
        "in": "header",
        "description": "Origem HTTPS autorizada da loja. Em chamadas do navegador, o navegador preenche este cabeçalho.",
        "schema": {
          "type": "string",
          "format": "uri"
        },
        "example": "https://loja.exemplo.com"
      },
      "LimiteCRM": {
        "name": "limit",
        "in": "query",
        "description": "Quantidade de registros por página.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "CursorCRM": {
        "name": "cursor",
        "in": "query",
        "description": "Use o next_cursor retornado na página anterior. Omita este parâmetro na primeira consulta.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "PipelineId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Identificador do pipeline na conta.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "ConversaId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Identificador da conversa.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "schemas": {
      "Erro": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "details": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          }
        }
      },
      "WidgetsOnsite": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "source": {
            "type": "string",
            "example": "onsite_widgets"
          },
          "empty": {
            "type": "boolean"
          },
          "cookies": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "appearance": {
                "type": [
                  "object",
                  "null"
                ]
              }
            }
          }
        },
        "additionalProperties": true
      },
      "EscolhaDeCookies": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "accept_all",
              "reject_all",
              "custom"
            ],
            "description": "Escolha informada pelo visitante."
          },
          "categories": {
            "type": "object",
            "properties": {
              "analytics": {
                "type": "boolean"
              },
              "marketing": {
                "type": "boolean"
              }
            }
          },
          "pageUrl": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048,
            "description": "URL da página em que a escolha foi registrada."
          }
        }
      },
      "ConsentimentoRegistrado": {
        "type": "object",
        "required": [
          "ok",
          "consent_id"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "consent_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "RegistroCriado": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "id": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "id"
        ]
      },
      "Contato": {
        "type": "object",
        "required": [
          "id",
          "name",
          "email",
          "phone",
          "opted_in",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "opted_in": {
            "type": "boolean"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Pipeline": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "pipeline_type",
          "is_default",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "pipeline_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_default": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Etapa": {
        "type": "object",
        "required": [
          "id",
          "pipeline_id",
          "name",
          "position",
          "is_conclusion",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "pipeline_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer"
          },
          "is_conclusion": {
            "type": "boolean"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Negocio": {
        "type": "object",
        "required": [
          "id",
          "pipeline_id",
          "stage_id",
          "contact_id",
          "title",
          "value",
          "currency",
          "status",
          "expected_close_date",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "pipeline_id": {
            "type": "string",
            "format": "uuid"
          },
          "stage_id": {
            "type": "string",
            "format": "uuid"
          },
          "contact_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Valor decimal retornado como texto para preservar precisão."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "open",
              "won",
              "lost",
              null
            ]
          },
          "expected_close_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Segmento": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "description",
          "type",
          "source",
          "member_count",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "dynamic",
              "static"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "wake",
              "system"
            ]
          },
          "member_count": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TagCRM": {
        "type": "object",
        "required": [
          "id",
          "name",
          "color",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Conversa": {
        "type": "object",
        "required": [
          "id",
          "channel",
          "status",
          "contact_id",
          "team_id",
          "last_message_at",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "channel": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "contact_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "team_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "last_message_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MensagemAtendimento": {
        "type": "object",
        "required": [
          "id",
          "conversation_id",
          "sender",
          "body",
          "type",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "conversation_id": {
            "type": "string",
            "format": "uuid"
          },
          "sender": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ChamadaAtendimento": {
        "type": "object",
        "required": [
          "id",
          "contact",
          "occurred_at",
          "has_recording",
          "has_transcript"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "contact": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "has_recording": {
            "type": "boolean"
          },
          "has_transcript": {
            "type": "boolean"
          }
        }
      },
      "AgenteAtendimento": {
        "type": "object",
        "required": [
          "id",
          "name",
          "enabled",
          "language",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "language": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CriarContato": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254,
            "description": "O endereço é salvo em letras minúsculas."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32,
            "description": "Número com 8 a 15 dígitos. Aceita espaços, parênteses, hífens e sinal de mais no início."
          }
        },
        "additionalProperties": false
      },
      "AtualizarContato": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254,
            "description": "O endereço é salvo em letras minúsculas."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "phone": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 32,
            "description": "Número com 8 a 15 dígitos. Aceita espaços, parênteses, hífens e sinal de mais no início."
          }
        },
        "additionalProperties": false
      }
    },
    "responses": {
      "DadosInvalidos": {
        "description": "Campos obrigatórios ausentes ou inválidos, ou corpo malformado.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Erro"
            }
          }
        }
      },
      "CredencialInvalida": {
        "description": "Credencial ausente, inválida ou inativa.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Erro"
            },
            "example": {
              "error": "invalid_public_key"
            }
          }
        }
      },
      "OrigemNaoAutorizada": {
        "description": "Origem não autorizada para a conta.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Erro"
            },
            "example": {
              "error": "origin_not_allowed"
            }
          }
        }
      },
      "LimiteDeRequisicoes": {
        "description": "Limite de requisições atingido.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Erro"
            },
            "example": {
              "error": "rate_limited"
            }
          }
        }
      },
      "ErroInterno": {
        "description": "Falha ao processar a requisição.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Erro"
            }
          }
        }
      }
    }
  },
  "x-tagGroups": [
    {
      "name": "CRM",
      "tags": [
        "Contatos",
        "Empresas",
        "Pipelines",
        "Segmentos",
        "Tags"
      ]
    },
    {
      "name": "Atendimento",
      "tags": [
        "Conversas",
        "Chamadas",
        "Agentes de IA"
      ]
    },
    {
      "name": "On-site",
      "tags": [
        "Widgets On-site",
        "Pop-ups",
        "Banners",
        "Prova social",
        "Produtos recomendados",
        "Vitrines digitais",
        "Formulários",
        "Retorno de solicitações",
        "Avaliações",
        "Notificações push"
      ]
    },
    {
      "name": "Marketing e automação",
      "tags": [
        "E-mail marketing",
        "Campanhas",
        "Newsletter",
        "Modelos",
        "Automações"
      ]
    },
    {
      "name": "Dados da loja",
      "tags": [
        "Produtos",
        "Carrinhos abandonados",
        "Analytics",
        "Tracking"
      ]
    },
    {
      "name": "Instalação e privacidade",
      "tags": [
        "Instalação",
        "Privacidade"
      ]
    }
  ]
}
