{"openapi":"3.1.0","info":{"title":"API pública do PipeFácil","version":"1.0.0","description":"API REST do PipeFácil, autenticada por **chave de API** (`Authorization: Bearer pf_live_…`). A chave representa o membro que a criou: suas permissões, papel e visibilidade de registros se aplicam às requisições. O `workspaceId` vem sempre da chave, nunca da requisição. O limite é de 600 requisições por minuto, por workspace e por IP. Ao excedê-lo, a API responde `429`, com o cabeçalho `X-Rate-Limit-Retry-After-Seconds`.\nCrie e gerencie as chaves no aplicativo. Esta referência documenta as rotas sob `/api/v1` autenticadas por chave; a gestão de chaves, protegida por JWT, fica fora deste contrato."},"servers":[{"url":"https://pipefacil-server.matchsales.com.br","description":"Produção"},{"url":"https://homolog.pipefacil.matchsales.com.br","description":"Homologação"},{"url":"http://localhost:8080","description":"Local"}],"security":[{"ApiKeyAuth":[]}],"tags":[{"name":"Deals","description":"Crie, consulte e atualize negócios, etiquetas, notas, tarefas e atividades."},{"name":"Calendar","description":"Calendário unificado do workspace: reuniões, tarefas, etapas de cadência e eventos do Google Calendar do membro. Exige o recurso `CALENDAR` no workspace."},{"name":"Conversations","description":"Envie mensagens e consulte conversas e seus históricos. Exige `ADVANCED_API`, além de `API_ACCESS`, necessário para qualquer chave. Sem o recurso, as rotas deste grupo respondem `403 FEATURE_DISABLED`."},{"name":"Cadences","description":"Consulte cadências, seus negócios matriculados e o ciclo de matrícula de cada negócio. Exige **`CADENCE` e `ADVANCED_API`** no workspace. O acesso externo é contratado separadamente e vem desligado por padrão. A ausência de qualquer recurso resulta em `403 FEATURE_DISABLED`.\nA rota `tasks/{taskId}/execute` envia de fato uma mensagem por WhatsApp, um e-mail ou uma chamada externa e pode gerar cobrança no workspace. Envie a `idempotencyKey` obrigatória: repetir a mesma chave retorna `duplicated: true`, sem novo envio. As outras rotas alteram somente o estado da cadência."},{"name":"Automations","description":"Gerencie fluxos de automação e consulte o histórico de execução. Exige `ADVANCED_API` e `API_ACCESS`; sem o recurso, as rotas respondem `403 FEATURE_DISABLED`. O acesso por API é a operação externa das automações disponíveis no aplicativo.\nA leitura exige `automations.view`; alterações exigem `automations.edit`. Esta última permissão não pertence ao conjunto padrão de nenhum papel comum: conceda uma exceção explícita ao membro que precisa editar fluxos. Um fluxo ativo pode enviar mensagens aos clientes automaticamente.\nOs papéis privilegiados `owner`, `admin`, `partner` e `support` possuem todas as permissões na API. Assim, `partner` e `support` podem alterar automações por esta API, embora as rotas de escrita do aplicativo sejam restritas a `owner` e `admin`.\nNenhuma rota deste grupo inicia a execução de uma automação. `POST /{id}/test` não envia mensagens nem entrega o webhook: retorna o corpo assinado que a primeira ação de webhook enviaria. Exige `automations.edit`, pois usa o segredo real para calcular a assinatura.\nAs respostas de leitura removem segredos de webhook, inclusive nos logs e nas cópias da definição de uma execução. Quando uma criação ou atualização gera um segredo, a resposta o mostra uma única vez.\nLimitação: não há rota pública para listar `outboundChannelId` nem os identificadores `channelId`, `mediaAssetId` e `scriptId` das ações `send_whatsapp`. Obtenha esses identificadores fora desta referência. Funis, etapas, etiquetas, campos e usuários podem ser consultados em `/api/v1/pipelines`, `/tags`, `/custom-fields` e `/users`."},{"name":"Reference","description":"Contatos, empresas, funis, etapas, acesso, configuração de campos, motivos de perda, etiquetas e campos personalizados podem ser gerenciados pela API. Usuários são somente leitura; gerencie membros pelo aplicativo.\nQualquer chave válida pode ler funis. Alterações de funis exigem `settings.pipelines`. A leitura de contatos exige `contacts.view`; a de empresas, `companies.view`. Etiquetas e campos personalizados continuam disponíveis para leitura com qualquer chave válida.\nAs permissões pertencem ao membro que criou a chave. Os papéis privilegiados possuem todas elas; os demais membros seguem as permissões do papel e suas exceções individuais. Empresas usam `companies.view`, `companies.edit` e `companies.delete`, independentemente das permissões de negócios."}],"paths":{"/api/v1/deals":{"post":{"tags":["Deals"],"summary":"Criar negócio","description":"Cria um negócio no workspace da chave e retorna o registro criado.","operationId":"createDeal","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealResponseEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"get":{"tags":["Deals"],"summary":"Listar negócios","description":"Página de negócios visíveis ao membro da chave, ordenada pela criação mais recente. Sem status, inclui abertos, ganhos e perdidos. Mantenha os mesmos filtros ao reutilizar o cursor.","operationId":"listDeals","parameters":[{"name":"pipeline","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Número sequencial do funil dentro do workspace."},{"name":"stageId","in":"query","required":false,"schema":{"type":"string"}},{"name":"returning","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"createdFrom","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"yyyy-MM-dd"},{"name":"createdTo","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"yyyy-MM-dd"},{"name":"source","in":"query","required":false,"schema":{"type":"string"},"description":"Slug da origem do negócio, por exemplo, manual ou whatsapp."},{"name":"responsibleUserIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Pode ser repetido ou informado como lista separada por vírgulas."},{"name":"tagIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Pode ser repetido ou informado como lista separada por vírgulas."},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Busca por negócio, contato ou telefone."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Cursor opaco retornado pela página anterior."},{"name":"customFields[slug]","in":"query","required":false,"schema":{"type":"string"},"description":"Filtra pelo valor de um campo personalizado, usando o slug: `customFields[budget]=high`. O valor reservado `__empty__` inclui negócios sem preenchimento (campo ausente, nulo, texto vazio ou lista vazia). Pode ser combinado com outros valores, usando a regra OU."},{"name":"status","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["open","won","lost"]}},"description":"Situações do negócio. Repita o parâmetro ou separe os valores por vírgula. Omitido: todas as situações."},{"name":"customFieldRanges[slug][from]","in":"query","required":false,"schema":{"type":"string"},"description":"Limite inicial do intervalo de um campo de data. Substitua slug pela chave do campo."},{"name":"customFieldRanges[slug][to]","in":"query","required":false,"schema":{"type":"string"},"description":"Limite final do intervalo de um campo de data. Combine com o limite inicial ou envie apenas um limite."}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealListPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/custom-field-values":{"get":{"tags":["Deals"],"summary":"Listar valores de campos personalizados dos negócios","description":"Lista paginada de valores em linhas `(negócio, campo, valor)`, com o identificador do campo personalizado. Use esse identificador para relacionar os valores com `/api/v1/custom-fields`; o mapa `properties` dos negócios usa o slug. Inclui todos os status por padrão, enquanto `GET /api/v1/deals` lista somente negócios abertos. Campos `multi_select` geram uma linha por opção selecionada. `label` é preenchido apenas para tipos com opções. Um campo limpo ainda gera uma linha com `value` nulo; slugs sem definição correspondente são omitidos.","operationId":"listDealCustomFieldValues","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["open","won","lost"]}},"description":"Pode ser repetido. Omita para incluir todos os status."},{"name":"pipelineId","in":"query","required":false,"schema":{"type":"string"},"description":"Identificador do funil."},{"name":"updatedFrom","in":"query","required":false,"schema":{"type":"string"},"description":"Instante ISO ou yyyy-MM-dd. Inclui apenas negócios atualizados a partir desse momento; use para carga incremental."},{"name":"updatedTo","in":"query","required":false,"schema":{"type":"string"},"description":"Instante ISO ou yyyy-MM-dd. Limite final exclusivo."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200},"description":"Negócios por página, não linhas. Padrão: 50."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Cursor opaco retornado pela página anterior."}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCustomFieldValuePageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Número sequencial do negócio dentro do workspace."}],"get":{"tags":["Deals"],"summary":"Consultar negócio","description":"Retorna um negócio visível pelo seu número sequencial no workspace.","operationId":"getDeal","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealListItemEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Deals"],"summary":"Atualizar negócio","description":"Atualiza parcialmente o negócio e pode movê-lo entre etapas. Mover para uma etapa de perda exige um `lostReason` válido; mover para uma etapa de ganho encerra o negócio.","operationId":"updateDeal","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealResponseEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/tags":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Deals"],"summary":"Adicionar etiqueta ao negócio","description":"Adiciona uma etiqueta ao negócio de forma idempotente e retorna a etiqueta.","operationId":"addDealTag","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDealTagRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/tags/{tagId}":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"tagId","in":"path","required":true,"schema":{"type":"string"}}],"delete":{"tags":["Deals"],"summary":"Remover etiqueta do negócio","description":"Remove uma etiqueta do negócio. Retorna `404` se ela não estiver associada.","operationId":"removeDealTag","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"tagId":{"type":"string"}}},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/notes":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Deals"],"summary":"Criar nota do negócio","description":"Cria uma nota com autoria do membro da chave e registra uma atividade `NOTE_CREATED`. Informe `content`, `attachments` ou ambos. Exige `deals.edit`.","operationId":"createDealNote","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealNoteRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealNoteEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/notes/attachments":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Deals"],"summary":"Enviar anexo de nota do negócio","description":"Armazena um arquivo privado e retorna o comprovante para enviar em `attachments` na criação da nota. Exige `deals.edit`.","operationId":"uploadDealNoteAttachment","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FileUploadReceipt"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/StorageUnavailable"}}}},"/api/v1/deals/{seq}/tasks":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Deals"],"summary":"Criar tarefa do negócio","description":"Cria uma tarefa pendente vinculada ao negócio. Sem `assigneeUserId`, atribui a tarefa ao membro da chave; sem categoria, usa `outro`. Exige `tasks.create`.","operationId":"createDealTask","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealTaskRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/activities":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"get":{"tags":["Deals"],"summary":"Listar atividades do negócio","description":"Histórico de atividades paginado por cursor, dos registros mais recentes aos mais antigos. Valores desconhecidos nos filtros são ignorados.","operationId":"listDealActivities","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Filtro de tipo de atividade; pode ser repetido."},{"name":"actorType","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Filtro de tipo de autor; pode ser repetido."},{"name":"actorUserId","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealActivityPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/contacts":{"get":{"tags":["Reference"],"summary":"Listar contatos","description":"Lista de contatos visíveis ao membro da chave, paginada por cursor. Exige `contacts.view`.","operationId":"listContacts","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"blocked","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"internal","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"hasEmail","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"hasConversation","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"hasDeal","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Reference"],"summary":"Criar contato","description":"Cria um contato no workspace da chave. O telefone identifica o contato e é obrigatório. Exige `contacts.create`.","operationId":"createContact","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/contacts/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador do contato."}],"get":{"tags":["Reference"],"summary":"Consultar contato","description":"Retorna os detalhes do contato. Fora da visibilidade do membro, responde `404`. Exige `contacts.view`.","operationId":"getContact","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContactDetail"},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Reference"],"summary":"Atualizar contato","description":"Atualiza parcialmente um contato. Campos omitidos permanecem iguais; texto vazio limpa o valor. Exige `contacts.edit`.","operationId":"updateContact","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Reference"],"summary":"Excluir contato","description":"Anonimiza e exclui logicamente o contato, desvincula suas conversas e interrompe suas cadências. Preserva o histórico dos negócios. Exige `contacts.delete`.","operationId":"deleteContact","responses":{"204":{"description":"Sem conteúdo"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/contacts/{id}/avatar":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador do contato."}],"post":{"tags":["Reference"],"summary":"Enviar foto do contato","description":"Salva o arquivo multipart como foto do contato e retorna o contato atualizado. Exige `contacts.edit`.","operationId":"uploadContactAvatar","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"JPEG, PNG ou WebP, até 5 MB."}}}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContactDetail"},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/StorageUnavailable"}}},"delete":{"tags":["Reference"],"summary":"Remover foto do contato","description":"Remove a foto e retorna o contato atualizado. Operação idempotente. Exige `contacts.edit`.","operationId":"removeContactAvatar","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ContactDetail"},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/companies":{"get":{"tags":["Reference"],"summary":"Listar empresas","description":"Lista paginada de empresas do workspace. Exige `companies.view`.","operationId":"listCompanies","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":20,"maximum":100}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Reference"],"summary":"Criar empresa","description":"Cria uma empresa no workspace da chave e retorna o registro com um novo número sequencial. Exige `companies.edit`.","operationId":"createCompany","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCompanyRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Company"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/companies/{seq}":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Número sequencial da empresa dentro do workspace."}],"get":{"tags":["Reference"],"summary":"Consultar empresa","description":"Retorna uma empresa pelo número sequencial no workspace, incluindo a quantidade de negócios. Exige `companies.view`.","operationId":"getCompany","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Company"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Reference"],"summary":"Atualizar empresa","description":"Atualiza parcialmente uma empresa; campos omitidos permanecem iguais. Exige `companies.edit`.","operationId":"updateCompany","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCompanyRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Company"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Reference"],"summary":"Excluir empresa","description":"Exclui a empresa e remove sua associação dos negócios vinculados. Exige `companies.delete`.","operationId":"deleteCompany","responses":{"204":{"description":"Sem conteúdo"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines":{"get":{"tags":["Reference"],"summary":"Listar funis","description":"Funis ativos do workspace. Disponível para qualquer chave válida.","operationId":"listPipelines","responses":{"200":{"$ref":"#/components/responses/PipelineList"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Reference"],"summary":"Criar funil","description":"Cria um funil no workspace da chave e retorna suas etapas. Exige `settings.pipelines`.\n`stages` define as etapas **ativas**, em ordem. Quando omitido ou vazio, cria `Leads`, `Qualificação`, `Proposta`, `Negociação` e `Fechamento`. O sistema acrescenta as etapas finais `Ganho` e `Perda`. Não envie etapas finais nem `isWon`/`isLost`: a API responde `400`.\nO primeiro funil ativo torna-se o padrão do workspace. O limite de funis do plano se aplica; quando atingido, a API responde `409 QUOTA_EXCEEDED`. Qualquer `behaviors` exige `PIPELINE_BEHAVIORS`, ou a resposta será `400`.\nPara usar `attendance_queue`, crie o funil primeiro. Depois configure `behaviors` e `attendanceQueueStageId` em `PATCH /api/v1/pipelines/{seq}`, usando uma etapa do próprio funil.","operationId":"createPipeline","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePipelineRequest"},"example":{"name":"Pós-venda","description":"Clientes que já compraram","stages":[{"name":"Onboarding","color":"#3b82f6"},{"name":"Acompanhamento"}]}}}},"responses":{"201":{"$ref":"#/components/responses/PipelineCreated"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/archived":{"get":{"tags":["Reference"],"summary":"Listar funis arquivados","description":"Funis arquivados do workspace, ordenados pela atualização mais recente. Disponível para qualquer chave válida.","operationId":"listArchivedPipelines","responses":{"200":{"$ref":"#/components/responses/PipelineList"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/loss-reasons":{"put":{"tags":["Reference"],"summary":"Substituir motivos de perda","description":"Substitui o catálogo de motivos de perda do workspace. Aceita até 50 motivos, não vazios e com até 255 caracteres cada. Retorna a lista normalizada e salva. Exige `settings.pipelines`.","operationId":"replaceLossReasons","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["lossReasons"],"properties":{"lossReasons":{"type":"array","maxItems":50,"items":{"type":"string","minLength":1,"maxLength":255}}}},"example":{"lossReasons":["Sem orçamento","Sem aderência"]}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"}],"get":{"tags":["Reference"],"summary":"Consultar funil","description":"Retorna um funil ativo ou arquivado pelo número sequencial no workspace. Disponível para qualquer chave válida.","operationId":"getPipeline","responses":{"200":{"$ref":"#/components/responses/PipelineOk"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Reference"],"summary":"Atualizar funil","description":"Atualiza parcialmente o funil: campos ausentes permanecem iguais. `exitStageId` deve identificar uma etapa não final do próprio funil; caso contrário, responde `409`. `behaviors` substitui todo o conjunto e exige `PIPELINE_BEHAVIORS`. Exige `settings.pipelines`.","operationId":"updatePipeline","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePipelineRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/PipelineOk"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Reference"],"summary":"Arquivar funil","description":"Arquiva o funil. Responde `409` se ainda houver negócios abertos ou se for o único funil ativo. Exige `settings.pipelines`.","operationId":"archivePipeline","responses":{"204":{"description":"Sem conteúdo"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/unarchive":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"}],"post":{"tags":["Reference"],"summary":"Restaurar funil","description":"Restaura um funil arquivado e retorna o registro. Em um funil ativo, não altera o estado. O limite do plano se aplica: `409 QUOTA_EXCEEDED` quando atingido. Exige `settings.pipelines`.","operationId":"unarchivePipeline","responses":{"200":{"$ref":"#/components/responses/PipelineOk"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/access":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"}],"get":{"tags":["Reference"],"summary":"Listar regras de acesso ao funil","description":"Membros com acesso explícito ao funil. Lista vazia significa acesso para todos. Exige `settings.pipelines`.","operationId":"listPipelineAccess","responses":{"200":{"$ref":"#/components/responses/PipelineAccessList"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"put":{"tags":["Reference"],"summary":"Substituir regras de acesso ao funil","description":"Substitui toda a lista de usuários com acesso ao funil e retorna os membros salvos. Uma lista vazia remove a restrição. Exige `settings.pipelines`.","operationId":"replacePipelineAccess","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userIds"],"properties":{"userIds":{"type":"array","items":{"type":"string","minLength":1},"description":"Identificadores de usuários retornados por `GET /api/v1/users`."}}},"example":{"userIds":["ID_DO_USUARIO"]}}}},"responses":{"200":{"$ref":"#/components/responses/PipelineAccessList"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/stages":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"}],"post":{"tags":["Reference"],"summary":"Criar etapa do funil","description":"Acrescenta uma etapa ativa antes das etapas finais de ganho e perda e retorna o funil atualizado. `isWon`/`isLost` são definidos pelo sistema: enviá-los resulta em `400`. Exige `settings.pipelines`.","operationId":"createPipelineStage","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineStageRequest"}}}},"responses":{"201":{"$ref":"#/components/responses/PipelineCreated"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/stages/reorder":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"}],"patch":{"tags":["Reference"],"summary":"Reordenar etapas do funil","description":"Substitui a ordem das etapas ativas. `orderedStageIds` deve conter exatamente os identificadores das etapas ativas atuais; caso contrário, responde `409`. As etapas finais permanecem no fim. Exige `settings.pipelines`.","operationId":"reorderPipelineStages","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["orderedStageIds"],"properties":{"orderedStageIds":{"type":"array","items":{"type":"string","minLength":1}}}},"example":{"orderedStageIds":["ID_DA_ETAPA_1","ID_DA_ETAPA_2"]}}}},"responses":{"200":{"$ref":"#/components/responses/PipelineOk"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/stages/{stageId}":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"},{"name":"stageId","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da etapa (`stages[].id` do funil)."}],"patch":{"tags":["Reference"],"summary":"Atualizar etapa do funil","description":"Altera o nome, a cor ou a descrição de uma etapa e retorna o funil atualizado. Etapas finais não podem ser alteradas: a API responde `409`. Exige `settings.pipelines`.","operationId":"updatePipelineStage","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","example":"#6366f1"},"description":{"type":"string","maxLength":2000,"description":"Omitir mantém a descrição; um valor em branco a remove."}}},"example":{"name":"Proposta revisada"}}}},"responses":{"200":{"$ref":"#/components/responses/PipelineOk"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Reference"],"summary":"Excluir etapa do funil","description":"Exclui uma etapa ativa sem uso. Responde `409` para uma etapa final, com negócios vinculados ou definida como saída/fila de atendimento do funil. Remova primeiro essa configuração, quando aplicável. Exige `settings.pipelines`.","operationId":"deletePipelineStage","responses":{"204":{"description":"Sem conteúdo"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/fields":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"}],"get":{"tags":["Reference"],"summary":"Listar configuração de campos do funil","description":"Retorna como cada campo de negócio se comporta no funil, conforme a aba Campos do aplicativo. Os campos padrão (`value`, `name`, `email`, `phone`, `expectedCloseAt`) vêm primeiro; depois, os campos personalizados de negócio em ordem de exibição, inclusive os ocultos neste funil. Disponível para qualquer chave válida.","operationId":"listPipelineFields","responses":{"200":{"$ref":"#/components/responses/PipelineFieldSettingsList"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/pipelines/{seq}/fields/{field}":{"parameters":[{"$ref":"#/components/parameters/PipelineSeq"},{"name":"field","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador de campo personalizado de negócio (`GET /api/v1/custom-fields?entity=deal`) ou uma chave padrão: `value`, `name`, `email`, `phone`, `expectedCloseAt`."}],"get":{"tags":["Reference"],"summary":"Consultar configuração de campo do funil","description":"Retorna a configuração de um campo neste funil. Campo desconhecido resulta em `404`. Disponível para qualquer chave válida.","operationId":"getPipelineField","responses":{"200":{"$ref":"#/components/responses/PipelineFieldSettingsOk"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Reference"],"summary":"Atualizar configuração de campo do funil","description":"Adiciona, oculta ou configura a obrigatoriedade de um campo no funil e retorna o resultado. Todas as propriedades são opcionais; omitir preserva o valor atual. As listas de etapas substituem as regras **somente deste funil**. As regras de outros funis permanecem iguais. Todo identificador de etapa deve pertencer a este funil, ou a API responde `400`.\n\n- `isVisible: true` inclui o campo no funil; `false` o oculta. Campos personalizados existentes começam ocultos em um novo funil. Um novo campo também começa oculto nos funis existentes.\n- `requiredStageIds` define a obrigatoriedade validada pelo servidor. Criar ou mover um negócio para uma dessas etapas, ou uma etapa posterior, exige o preenchimento. Caso contrário, responde `422 UNPROCESSABLE_ENTITY`, com os campos ausentes em `fieldErrors`, tanto pelo aplicativo quanto pela API. Uma regra na etapa de perda vale somente nela. Movimentações por automação são isentas.\n- `isRequired` marca o campo como obrigatório no funil para os formulários do aplicativo. Sozinho, não impõe uma validação no servidor: use `requiredStageIds` para exigir o preenchimento também por API. `isRequired: true` e uma lista `requiredStageIds` não vazia são incompatíveis e resultam em `400`. Alterar `isRequired` sem enviar a lista limpa as etapas obrigatórias.\n- `visibilityOverrideStageIds` define as etapas que invertem `isVisible`. Alterar `isVisible` sem enviar essa lista limpa as exceções.\n- `isSuggested` e `suggestedStageIds` representam o nível sugerido. O aplicativo solicita o preenchimento ao mover o negócio para a etapa, mas permite pular. O servidor não o exige e a sugestão não se propaga às etapas posteriores. Obrigatório implica sugerido e visível: ativar `isRequired` também ativa `isSuggested` e `isVisible`. Uma etapa nas duas listas permanece apenas em `requiredStageIds`. Desativar `isRequired` sem enviar `isSuggested` desativa também a sugestão. Ocultar um campo que permanece sugerido ou obrigatório resulta em `400`; envie também `isSuggested: false` e `isRequired: false`. `isSuggested: true` e uma lista `suggestedStageIds` não vazia também são incompatíveis. Alterar `isSuggested` sem enviar a lista limpa as etapas sugeridas.\n\nCampos padrão aceitam somente `requiredStageIds` e `suggestedStageIds`; outras propriedades resultam em `400`. Exige `settings.pipelines`.","operationId":"updatePipelineField","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePipelineFieldSettingsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/PipelineFieldSettingsOk"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/tags":{"get":{"tags":["Reference"],"summary":"Listar etiquetas","description":"Todas as etiquetas do workspace, ordenadas por nome. Disponível para qualquer chave válida.","operationId":"listTags","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Tag"}},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Reference"],"summary":"Criar etiqueta","description":"Cria uma etiqueta no workspace da chave. Nome já utilizado resulta em `409`. Exige `settings.tags`.","operationId":"createTag","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Tag"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/tags/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da etiqueta."}],"get":{"tags":["Reference"],"summary":"Consultar etiqueta","description":"Retorna uma etiqueta do workspace. Uma etiqueta de outro workspace resulta em `404`. Disponível para qualquer chave válida.","operationId":"getTag","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Tag"},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Reference"],"summary":"Atualizar etiqueta","description":"Substitui o nome e a cor da etiqueta. Ambos são obrigatórios: o corpo usa o mesmo esquema da criação, e um corpo parcial resulta em `400`. Exige `settings.tags`.","operationId":"updateTag","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Tag"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Reference"],"summary":"Excluir etiqueta","description":"Exclui uma etiqueta do workspace da chave. Exige `settings.tags`.","operationId":"deleteTag","responses":{"204":{"description":"Sem conteúdo"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/custom-fields":{"get":{"tags":["Reference"],"summary":"Listar campos personalizados","description":"Definições dos campos personalizados, com filtros opcionais de entidade e funil. Disponível para qualquer chave válida.","operationId":"listCustomFields","parameters":[{"name":"entity","in":"query","required":false,"schema":{"type":"string"},"description":"Por exemplo, deal ou contact."},{"name":"pipelineId","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldDefinition"}},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Reference"],"summary":"Criar campo personalizado","description":"Cria a definição de um campo personalizado no workspace da chave. Exige `settings.custom_fields`.","operationId":"createCustomField","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomFieldRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CustomFieldDefinition"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/custom-fields/upload":{"post":{"tags":["Reference"],"summary":"Enviar arquivo de campo personalizado","description":"Envia um arquivo para um campo `file_upload` e retorna o comprovante de armazenamento. Depois, associe a `key` retornada à propriedade de um negócio. Disponível para qualquer chave válida: enviar o arquivo preenche um valor, sem alterar a definição do campo.","operationId":"uploadCustomFieldFile","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"Até 16 MB."}}}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FileUploadReceipt"},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"415":{"$ref":"#/components/responses/UnsupportedMediaType"},"429":{"$ref":"#/components/responses/TooManyRequests"},"503":{"$ref":"#/components/responses/StorageUnavailable"}}}},"/api/v1/custom-fields/file":{"get":{"tags":["Reference"],"summary":"Obter URL de arquivo de campo personalizado","description":"Confirma que a chave de armazenamento pertence ao workspace da chave de API e retorna uma URL assinada válida por uma hora. O cliente baixa o arquivo diretamente por essa URL. Disponível para qualquer chave válida.","operationId":"resolveCustomFieldFileUrl","parameters":[{"name":"key","in":"query","required":true,"schema":{"type":"string"},"description":"Chave de armazenamento do workspace retornada pelo envio."}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PresignedUrl"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/custom-fields/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador do campo personalizado."}],"get":{"tags":["Reference"],"summary":"Consultar campo personalizado","description":"Retorna a definição de um campo de qualquer entidade pelo identificador. Fora do workspace, responde `404`. Disponível para qualquer chave válida.","operationId":"getCustomField","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CustomFieldDefinition"},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Reference"],"summary":"Atualizar campo personalizado","description":"Atualiza parcialmente a definição de um campo e retorna o resultado. Exige `settings.custom_fields`.","operationId":"updateCustomField","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomFieldRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CustomFieldDefinition"},"message":{"type":"string","nullable":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Reference"],"summary":"Excluir campo personalizado","description":"Exclui a definição de um campo e remove seus valores dos negócios do workspace. Cada negócio afetado recebe uma atividade `custom_field_changed` com o registro da remoção. Exige `settings.custom_fields`.","operationId":"deleteCustomField","responses":{"204":{"description":"Sem conteúdo"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/users":{"get":{"tags":["Reference"],"summary":"Listar usuários","description":"Membros ativos do workspace que podem ser atribuídos como responsáveis.","operationId":"listUsers","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}}},"message":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/calendar/events":{"get":{"tags":["Calendar"],"summary":"Listar intervalo do calendário","description":"Retorna itens das fontes solicitadas no intervalo, ordenados pelo início, e o status de cada fonte. Fontes indisponíveis são indicadas em `sources[]` (`not_connected`, `not_authorized`, `error`, `truncated`), sem falhar toda a requisição.\n\n**Visibilidade.** A chave representa o membro que a criou. Quem só vê seus próprios dados recebe sua própria agenda; `memberId` é ignorado. Quem vê todos os dados pode consultar outro membro, exceto um administrador ou o proprietário do workspace. Solicitar explicitamente a agenda desses membros resulta em `403`; sem `memberId`, seus itens são omitidos. O proprietário pode acessar todas as agendas. Reuniões às quais o membro foi convidado são retornadas, independentemente do proprietário da reunião.\n\n**Limitação.** O limite de itens por fonte e o status de `sources[]` são calculados antes do filtro de visibilidade. Assim, eventos invisíveis podem contribuir para um erro de limite (`422`), e uma fonte inteiramente filtrada pode retornar `ok` e uma lista vazia.\n\n**Google Calendar.** A conexão é pessoal. Consultar a agenda de outro membro retorna apenas seus itens nativos, sem os eventos da conexão Google desse membro.","operationId":"listCalendarWindow","parameters":[{"name":"timeMin","in":"query","required":true,"schema":{"type":"string","format":"date-time"},"description":"Início da janela de consulta, em ISO 8601 e UTC."},{"name":"timeMax","in":"query","required":true,"schema":{"type":"string","format":"date-time"},"description":"Fim do intervalo em ISO 8601 UTC. Aceita até 400 dias após timeMin; acima disso, responde `400`."},{"name":"memberId","in":"query","required":false,"schema":{"type":"string"},"description":"Agenda de outro membro, pelo identificador de membro do workspace."},{"name":"provider","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["native","google"]}},"description":"Filtro de fontes; pode ser repetido."},{"name":"kind","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["meeting","task","cadence_task"]}},"description":"Filtro de tipos de item; pode ser repetido."}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarWindowEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Calendar"],"summary":"Criar reunião","description":"Cria uma reunião no calendário nativo com o membro da chave como proprietário. O proprietário nunca vem do corpo da requisição.\n`createConference` solicita um link do Google Meet e implica `syncToGoogle`. Ambas as opções exigem conexão Google com permissão de escrita. Se o Google falhar, a criação inteira falha. `recordWithBot` exige um link de conferência criado nesta chamada ou informado em `conferenceUrl`; o bot participa apenas do Google Meet ou Microsoft Teams.","operationId":"createCalendarEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCalendarEventRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/calendar/events/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador no formato provider:kind:id, por exemplo, native:meeting:5f2c…"}],"get":{"tags":["Calendar"],"summary":"Consultar reunião","description":"Retorna uma reunião nativa. Identificadores de tarefa, etapa de cadência ou evento Google resultam em `422`; um identificador malformado resulta em `400`.\n**Visibilidade.** O proprietário e os convidados podem consultar a reunião. Fora desses casos, um membro limitado aos próprios dados recebe `403`. Quem vê todos os dados pode consultar reuniões de outros membros, exceto as de administradores ou do proprietário do workspace. O proprietário do workspace pode acessar todas.","operationId":"getCalendarEvent","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"tags":["Calendar"],"summary":"Atualizar reunião","description":"Aplica somente os campos enviados. `start` e `end` são validados em conjunto com os valores salvos para impedir que a reunião termine antes de começar. Enviar `attendees` substitui toda a lista. Reuniões sincronizadas com o Google propagam a alteração; reuniões internas continuam internas. Somente `native:meeting` pode ser alterado nesta rota. Tarefas e etapas de cadência resultam em `422`.","operationId":"updateCalendarEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCalendarEventRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Calendar"],"summary":"Excluir reunião","description":"Remove a reunião do calendário nativo e do Google, quando sincronizada. Uma reunião já excluída no Google não impede o sucesso.","operationId":"deleteCalendarEvent","responses":{"204":{"description":"Sem conteúdo"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/conversations/messages":{"post":{"tags":["Conversations"],"summary":"Enviar mensagem","description":"Envia uma mensagem de WhatsApp pelo workspace da chave, com autoria do membro que a criou, e retorna a mensagem salva. `type` assume `text` por padrão. Informe `channelId` ou `senderPhoneNumberId` para escolher o canal; sem eles, usa o canal padrão do workspace.\nO caminho legado `POST /api/v1/messages` mantém o mesmo contrato e os mesmos requisitos. Novas integrações devem usar `/api/v1/conversations/messages`.","operationId":"sendMessage","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/conversations":{"get":{"tags":["Conversations"],"summary":"Listar conversas","description":"Lista conversas visíveis ao membro da chave, por cursor e em ordem de atividade mais recente. Um membro limitado aos próprios dados só acessa suas conversas. Exige `whatsapp.view_conversations`. Os filtros all, unread, returned e internal consultam conversas abertas; closed consulta as fechadas.","operationId":"listConversations","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":30}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Cursor opaco retornado pela página anterior."},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Busca sem diferenciar maiúsculas e minúsculas nos campos de contato e telefone."},{"name":"filter","in":"query","required":false,"schema":{"type":"string","enum":["all","unread","returned","internal","closed"],"default":"all"}},{"name":"responsibleId","in":"query","required":false,"schema":{"type":"string"},"description":"O negócio ativo do contato pertence a este identificador de usuário."},{"name":"pipelineId","in":"query","required":false,"schema":{"type":"string"},"description":"O negócio ativo do contato está neste identificador de funil."},{"name":"stageId","in":"query","required":false,"schema":{"type":"string"},"description":"O negócio ativo do contato está neste identificador de etapa."},{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["whatsapp","meta_lead_ad","manual","import","automation"]},"description":"O negócio ativo do contato tem esta origem. Valor desconhecido resulta em `400`."},{"name":"channelIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Identificadores dos canais de recebimento; repita o parâmetro ou separe por vírgulas."},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["recent","oldest"],"default":"recent"},"description":"Ordenação por atividade. Mantenha o mesmo valor ao percorrer páginas com cursor."}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationListPageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/conversations/{conversationKey}/messages":{"parameters":[{"name":"conversationKey","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da conversa ou telefone que permita localizá-la."}],"get":{"tags":["Conversations"],"summary":"Listar mensagens da conversa","description":"Retorna o histórico da conversa paginado por cursor. Uma conversa fora da visibilidade do membro resulta em `404`. Exige `whatsapp.view_conversations`.\n**Sem `since`**, pagina para trás a partir das mensagens mais recentes, para abrir uma conversa. **Com `since`**, pagina para frente a partir do instante informado, para acompanhamento contínuo. Os itens de cada página vêm em ordem cronológica nos dois modos.\nConsulte primeiro sem `since`. Depois, use em `since` o horário da última mensagem recebida. O limite é **inclusivo**: mensagens com esse mesmo horário podem repetir. Remova duplicatas pelo identificador da mensagem.\nAo percorrer várias páginas para frente, mantenha `since` junto de `cursor`. Um cursor enviado sem `since` volta ao modo de leitura para trás.","operationId":"listConversationMessages","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Cursor opaco retornado pela página anterior. Mantenha `since` ao paginar para frente."},{"name":"channelId","in":"query","required":false,"schema":{"type":"string"},"description":"Restringe o histórico a um único canal."},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Instante ISO 8601 UTC, por exemplo, 2026-08-25T03:14:00Z. Ativa a paginação para frente, com limite inclusivo. Uma data sem horário resulta em `400`."}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationMessagesPageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/cadences":{"get":{"tags":["Cadences"],"summary":"Listar cadências","description":"Catálogo de cadências do workspace, com funil, etapa e contadores de matrícula. Use o `id` retornado para matricular um negócio.","operationId":"listCadences","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CadenceListEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/cadences/{cadenceId}/enrollments":{"parameters":[{"name":"cadenceId","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da cadência."}],"get":{"tags":["Cadences"],"summary":"Listar matrículas da cadência","description":"Lista os leads matriculados por cursor. `status` aceita a situação da matrícula (`active`, `paused` e outras) ou o resultado (`won`, `lost`). `day`, `step` e `at` filtram uma posição da régua: `at=reached` inclui quem passou por ela; `at=ended`, quem terminou exatamente nela.","operationId":"listCadenceEnrollments","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"day","in":"query","required":false,"schema":{"type":"integer"}},{"name":"step","in":"query","required":false,"schema":{"type":"integer"}},{"name":"at","in":"query","required":false,"schema":{"type":"string","enum":["reached","ended"]}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CadenceEnrollmentPageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Número sequencial do negócio dentro do workspace."}],"get":{"tags":["Cadences"],"summary":"Consultar cadência do negócio","description":"Retorna a instância de cadência do negócio e suas tarefas.","operationId":"getDealCadence","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCadenceInstanceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/enroll":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Cadences"],"summary":"Matricular negócio em cadência","description":"Matricula um negócio em uma cadência ativa de seu funil. Pode começar em um dia específico; dias anteriores não geram atividades. Substitui a cadência anterior do negócio.","operationId":"enrollDealCadence","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollDealCadenceRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCadenceInstanceEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/unenroll":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Cadences"],"summary":"Remover negócio da cadência","description":"Interrompe a instância de cadência do negócio, cancela suas tarefas abertas e retorna a instância parada.","operationId":"unenrollDealCadence","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCadenceInstanceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/pause":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Cadences"],"summary":"Pausar cadência do negócio","description":"Pausa a instância de cadência do negócio. Sem corpo, usa o motivo padrão.","operationId":"pauseDealCadence","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PauseDealCadenceRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCadenceInstanceEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/resume":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Cadences"],"summary":"Retomar cadência do negócio","description":"Retoma a instância de cadência e retorna o resultado.","operationId":"resumeDealCadence","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCadenceInstanceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/start":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"post":{"tags":["Cadences"],"summary":"Iniciar cadência do negócio","description":"Inicia a instância de cadência e retorna o resultado.","operationId":"startDealCadence","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCadenceInstanceEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/tasks/{taskId}/execute":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da tarefa de cadência."}],"post":{"tags":["Cadences"],"summary":"Executar tarefa de cadência","description":"Envia a tarefa ao provedor do canal e retorna o resultado. **Esta operação envia de fato** WhatsApp, e-mail ou chamada externa e pode gerar cobrança no workspace. `idempotencyKey` é obrigatória; repetir a mesma chave retorna `duplicated: true`, sem novo envio.","operationId":"executeCadenceTask","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteTaskRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskExecutionEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/tasks/{taskId}/skip":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da tarefa de cadência."}],"post":{"tags":["Cadences"],"summary":"Pular tarefa de cadência","description":"Pula uma tarefa de cadência. Altera apenas o estado da tarefa, sem envio ao canal.","operationId":"skipCadenceTask","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkipTaskRequest"}}}},"responses":{"204":{"description":"Sem conteúdo"},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/cadence/tasks/{taskId}/complete-manual":{"parameters":[{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"taskId","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da tarefa de cadência."}],"post":{"tags":["Cadences"],"summary":"Concluir tarefa de cadência manualmente","description":"Marca a tarefa como concluída manualmente e retorna o resultado. Altera apenas o estado, sem envio ao canal.","operationId":"completeCadenceTaskManually","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskExecutionEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations":{"get":{"tags":["Automations"],"summary":"Listar automações","description":"Retorna todas as automações do workspace, das mais recentes às mais antigas. Não usa paginação. Os filtros são opcionais e combinados; valores desconhecidos de `scope` ou `triggerType` são ignorados.","operationId":"listAutomations","parameters":[{"name":"pipelineId","in":"query","required":false,"schema":{"type":"string"}},{"name":"stageId","in":"query","required":false,"schema":{"type":"string"}},{"name":"scope","in":"query","required":false,"schema":{"type":"string","enum":["global","pipeline","stage"]}},{"name":"triggerType","in":"query","required":false,"schema":{"type":"string"}},{"name":"enabled","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationListEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Automations"],"summary":"Criar automação","description":"Cria um fluxo a partir de `graphDefinition`, cuja `version` deve ser `2`. Valida todo o grafo antes de salvar e retorna os problemas encontrados em conjunto. Omitir `enabled` cria a automação **ativa**, pronta para reagir ao gatilho. Uma ação de webhook sem `secret` recebe um segredo gerado, mostrado uma única vez nesta resposta. Exige `automations.edit`.","operationId":"createAutomation","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationRequest"}}}},"responses":{"201":{"description":"Criado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/triggers":{"get":{"tags":["Automations"],"summary":"Listar catálogo de gatilhos","description":"Retorna os gatilhos aceitos, agrupados por categoria, e os caminhos de campos válidos para condições. Consulte o catálogo antes de definir `triggerType` e os nós de condição de um fluxo.","operationId":"listAutomationTriggers","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationTriggerCatalogEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."}],"get":{"tags":["Automations"],"summary":"Consultar automação","description":"Retorna uma automação com seu grafo e suas ações. Remove os segredos de webhook das configurações de ações, nós e gatilho.","operationId":"getAutomation","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"put":{"tags":["Automations"],"summary":"Substituir automação","description":"Substitui toda a definição. Campos ausentes são redefinidos, as ações recebem novos identificadores e `version` é incrementada. A exceção é `enabled`: omitir preserva o estado atual. Para alterar somente o estado, use `PATCH /{id}/enabled`. Exige `automations.edit`.","operationId":"replaceAutomation","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationRequest"}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"tags":["Automations"],"summary":"Excluir automação","description":"Exclui permanentemente a automação, sem restauração, e cancela execuções agendadas pendentes. Para preservar o fluxo, desative-o. Exige `automations.edit`.","operationId":"deleteAutomation","responses":{"204":{"description":"Sem conteúdo"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}/enabled":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."}],"patch":{"tags":["Automations"],"summary":"Ativar ou desativar automação","description":"Altera somente `enabled`, preservando definição, versão e identificadores de ações. Desativar faz execuções na fila ou em espera serem ignoradas quando chega sua vez, mas não as cancela. Reativar antes do prazo permite a continuação. O corpo deve informar `enabled`; repetir a mesma requisição mantém o estado solicitado. Operação idempotente. Exige `automations.edit`.","operationId":"setAutomationEnabled","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]},"example":{"enabled":false}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}/test":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."}],"post":{"tags":["Automations"],"summary":"Pré-visualizar entrega de webhook","description":"**Não envia nada.** Retorna URL, cabeçalhos e corpo que a primeira ação de webhook entregaria para um evento de exemplo `deal.stage_changed`, com uma assinatura real `X-PipeFacil-Signature-256` calculada pelo segredo atual. Use para verificar o receptor. Exige `automations.edit`, pois utiliza o segredo. Sem uma ação de webhook, responde `422`.","operationId":"testAutomation","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationTestEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}/logs":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."}],"get":{"tags":["Automations"],"summary":"Listar logs da automação","description":"Logs dos nós executados, por cursor e dos mais recentes aos mais antigos. Cada entrada inclui `input` e `output`, permitindo entender o caminho escolhido. Os segredos são removidos em todos os níveis. `limit` padrão: 20; máximo: 100.","operationId":"listAutomationLogs","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationLogPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}/deliveries":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."}],"get":{"tags":["Automations"],"summary":"Listar entregas de webhook","description":"Tentativas de entrega das ações de webhook, paginadas por cursor, com status HTTP e último erro. Não retorna o corpo da requisição nem o da resposta. `limit` padrão: 20; máximo: 50.","operationId":"listAutomationDeliveries","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["queued","sent","failed","dead_letter"]}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDeliveryPageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}/runs":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."}],"get":{"tags":["Automations"],"summary":"Listar execuções da automação","description":"Execuções paginadas por cursor, das mais recentes às mais antigas. Um `status` desconhecido resulta em `400`. Em uma execução `waiting`, o prazo é `nextAttemptAt`; `waitingForReply` distingue a espera por resposta da espera por tempo. `limit` padrão: 20; máximo: 100.","operationId":"listAutomationRuns","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["queued","running","waiting","completed","failed","dead_letter","skipped","cancelled"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunPageEnvelope"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/automations/{id}/runs/{runId}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da automação."},{"name":"runId","in":"path","required":true,"schema":{"type":"string"},"description":"Identificador da execução da automação."}],"get":{"tags":["Automations"],"summary":"Consultar execução da automação","description":"Retorna a execução completa: a definição preservada no momento do disparo, o estado de cada nó e as etapas executadas com entradas e saídas. Essa cópia permite entender uma execução mesmo após alterações no fluxo. Remove segredos em todos os níveis. Uma execução de outra automação resulta em `404`.","operationId":"getAutomationRun","responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunDetailEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/activities":{"get":{"tags":["Deals"],"summary":"Listar atividades do workspace","description":"Página de atividades dos negócios visíveis ao membro da chave, pela mais recente. Os filtros de tipo e ator podem ser repetidos ou separados por vírgula.","operationId":"listWorkspaceActivities","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Filtro de tipo de atividade; pode ser repetido."},{"name":"actorType","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"description":"Filtro de tipo de autor; pode ser repetido."},{"name":"actorUserId","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealActivityPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/messages":{"get":{"tags":["Deals"],"operationId":"listDealMessages","summary":"Listar mensagens do negócio","description":"Consulta o histórico de mensagens do contato vinculado ao negócio, respeitando a visibilidade do membro.","parameters":[{"name":"seq","in":"path","required":true,"description":"Sequência do negócio neste workspace.","schema":{"type":"integer","minimum":1}},{"name":"limit","in":"query","required":false,"description":"Tamanho da página.","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"Cursor opaco da página anterior.","schema":{"type":"string"}}],"responses":{"200":{"description":"Operação concluída.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationMessagesPageEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/v1/deals/{seq}/properties/{slug}/file":{"get":{"tags":["Deals"],"operationId":"getDealPropertyFile","summary":"Obter arquivo de um campo do negócio","description":"Retorna o descritor do arquivo e uma URL de download válida por 24 horas, quando a assinatura do armazenamento estiver disponível. Não transfere os bytes do arquivo. Sem arquivo preenchido, retorna 404.","parameters":[{"name":"seq","in":"path","required":true,"description":"Sequência do negócio neste workspace.","schema":{"type":"integer","minimum":1}},{"name":"slug","in":"path","required":true,"description":"Slug de um campo personalizado do tipo arquivo.","schema":{"type":"string"}}],"responses":{"200":{"description":"Operação concluída.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealPropertyFileEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Deals"],"operationId":"uploadDealPropertyFile","summary":"Enviar e vincular arquivo ao negócio","description":"Envia o arquivo e grava seu descritor no campo do negócio. Exige permissão de editar negócios e um campo do tipo arquivo.","parameters":[{"name":"seq","in":"path","required":true,"description":"Sequência do negócio neste workspace.","schema":{"type":"integer","minimum":1}},{"name":"slug","in":"path","required":true,"description":"Slug de um campo personalizado do tipo arquivo.","schema":{"type":"string"}}],"responses":{"201":{"description":"Operação concluída.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadReceiptEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"Arquivo a enviar.","format":"binary"}}}}}}}},"/api/v1/users/{id}":{"get":{"tags":["Reference"],"operationId":"getUser","summary":"Consultar membro","description":"Retorna os dados de um usuário que é membro ativo deste workspace.","parameters":[{"name":"id","in":"path","required":true,"description":"ID do usuário, não o ID da associação ao workspace.","schema":{"type":"string"}}],"responses":{"200":{"description":"Operação concluída.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicUserEnvelope"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","description":"Chave de API criada no aplicativo. Envie como `Authorization: Bearer pf_live_…`."}},"parameters":{"PipelineSeq":{"name":"seq","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Número sequencial do funil no workspace (`seq`)."}},"responses":{"PipelineOk":{"description":"Sucesso: funil com todas as etapas.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Pipeline"},"message":{"type":"string","nullable":true}}}}}},"PipelineCreated":{"description":"Criado: funil com todas as etapas.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Pipeline"},"message":{"type":"string","nullable":true}}}}}},"PipelineList":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Pipeline"}},"message":{"type":"string","nullable":true}}}}}},"PipelineAccessList":{"description":"Sucesso: membros com acesso explícito; lista vazia permite acesso para todos.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true,"description":"URL da foto."}}}},"message":{"type":"string","nullable":true}}}}}},"PipelineFieldSettingsList":{"description":"Sucesso: campos padrão primeiro, seguidos dos campos personalizados de negócio em ordem de exibição.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PipelineFieldSettings"}},"message":{"type":"string","nullable":true}}}}}},"PipelineFieldSettingsOk":{"description":"Sucesso","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PipelineFieldSettings"},"message":{"type":"string","nullable":true}}}}}},"Unauthorized":{"description":"Chave ausente, malformada, desconhecida, revogada ou expirada, ou membro emissor inativo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"ValidationError":{"description":"Falha de validação dos campos; `fieldErrors` contém os erros.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"BadRequest":{"description":"Requisição malformada ou parâmetro inválido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"Forbidden":{"description":"Autenticado, mas sem acesso: falta de permissão (`FORBIDDEN`), recurso desligado no workspace (`FEATURE_DISABLED`) ou tentativa de acessar uma agenda não permitida.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"NotFound":{"description":"Recurso não encontrado ou fora da visibilidade do membro.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"UnprocessableEntity":{"description":"Requisição válida que o recurso não pode atender, por exemplo, um identificador de calendário que não representa uma reunião nativa.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"PayloadTooLarge":{"description":"Arquivo acima do limite da rota: 5 MB para foto de contato ou 16 MB para arquivo de campo personalizado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"UnsupportedMediaType":{"description":"Arquivo vazio ou tipo de mídia não aceito pela rota.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"StorageUnavailable":{"description":"O armazenamento recusou a operação ou excedeu o tempo de resposta. O arquivo não foi enviado; a operação pode ser repetida.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"Conflict":{"description":"Conflito de estado, como um negócio aberto duplicado para o contato/funil, ou limite do plano atingido (`QUOTA_EXCEEDED`), como na criação de um funil além da cota.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"TooManyRequests":{"description":"Limite de requisições excedido por workspace ou IP.","headers":{"X-Rate-Limit-Retry-After-Seconds":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"schemas":{"ApiError":{"type":"object","description":"Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.","properties":{"error":{"type":"string"},"code":{"type":"string","enum":["BAD_REQUEST","VALIDATION_ERROR","UNAUTHORIZED","FORBIDDEN","FEATURE_DISABLED","NOT_FOUND","CONFLICT","QUOTA_EXCEEDED","UNPROCESSABLE_ENTITY","INTERNAL_ERROR","SERVICE_UNAVAILABLE"]},"requestId":{"type":"string"},"details":{"type":"string","nullable":true},"fieldErrors":{"type":"array","nullable":true,"items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}}}},"required":["error","code","requestId"]},"DealResponseEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealResponse"},"message":{"type":"string","nullable":true}}},"DealListItemEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealListItem"},"message":{"type":"string","nullable":true}}},"DealListPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DealListItem"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"DealCustomFieldValue":{"type":"object","properties":{"dealId":{"type":"string"},"fieldId":{"type":"string","description":"Identificador da definição do campo; use para relacionar com /api/v1/custom-fields."},"fieldSlug":{"type":"string"},"value":{"nullable":true,"description":"Valor salvo: texto, número, booleano ou descritor {key,name,size,mimeType} de arquivo."},"label":{"type":"string","nullable":true,"description":"Rótulo legível da opção; nulo para tipos sem opções."},"updatedAt":{"type":"string","format":"date-time","description":"updatedAt do negócio, usado pelo cursor e pela deduplicação incremental."}}},"DealCustomFieldValuePageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DealCustomFieldValue"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"DealActivityPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DealActivity"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"TagEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Tag"},"message":{"type":"string","nullable":true}}},"DealNoteEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"dealId":{"type":"string"},"content":{"type":"string"},"authorMemberId":{"type":"string","nullable":true},"authorName":{"type":"string","nullable":true},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","format":"int64"}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"message":{"type":"string","nullable":true}}},"TaskEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"dealId":{"type":"string","nullable":true},"assignee":{"$ref":"#/components/schemas/TaskUser"},"creator":{"$ref":"#/components/schemas/TaskUser"},"category":{"type":"string","description":"Chave legada; use categoryId/categoryName."},"categoryId":{"type":"string"},"categoryName":{"type":"string"},"categoryColor":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","done"]},"dueAt":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"message":{"type":"string","nullable":true}}},"TaskUser":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"role":{"type":"string","nullable":true}}},"ContactListPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"CompanyPageEnvelope":{"type":"object","description":"Formato de página Spring Data.","properties":{"data":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/Company"}},"totalElements":{"type":"integer"},"totalPages":{"type":"integer"},"number":{"type":"integer"},"size":{"type":"integer"},"first":{"type":"boolean"},"last":{"type":"boolean"},"numberOfElements":{"type":"integer"},"empty":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"CreateDealRequest":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"nullable":true},"phone":{"type":"string","description":"Telefone do contato, opcional. Sem telefone, o negócio pode não ter contato; um nome ou e-mail permite criar um contato sem telefone.","nullable":true},"contactName":{"type":"string","maxLength":255,"nullable":true,"description":"Nome completo do contato, dividido no primeiro espaço em firstName/lastName. Ignorado quando contactFirstName ou contactLastName é enviado."},"contactFirstName":{"type":"string","maxLength":255,"nullable":true},"contactLastName":{"type":"string","maxLength":255,"nullable":true},"email":{"type":"string","format":"email","maxLength":255,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true},"value":{"type":"number","minimum":0,"nullable":true},"closeProbability":{"type":"integer","minimum":0,"maximum":100,"nullable":true},"expectedCloseAt":{"type":"string","format":"date-time","nullable":true},"currency":{"type":"string","maxLength":3,"nullable":true,"description":"Padrão: BRL."},"stageId":{"type":"string","nullable":true,"description":"Padrão: primeira etapa do funil."},"companyId":{"type":"string","nullable":true},"channelId":{"type":"string","nullable":true},"responsibleUserId":{"type":"string","nullable":true},"useAssignmentStrategy":{"type":"boolean","nullable":true},"customFields":{"type":"object","nullable":true,"additionalProperties":true},"company":{"allOf":[{"$ref":"#/components/schemas/CreateCompanyRequest"}],"nullable":true},"tracking":{"allOf":[{"$ref":"#/components/schemas/DealTracking"}],"nullable":true},"metadata":{"type":"object","nullable":true,"additionalProperties":true,"description":"Metadados adicionais do negócio."}},"example":{"name":"Proposta de consultoria","contactFirstName":"Ana","contactLastName":"Silva","email":"ana@example.com","value":1500,"currency":"BRL"}},"UpdateDealRequest":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"nullable":true},"value":{"type":"number","minimum":0,"nullable":true},"currency":{"type":"string","maxLength":3,"nullable":true},"closeProbability":{"type":"integer","minimum":0,"maximum":100,"nullable":true},"expectedCloseAt":{"type":"string","format":"date-time","nullable":true},"stageId":{"type":"string","nullable":true},"companyId":{"type":"string","nullable":true},"responsibleUserId":{"type":"string","nullable":true},"coOwnerUserId":{"type":"string","nullable":true},"lostReason":{"type":"string","maxLength":255,"nullable":true,"description":"Obrigatório ao mover para uma etapa de perda."},"notes":{"type":"string","maxLength":2000,"nullable":true},"tagIds":{"type":"array","items":{"type":"string"},"nullable":true},"customFields":{"type":"object","additionalProperties":true,"nullable":true},"contact":{"type":"object","nullable":true,"additionalProperties":true,"description":"Campos opcionais do contato para atualizar junto com o negócio."},"tracking":{"allOf":[{"$ref":"#/components/schemas/DealTracking"}],"nullable":true}},"example":{"notes":"Contato pediu uma proposta revisada."}},"AddDealTagRequest":{"type":"object","required":["tagId"],"properties":{"tagId":{"type":"string"}},"example":{"tagId":"ID_DA_TAG"}},"CreateDealNoteRequest":{"type":"object","description":"Texto, ao menos um comprovante de anexo, ou ambos.","properties":{"content":{"type":"string","maxLength":10000,"nullable":true},"attachments":{"type":"array","maxItems":10,"nullable":true,"description":"Comprovantes retornados por `POST /api/v1/deals/{seq}/notes/attachments`, enviados sem alterações.","items":{"$ref":"#/components/schemas/FileUploadReceipt"}}},"example":{"content":"Cliente pediu retorno na próxima semana."}},"CreateDealTaskRequest":{"type":"object","required":["title","dueAt"],"properties":{"title":{"type":"string","maxLength":500},"dueAt":{"type":"string","format":"date-time","description":"Instante ISO 8601, por exemplo, 2026-10-05T13:00:00Z."},"assigneeUserId":{"type":"string","nullable":true,"description":"Identificador de membro ativo (consulte /api/v1/users). Padrão: membro da chave."},"categoryId":{"type":"string","nullable":true,"description":"Identificador de categoria do workspace ou chave de sistema. Tem prioridade sobre category."},"category":{"type":"string","nullable":true,"enum":["ligacao","reuniao","follow_up","email","outro"],"description":"Chave de categoria do sistema. Padrão: outro."},"description":{"type":"string","maxLength":2000,"nullable":true}},"example":{"title":"Retornar proposta","dueAt":"2026-10-06T14:00:00Z","category":"follow_up"}},"CreateContactRequest":{"type":"object","required":["phone"],"properties":{"phone":{"type":"string","maxLength":30,"pattern":"^[0-9+()\\-\\s]*$","description":"Identidade do contato. Obrigatória na criação."},"customName":{"type":"string","maxLength":255,"nullable":true,"deprecated":true,"description":"Aceito por compatibilidade. Dividido no primeiro espaço em firstName/lastName. Ignorado quando firstName ou lastName é enviado."},"firstName":{"type":"string","maxLength":255,"nullable":true},"lastName":{"type":"string","maxLength":255,"nullable":true},"email":{"type":"string","format":"email","maxLength":255,"nullable":true},"instagramUsername":{"type":"string","nullable":true,"pattern":"^(@?[A-Za-z0-9._]{1,30})?$","description":"Nome de usuário sem o @ inicial; o valor enviado é normalizado."},"notes":{"type":"string","maxLength":2000,"nullable":true},"isInternal":{"type":"boolean","nullable":true}},"example":{"firstName":"Ana","lastName":"Silva","phone":"5511999999999","email":"ana@example.com"}},"UpdateContactRequest":{"type":"object","description":"Todos os campos são opcionais. Omitir preserva o valor; `\"\"` limpa o campo.","properties":{"phone":{"type":"string","maxLength":30,"pattern":"^[0-9+()\\-\\s]*$","nullable":true},"customName":{"type":"string","maxLength":255,"nullable":true,"deprecated":true,"description":"Aceito por compatibilidade. Dividido no primeiro espaço em firstName/lastName. Ignorado quando firstName ou lastName é enviado."},"firstName":{"type":"string","maxLength":255,"nullable":true},"lastName":{"type":"string","maxLength":255,"nullable":true},"email":{"type":"string","format":"email","maxLength":255,"nullable":true},"instagramUsername":{"type":"string","pattern":"^(@?[A-Za-z0-9._]{1,30})?$","nullable":true},"blocked":{"type":"boolean","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true},"isInternal":{"type":"boolean","nullable":true}},"example":{"firstName":"Ana","lastName":"Silva"}},"CreateCompanyRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255},"domain":{"type":"string","maxLength":255,"nullable":true},"cnpj":{"type":"string","maxLength":30,"nullable":true},"industry":{"type":"string","maxLength":255,"nullable":true},"website":{"type":"string","maxLength":500,"nullable":true},"logoUrl":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"example":{"name":"Empresa Exemplo"}},"UpdateCompanyRequest":{"type":"object","description":"Todos os campos são opcionais; campos omitidos permanecem iguais.","properties":{"name":{"type":"string","minLength":1,"maxLength":255,"nullable":true},"domain":{"type":"string","maxLength":255,"nullable":true},"cnpj":{"type":"string","maxLength":30,"nullable":true},"industry":{"type":"string","maxLength":255,"nullable":true},"website":{"type":"string","maxLength":500,"nullable":true},"logoUrl":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"example":{"industry":"Consultoria"}},"TagRequest":{"type":"object","description":"Usado para criar e atualizar. A atualização substitui os valores: ambos os campos são obrigatórios nas duas operações.","required":["name","color"],"properties":{"name":{"type":"string","maxLength":80},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"}},"example":{"name":"Prioridade","color":"#2563eb"}},"CreateCustomFieldRequest":{"type":"object","required":["name","fieldType"],"properties":{"name":{"type":"string","maxLength":255},"slug":{"type":"string","maxLength":255,"nullable":true,"description":"Gerado a partir do nome quando omitido."},"description":{"type":"string","maxLength":1000,"nullable":true},"placeholder":{"type":"string","maxLength":255,"nullable":true,"description":"Texto de exemplo exibido no campo vazio do aplicativo. Apenas visual; não é salvo como valor."},"fieldType":{"type":"string","enum":["text","textarea","number","currency","boolean","date","datetime","select","multi_select","url","email","phone","file_upload","members","event"],"description":"`members` apresenta os membros atuais do workspace; o valor salvo é um `userId`, e `options` enviado é descartado. `event` armazena data e hora e cria uma reunião na agenda do responsável, conforme `config.event`. Alterar o campo move a reunião; limpar o campo a exclui. Mover ou excluir a reunião no calendário ou no Google atualiza ou limpa o campo. Disponível apenas para campos de negócio."},"options":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":true},"description":"Obrigatório para tipos com opções (`select`, `multi_select`). Ignorado para `members`."},"config":{"type":"object","additionalProperties":true,"nullable":true,"description":"Configuração por tipo de campo. Para event, informe event com título, duração e configuração da reunião. member_field usa fieldSlug para ler um membro a partir de um campo members do lead.","properties":{"event":{"$ref":"#/components/schemas/EventFieldConfig"}}},"isRequired":{"type":"boolean","nullable":true},"apiOnly":{"type":"boolean","nullable":true,"description":"Quando verdadeiro, os valores do campo no negócio só podem ser alterados pela API pública; o aplicativo exibe o campo como somente leitura."},"displayOrder":{"type":"integer","minimum":0,"nullable":true},"section":{"type":"string","maxLength":255,"nullable":true},"entityType":{"type":"string","maxLength":50,"nullable":true,"description":"Padrão: `deal`."},"visibilityRule":{"allOf":[{"$ref":"#/components/schemas/CustomFieldVisibilityRule"}],"nullable":true}},"example":{"name":"Segmento","fieldType":"text"}},"UpdateCustomFieldRequest":{"type":"object","description":"Todos os campos são opcionais. Tipo, slug e entidade são imutáveis após a criação e não são aceitos nesta atualização.","properties":{"name":{"type":"string","minLength":1,"maxLength":255,"nullable":true},"description":{"type":"string","maxLength":1000,"nullable":true},"placeholder":{"type":"string","maxLength":255,"nullable":true,"description":"Omitir ou enviar nulo preserva o valor atual; texto em branco limpa o campo."},"options":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":true}},"config":{"type":"object","additionalProperties":true,"nullable":true,"properties":{"event":{"$ref":"#/components/schemas/EventFieldConfig"}},"description":"Configuração por tipo de campo. Para event, informe event com título, duração e configuração da reunião. member_field usa fieldSlug para ler um membro a partir de um campo members do lead."},"isRequired":{"type":"boolean","nullable":true},"apiOnly":{"type":"boolean","nullable":true,"description":"Define se os valores dos negócios só podem ser alterados por /api/v1."},"displayOrder":{"type":"integer","minimum":0,"nullable":true},"section":{"type":"string","maxLength":255,"nullable":true},"visibilityRule":{"allOf":[{"$ref":"#/components/schemas/CustomFieldVisibilityRule"}],"nullable":true,"description":"Substitui a regra. Omitir ou enviar nulo preserva a regra atual."},"clearVisibilityRule":{"type":"boolean","nullable":true,"description":"Quando verdadeiro, remove a regra de visibilidade. Não envie junto com visibilityRule: isso resulta em 422."}},"example":{"placeholder":"Informe o segmento da empresa"}},"CustomFieldVisibilityRule":{"type":"object","required":["parentFieldId","values"],"description":"Campo condicional (mostrar somente quando): o campo aparece e suas exigências se aplicam quando o valor do campo pai está em `values` e todas as regras dos antecessores também correspondem. A regra depende do valor, mesmo se o pai estiver oculto no funil ou na etapa. O pai deve ser `select`, `multi_select` (qualquer opção em comum corresponde) ou `boolean` (`\"true\"`/`\"false\"`) da mesma entidade. A cadeia não pode ter ciclos nem exceder 10 níveis. Valores de campos ocultos são preservados. Excluir o pai ou remover todas as opções usadas pela regra remove a condição.","properties":{"parentFieldId":{"type":"string"},"values":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string"}}}},"DealResponse":{"type":"object","description":"Negócio resumido retornado na criação ou atualização.","properties":{"id":{"type":"string"},"seq":{"type":"integer"},"name":{"type":"string"},"contactId":{"type":"string","nullable":true},"responsibleUserId":{"type":"string"},"companyId":{"type":"string","nullable":true},"pipelineId":{"type":"string"},"stageId":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"closeProbability":{"type":"integer"},"source":{"type":"string"},"status":{"type":"string","description":"open | won | lost"},"coOwnerUserId":{"type":"string","nullable":true},"expectedCloseAt":{"type":"string","format":"date-time","nullable":true},"stageChangedAt":{"type":"string","format":"date-time"},"closedAt":{"type":"string","format":"date-time","nullable":true},"lostReason":{"type":"string","nullable":true},"customFields":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"tracking":{"allOf":[{"$ref":"#/components/schemas/DealTracking"}],"nullable":true}}},"DealListItem":{"type":"object","description":"Negócio detalhado retornado na listagem ou consulta, com relações associadas.","properties":{"id":{"type":"string"},"seq":{"type":"integer"},"name":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"closeProbability":{"type":"integer"},"source":{"type":"string"},"status":{"type":"string"},"isReturning":{"type":"boolean"},"pipelineId":{"type":"string"},"stageId":{"type":"string"},"responsibleUserId":{"type":"string"},"coOwnerUserId":{"type":"string","nullable":true},"lostReason":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"daysInStage":{"type":"integer"},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string"}}}},"responsible":{"$ref":"#/components/schemas/DealMember"},"coOwner":{"allOf":[{"$ref":"#/components/schemas/DealMember"}],"nullable":true},"activeChannels":{"type":"array","items":{"type":"object","additionalProperties":true}},"lastMessageAt":{"type":"string","format":"date-time","nullable":true},"lastMessageText":{"type":"string"},"replyPending":{"type":"boolean"},"properties":{"type":"object","additionalProperties":true,"description":"Valores resolvidos dos campos personalizados."},"channel":{"type":"object","additionalProperties":true,"nullable":true},"channelOverride":{"type":"object","additionalProperties":true,"nullable":true},"expectedCloseAt":{"type":"string","format":"date-time","nullable":true},"stageChangedAt":{"type":"string","format":"date-time"},"closedAt":{"type":"string","format":"date-time","nullable":true},"returnSignaledAt":{"type":"string","format":"date-time","nullable":true},"contact":{"type":"object","additionalProperties":true,"nullable":true},"stage":{"type":"object","additionalProperties":true,"nullable":true},"company":{"type":"object","additionalProperties":true,"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"tracking":{"allOf":[{"$ref":"#/components/schemas/DealTracking"}],"nullable":true},"lostFromStage":{"allOf":[{"$ref":"#/components/schemas/DealLostFromStage"}],"nullable":true},"taskSummary":{"allOf":[{"$ref":"#/components/schemas/DealTaskSummary"}],"nullable":true,"description":"Resumo de tarefas quando habilitado na configuração do card."},"lastActivity":{"allOf":[{"$ref":"#/components/schemas/DealTimelineItem"}],"nullable":true,"description":"Última atividade quando habilitada na configuração do card."}}},"DealMember":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string","nullable":true}}},"DealActivity":{"type":"object","properties":{"id":{"type":"string"},"dealId":{"type":"string"},"type":{"type":"string"},"field":{"type":"string","nullable":true},"changes":{"type":"object","additionalProperties":true,"nullable":true},"metadata":{"type":"object","additionalProperties":true,"nullable":true},"occurredAt":{"type":"string","format":"date-time"},"actor":{"type":"object","additionalProperties":true,"description":"Resumo do autor: usuário ou sistema."}}},"Tag":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Contact":{"type":"object","properties":{"id":{"type":"string"},"seq":{"type":"integer"},"phone":{"type":"string"},"name":{"type":"string","nullable":true},"customName":{"type":"string","nullable":true,"description":"Nome completo editável, calculado a partir de firstName + lastName."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"blocked":{"type":"boolean"},"isInternal":{"type":"boolean"},"lastMessageAt":{"type":"string","format":"date-time","nullable":true},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"instagramUsername":{"type":"string","nullable":true}}},"ContactDetail":{"type":"object","description":"Item da listagem acrescido dos campos de detalhe: notas, recusa de mensagens e último envio de marketing.","properties":{"id":{"type":"string"},"seq":{"type":"integer"},"phone":{"type":"string"},"name":{"type":"string","nullable":true},"customName":{"type":"string","nullable":true,"description":"Nome completo editável, calculado a partir de firstName + lastName."},"firstName":{"type":"string","nullable":true},"lastName":{"type":"string","nullable":true},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"instagramUsername":{"type":"string","nullable":true},"blocked":{"type":"boolean"},"isInternal":{"type":"boolean"},"notes":{"type":"string","nullable":true},"optedOutAt":{"type":"string","format":"date-time","nullable":true},"optedOutKeyword":{"type":"string","nullable":true},"optedOutSource":{"type":"string","nullable":true},"lastMarketingAt":{"type":"string","format":"date-time","nullable":true},"lastMessageAt":{"type":"string","format":"date-time","nullable":true},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"FileUploadReceipt":{"type":"object","description":"Comprovante do envio de arquivo; associe `key` ao valor de um campo `file_upload`.","properties":{"key":{"type":"string"},"name":{"type":"string"},"size":{"type":"integer","format":"int64"},"mimeType":{"type":"string"}}},"PresignedUrl":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}}},"Company":{"type":"object","properties":{"id":{"type":"string"},"seq":{"type":"integer"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"cnpj":{"type":"string","nullable":true},"industry":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"dealCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Pipeline":{"type":"object","properties":{"id":{"type":"string"},"seq":{"type":"integer","description":"Número sequencial no workspace usado em `/api/v1/pipelines/{seq}`."},"position":{"type":"integer","description":"Ordem de exibição entre os funis ativos."},"name":{"type":"string"},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"isArchived":{"type":"boolean"},"exitStageId":{"type":"string","nullable":true},"pipelineType":{"type":"string","enum":["standard","recurring_clients"],"deprecated":true,"description":"Derivado de `behaviors`; mantido por compatibilidade."},"behaviors":{"type":"array","items":{"$ref":"#/components/schemas/PipelineBehavior"}},"attendanceQueueStageId":{"type":"string","nullable":true},"stages":{"type":"array","description":"Etapas em ordem: ativas primeiro, seguidas das etapas finais de ganho e perda.","items":{"$ref":"#/components/schemas/PipelineStage"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"PipelineStage":{"type":"object","properties":{"id":{"type":"string","description":"Identificador da etapa usado em `stageId` na API, por exemplo, em `POST /api/v1/deals`."},"seq":{"type":"integer"},"order":{"type":"integer"},"name":{"type":"string"},"color":{"type":"string","example":"#6366f1"},"description":{"type":"string","nullable":true,"description":"Condição esperada para o negócio estar nesta etapa. Usada como contexto pela CIA."},"isWon":{"type":"boolean"},"isLost":{"type":"boolean"},"isRequired":{"type":"boolean"},"requiredMilestoneFieldId":{"type":"string","nullable":true},"dealCount":{"type":"integer","format":"int64"}}},"PipelineBehavior":{"type":"string","enum":["recurring_clients","multi_channel_pipeline","attendance_queue"],"description":"Comportamento opcional do funil. Exige `PIPELINE_BEHAVIORS` no workspace."},"PipelineStageRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","example":"#6366f1","description":"Cor hexadecimal. Padrão: `#6366f1`."},"description":{"type":"string","nullable":true,"maxLength":2000,"description":"Opcional. Condição esperada para o negócio estar nesta etapa; usada como contexto pela CIA."}},"example":{"name":"Proposta","color":"#2563eb"}},"CreatePipelineRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","nullable":true,"maxLength":2000,"description":"Opcional. Objetivo do funil; usado como contexto pela CIA."},"stages":{"type":"array","nullable":true,"description":"Etapas ativas em ordem. Omitir ou enviar lista vazia cria as etapas padrão. O sistema acrescenta as etapas de ganho e perda.","items":{"$ref":"#/components/schemas/PipelineStageRequest"}},"behaviors":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/PipelineBehavior"},"description":"Não configure `attendance_queue` na criação: exige uma etapa do próprio funil. Configure por `PATCH` depois de criar."},"pipelineType":{"type":"string","nullable":true,"deprecated":true,"enum":["standard","recurring_clients"],"description":"Entrada legada, ignorada. Configure behaviors para definir o comportamento do funil."},"attendanceQueueStageId":{"type":"string","description":"A fila exige uma etapa já existente neste funil. Configure após a criação, com PATCH e behaviors.","nullable":true}},"example":{"name":"Vendas","description":"Qualificação e fechamento de novas oportunidades."}},"UpdatePipelineRequest":{"type":"object","description":"Todos os campos são opcionais; campos ausentes permanecem iguais.","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","nullable":true,"maxLength":2000,"description":"Omitir ou enviar `null` preserva a descrição; texto em branco a remove."},"isDefault":{"type":"boolean","description":"`true` define este funil como padrão do workspace."},"exitStageId":{"type":"string","description":"Etapa não final deste funil."},"behaviors":{"type":"array","items":{"$ref":"#/components/schemas/PipelineBehavior"},"description":"Substitui todo o conjunto."},"attendanceQueueStageId":{"type":"string","description":"Etapa não final do próprio funil. Adiciona `attendance_queue` a `behaviors`. Um valor em branco limpa a configuração e remove o comportamento."},"pipelineType":{"type":"string","nullable":true,"deprecated":true,"enum":["standard","recurring_clients"],"description":"Entrada legada, ignorada. Configure behaviors para definir o comportamento do funil."}},"example":{"description":"Funil de novas oportunidades."}},"PipelineFieldSettings":{"type":"object","description":"Configuração de um campo de negócio neste funil. Os identificadores seguem a ordem das etapas do funil.","properties":{"field":{"type":"string","description":"ID do campo personalizado ou chave do campo padrão."},"kind":{"type":"string","enum":["standard","custom"]},"name":{"type":"string"},"slug":{"type":"string","nullable":true,"description":"Chave do valor em `customFields` do negócio; `null` para campo padrão."},"isVisible":{"type":"boolean","nullable":true,"description":"Indica se o campo aparece no funil. `null` para campo padrão."},"isRequired":{"type":"boolean","nullable":true,"description":"Sinaliza obrigatoriedade nos formulários do aplicativo, sem validação do servidor por si só. `null` para campo padrão."},"requiredStageIds":{"type":"array","items":{"type":"string"},"description":"Etapas a partir das quais o campo é obrigatório no servidor. Lista vazia quando não há exigência."},"visibilityOverrideStageIds":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Etapas que invertem `isVisible`. `null` para campo padrão."},"isSuggested":{"type":"boolean","nullable":true,"description":"Sinaliza sugestão nos formulários do aplicativo em toda movimentação, com opção de pular. Sem exigência no servidor. Sempre `true` quando `isRequired` é verdadeiro. `null` para campo padrão."},"suggestedStageIds":{"type":"array","items":{"type":"string"},"description":"Etapas onde o aplicativo sugere o preenchimento, com opção de pular e sem propagação. Não repete etapas de `requiredStageIds`. Lista vazia quando não há sugestão."}}},"UpdatePipelineFieldSettingsRequest":{"type":"object","description":"Todas as propriedades são opcionais; omitir preserva o valor atual.","properties":{"isVisible":{"type":"boolean","description":"Somente campos personalizados."},"isRequired":{"type":"boolean","description":"Somente campos personalizados. Não impõe exigência no servidor; consulte `requiredStageIds`. Incompatível com uma lista `requiredStageIds` não vazia; alterar limpa a lista, a menos que ela seja enviada."},"requiredStageIds":{"type":"array","maxItems":200,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Substitui as etapas deste funil que exigem o campo. `[]` limpa a lista."},"visibilityOverrideStageIds":{"type":"array","maxItems":200,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Somente campos personalizados. Substitui as etapas que invertem `isVisible` neste funil."},"isSuggested":{"type":"boolean","description":"Somente campos personalizados. Sem exigência no servidor. Incompatível com uma lista suggestedStageIds não vazia. Alterar limpa a lista, salvo quando enviada. É verdadeiro enquanto isRequired for verdadeiro; desligar isRequired desliga a sugestão, a menos que isSuggested seja enviado."},"suggestedStageIds":{"type":"array","maxItems":200,"items":{"type":"string","minLength":1,"maxLength":100},"description":"Substitui as etapas deste funil que sugerem o preenchimento. `[]` limpa a lista. Etapas também presentes em requiredStageIds permanecem apenas como obrigatórias."}},"example":{"isVisible":true,"requiredStageIds":["stage-id-of-proposal"]}},"CustomFieldDefinition":{"type":"object","properties":{"id":{"type":"string"},"entityType":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"placeholder":{"type":"string","nullable":true,"description":"Texto de exemplo exibido no campo vazio."},"fieldType":{"type":"string"},"options":{"type":"array","nullable":true,"description":"Opções de seleção. Em `select` e `multi_select`, ficam na definição. Em `members`, são calculadas a partir dos membros do workspace a cada leitura; `value` é o `userId` do membro.","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"},"color":{"type":"string","nullable":true},"image":{"type":"string","nullable":true,"description":"URL da foto. Somente para `members`."},"inactive":{"type":"boolean","description":"Somente para `members`. Verdadeiro para membro desativado. Ele permanece na lista para resolver nomes de valores anteriores. Não o ofereça para novas escolhas nem altere valores já salvos por causa dessa marcação."}},"additionalProperties":true}},"config":{"type":"object","additionalProperties":true,"nullable":true,"properties":{"event":{"$ref":"#/components/schemas/EventFieldConfig"}},"description":"Configuração por tipo de campo. Para event, informe event com título, duração e configuração da reunião. member_field usa fieldSlug para ler um membro a partir de um campo members do lead."},"isRequired":{"type":"boolean"},"apiOnly":{"type":"boolean","description":"Valores dos negócios são somente leitura no aplicativo e podem ser alterados por /api/v1."},"displayOrder":{"type":"integer"},"section":{"type":"string","nullable":true},"pipelineConfig":{"type":"object","additionalProperties":true,"nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"visibilityRule":{"allOf":[{"$ref":"#/components/schemas/CustomFieldVisibilityRule"}],"nullable":true}}},"Member":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string","description":"Papel do membro no workspace, por exemplo owner.","admin":null,"sdr.":null},"id":{"type":"string","description":"ID do vínculo de membro no workspace. userId identifica o usuário."}}},"CalendarWindowEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CalendarEvent"}},"sources":{"type":"array","items":{"$ref":"#/components/schemas/CalendarSourceStatus"}}}},"message":{"type":"string","nullable":true}}},"CalendarEventEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/CalendarEvent"},"message":{"type":"string","nullable":true}}},"EventDateTime":{"type":"object","description":"Mesmo formato do Google Calendar: `date` para dia inteiro ou `dateTime` para instante ISO 8601. Nunca envie ambos.","properties":{"date":{"type":"string","format":"date","nullable":true,"description":"Data no formato YYYY-MM-DD para eventos de dia inteiro."},"dateTime":{"type":"string","format":"date-time","nullable":true},"timeZone":{"type":"string","nullable":true,"description":"Fuso IANA. Padrão: fuso do workspace."}},"example":{"dateTime":"2026-10-06T14:00:00-03:00","timeZone":"America/Sao_Paulo"}},"CalendarSourceStatus":{"type":"object","description":"Resultado de cada fonte. Uma fonte indisponível é informada aqui, sem falhar toda a requisição.","properties":{"provider":{"type":"string","enum":["native","google"]},"kind":{"type":"string","enum":["meeting","task","cadence_task"]},"status":{"type":"string","enum":["ok","not_connected","not_authorized","truncated","error"]},"message":{"type":"string","nullable":true}}},"CalendarAttendee":{"type":"object","properties":{"type":{"type":"string","enum":["member","contact"]},"member":{"allOf":[{"$ref":"#/components/schemas/CalendarMember"}],"nullable":true},"contact":{"allOf":[{"$ref":"#/components/schemas/CalendarContact"}],"nullable":true},"removed":{"type":"boolean","description":"A identidade não existe mais; o convidado continua no histórico."},"responseStatus":{"type":"string","enum":["needs_action","accepted","declined","tentative"]},"organizer":{"type":"boolean"},"optional":{"type":"boolean"}},"description":"Convidado da reunião. type determina qual resumo vem preenchido: member ou contact."},"CalendarEvent":{"type":"object","description":"Formato único do calendário, utilizado por todos os itens, independentemente da fonte.","properties":{"id":{"type":"string","description":"provider:kind:id, por exemplo, native:meeting:5f2c…"},"provider":{"type":"string","enum":["native","google"]},"kind":{"type":"string","enum":["meeting","task","cadence_task"]},"readOnly":{"type":"boolean","description":"Não pode ser alterado por esta API; somente reuniões nativas permitem escrita."},"status":{"type":"string","description":"confirmed, tentative, cancelled."},"summary":{"type":"string"},"description":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"start":{"$ref":"#/components/schemas/EventDateTime"},"end":{"$ref":"#/components/schemas/EventDateTime"},"attendees":{"type":"array","items":{"$ref":"#/components/schemas/CalendarAttendee"}},"owner":{"allOf":[{"$ref":"#/components/schemas/Member"}],"nullable":true,"description":"Nulo quando o membro proprietário saiu do workspace."},"extendedProperties":{"type":"object","additionalProperties":true,"nullable":true},"conferenceUrl":{"type":"string","nullable":true,"description":"Link da reunião, independentemente de sua origem."},"botEnabled":{"type":"boolean","description":"O bot de gravação está configurado para esta reunião."},"botStatus":{"type":"string","nullable":true,"description":"Último estado informado pelo bot."},"created":{"type":"string","format":"date-time","nullable":true},"updated":{"type":"string","format":"date-time","nullable":true}}},"CreateCalendarEventRequest":{"type":"object","required":["summary","start","end"],"properties":{"summary":{"type":"string","maxLength":255},"description":{"type":"string","nullable":true},"location":{"type":"string","maxLength":500,"nullable":true},"start":{"$ref":"#/components/schemas/EventDateTime"},"end":{"$ref":"#/components/schemas/EventDateTime"},"allDay":{"type":"boolean","nullable":true},"status":{"type":"string","nullable":true,"description":"confirmed (padrão), tentative, cancelled."},"attendees":{"type":"array","nullable":true,"description":"Cada entrada usa { type: member, memberId } ou { type: contact, contactId }. Identificador desconhecido resulta em `400`.","items":{"$ref":"#/components/schemas/CalendarAttendeeRequest"}},"extendedProperties":{"type":"object","additionalProperties":true,"nullable":true},"syncToGoogle":{"type":"boolean","nullable":true,"description":"Sincroniza a reunião no Google Calendar do proprietário. Exige conexão com permissão de escrita."},"createConference":{"type":"boolean","nullable":true,"description":"Solicita um link do Google Meet. Implica syncToGoogle."},"recordWithBot":{"type":"boolean","nullable":true,"description":"Solicita gravação pelo bot. Requer link de Google Meet ou Microsoft Teams; caso contrário, retorna 400."},"conferenceUrl":{"type":"string","maxLength":1000,"nullable":true,"description":"Link de reunião existente, quando não estiver criando uma conferência. Para gravação pelo bot, use Google Meet ou Microsoft Teams."}},"example":{"summary":"Apresentação da proposta","start":{"dateTime":"2026-10-06T14:00:00-03:00","timeZone":"America/Sao_Paulo"},"end":{"dateTime":"2026-10-06T14:30:00-03:00","timeZone":"America/Sao_Paulo"},"allDay":false}},"UpdateCalendarEventRequest":{"type":"object","description":"Aplica apenas os campos enviados. Enviar attendees substitui toda a lista.","properties":{"summary":{"type":"string","maxLength":255,"nullable":true},"description":{"type":"string","nullable":true},"location":{"type":"string","maxLength":500,"nullable":true},"start":{"allOf":[{"$ref":"#/components/schemas/EventDateTime"}],"nullable":true},"end":{"allOf":[{"$ref":"#/components/schemas/EventDateTime"}],"nullable":true},"allDay":{"type":"boolean","nullable":true},"status":{"type":"string","nullable":true},"attendees":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/CalendarAttendeeRequest"}},"extendedProperties":{"type":"object","additionalProperties":true,"nullable":true},"recordWithBot":{"type":"boolean","nullable":true},"conferenceUrl":{"type":"string","maxLength":1000,"nullable":true}},"example":{"summary":"Apresentação da proposta revisada"}},"SendMessageRequest":{"type":"object","required":["to"],"properties":{"to":{"type":"string","description":"Telefone do destinatário em E.164 ou no formato normalizado do workspace."},"type":{"type":"string","default":"text","description":"text, image, audio, video, document, template, …","nullable":true},"text":{"type":"string","nullable":true},"senderPhoneNumberId":{"type":"string","nullable":true,"description":"Identificador do número de telefone do canal no provedor."},"channelId":{"type":"string","nullable":true,"description":"Identificador do canal de envio; tem prioridade sobre senderPhoneNumberId."},"mediaAssetId":{"type":"string","nullable":true,"description":"Identificador de mídia já armazenada no workspace."},"mediaLink":{"type":"string","nullable":true,"description":"URL pública usada pelo provedor para baixar a mídia."},"caption":{"type":"string","nullable":true},"filename":{"type":"string","nullable":true},"mimeType":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"templateLanguageCode":{"type":"string","nullable":true},"templateComponents":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":true}},"quotedMessageId":{"type":"string","nullable":true,"description":"Mensagem à qual se está respondendo."},"voice":{"type":"boolean","nullable":true,"description":"Somente áudio. Padrão: true, para entregar como mensagem de voz (ícone de microfone e forma de onda). Envie false para entregar como arquivo de áudio."}},"example":{"to":"5511999999999","type":"text","text":"Olá, Ana. Podemos conversar sobre a proposta?","channelId":"ID_DO_CANAL"}},"SendMessageEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SendMessageResponse"},"message":{"type":"string"}}},"SendMessageResponse":{"type":"object","properties":{"id":{"type":"string"},"conversationId":{"type":"string"},"channelId":{"type":"string"},"externalId":{"type":"string","nullable":true,"description":"Identificador da mensagem no provedor; nulo até a aceitação pelo provedor."},"direction":{"type":"string","enum":["inbound","outbound"]},"type":{"type":"string"},"status":{"type":"string"},"body":{"type":"string"},"errorMessage":{"type":"string","nullable":true},"timestamp":{"type":"string","format":"date-time"}}},"ConversationListPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ConversationSummary"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}}}},"ConversationSummary":{"type":"object","properties":{"id":{"type":"string"},"waId":{"type":"string"},"sendTo":{"type":"string"},"displayName":{"type":"string"},"phone":{"type":"string"},"contactId":{"type":"string","nullable":true},"channelId":{"type":"string","nullable":true},"channelName":{"type":"string","nullable":true},"lastMessageAt":{"type":"string","format":"date-time","nullable":true},"lastMessageText":{"type":"string"},"lastMessageDirection":{"type":"string","enum":["inbound","outbound"],"nullable":true},"lastInboundAt":{"type":"string","format":"date-time","nullable":true,"description":"Última mensagem recebida do contato, agregada entre canais. Não use este valor para concluir que a janela de 24 horas está aberta em outro canal."},"unreadCount":{"type":"integer"},"returning":{"type":"boolean"},"internal":{"type":"boolean"},"activeDealSeq":{"type":"integer","nullable":true,"description":"Número sequencial do negócio aberto mais recente do contato."},"responsibleUserId":{"type":"string","nullable":true,"description":"Responsável por esse negócio ativo."},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"contactInstagramId":{"type":"string","nullable":true,"description":"Destino técnico do Instagram, no formato ig:<IGSID>, quando existir."},"avatarUrl":{"type":"string","nullable":true},"provider":{"type":"string","nullable":true},"lastMessageChannelId":{"type":"string","nullable":true},"lastMessageProvider":{"type":"string","nullable":true},"closed":{"type":"boolean","description":"Indica se a conversa está fechada."}}},"ConversationMessagesPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ConversationMessage"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}}}},"ConversationMessage":{"type":"object","properties":{"id":{"type":"string"},"conversationId":{"type":"string"},"channelId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"direction":{"type":"string","enum":["inbound","outbound"]},"senderPhone":{"type":"string","nullable":true},"recipientPhone":{"type":"string","nullable":true},"body":{"type":"string"},"previewText":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"read":{"type":"boolean"},"timestamp":{"type":"string","format":"date-time"},"statusTimestamp":{"type":"string","format":"date-time","nullable":true},"errorMessage":{"type":"string","nullable":true},"quotedText":{"type":"string","nullable":true},"quotedDirection":{"type":"string","enum":["inbound","outbound"],"nullable":true},"quotedMessageId":{"type":"string","nullable":true},"quotedType":{"type":"string","nullable":true},"quotedMedia":{"allOf":[{"$ref":"#/components/schemas/ConversationMessageMedia"}],"nullable":true},"sentByUserId":{"type":"string","nullable":true},"origin":{"type":"string","nullable":true,"description":"Origem da mensagem: api, app, automation, agent ou outra."},"originLabel":{"type":"string","nullable":true},"media":{"allOf":[{"$ref":"#/components/schemas/ConversationMessageMedia"}],"nullable":true},"content":{"type":"object","additionalProperties":true,"nullable":true,"description":"Dados estruturados de tipos sem corpo de texto, como anúncio de origem, localização, cartão de contato ou alvo de reação."},"createdAt":{"type":"string","format":"date-time"},"editedAt":{"type":"string","nullable":true,"format":"date-time"},"deletedAt":{"type":"string","nullable":true,"format":"date-time","description":"Data da exclusão. O conteúdo pode permanecer no histórico de auditoria; a integração decide como exibi-lo."}}},"ConversationMessageMedia":{"type":"object","properties":{"mediaAssetId":{"type":"string","nullable":true},"status":{"type":"string","nullable":true,"description":"Estado de ingestão da mídia armazenada."},"mediaType":{"type":"string"},"contentType":{"type":"string","nullable":true},"caption":{"type":"string","nullable":true},"filename":{"type":"string","nullable":true},"sizeBytes":{"type":"integer","format":"int64","nullable":true},"durationMs":{"type":"integer","nullable":true},"width":{"type":"integer","nullable":true},"height":{"type":"integer","nullable":true},"providerMediaId":{"type":"string","nullable":true},"providerMediaUrl":{"type":"string","nullable":true},"contentUrl":{"type":"string","nullable":true,"description":"URL relativa para baixar o arquivo. Nula enquanto a mídia não estiver READY. A cópia do provedor para o armazenamento é assíncrona."}}},"EnrollDealCadenceRequest":{"type":"object","required":["cadenceId"],"properties":{"cadenceId":{"type":"string","description":"Identificador de uma cadência ativa do funil do negócio."},"startDay":{"type":"integer","minimum":0,"nullable":true,"description":"Dia inicial da cadência. Dias anteriores não geram atividades. Use para matricular um lead que já avançou na rotina. Omitir começa pelo início."}},"example":{"cadenceId":"ID_DA_CADENCIA"}},"PauseDealCadenceRequest":{"type":"object","properties":{"reason":{"type":"string","maxLength":255,"nullable":true,"description":"Motivo em texto livre. Sem corpo, pausa com o motivo padrão."}},"example":{"reason":"Aguardando retorno do contato"}},"SkipTaskRequest":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","maxLength":255,"description":"Motivo para pular a tarefa."}},"example":{"reason":"Atividade tratada por outro canal"}},"ExecuteTaskRequest":{"type":"object","required":["idempotencyKey"],"properties":{"idempotencyKey":{"type":"string","maxLength":120,"description":"Chave escolhida pelo cliente para repetir o envio com segurança. Repetir a mesma chave retorna `duplicated: true`, sem novo envio. Informe-a em toda chamada, inclusive na primeira tentativa."},"message":{"type":"string","maxLength":4000,"nullable":true,"description":"Corpo de uma etapa de WhatsApp."},"subject":{"type":"string","maxLength":160,"nullable":true,"description":"Assunto de uma etapa de e-mail."},"htmlBody":{"type":"string","maxLength":10000,"nullable":true,"description":"Corpo HTML de uma etapa de e-mail."},"textBody":{"type":"string","maxLength":4000,"nullable":true,"description":"Corpo em texto simples de uma etapa de e-mail."},"manualReferenceId":{"type":"string","maxLength":120,"nullable":true,"description":"Referência da tentativa definida pelo cliente."}},"example":{"idempotencyKey":"envio-negocio-123-tarefa-456-v1","message":"Olá, Ana. Podemos retomar a proposta?"}},"CadenceListEnvelope":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CadenceListItem"}},"message":{"type":"string","nullable":true}}},"CadenceListItem":{"type":"object","properties":{"id":{"type":"string"},"pipelineId":{"type":"string"},"pipelineSeq":{"type":"integer"},"pipelineName":{"type":"string"},"kind":{"type":"string","description":"entry | stage_playbook"},"stageId":{"type":"string","nullable":true},"stageName":{"type":"string","nullable":true},"stageColor":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"activeVersion":{"type":"integer"},"trigger":{"type":"string","description":"Forma de início da cadência."},"stepCount":{"type":"integer"},"dayCount":{"type":"integer"},"channels":{"type":"array","items":{"type":"string","enum":["whatsapp","voice_call","email","research"]}},"steps":{"type":"array","description":"Atividades da rotina em ordem, com dia, canal e descrição. Presentes na própria listagem para consultar a rotina sem uma requisição de detalhe por cadência.","items":{"$ref":"#/components/schemas/PipelineCadenceStep"}},"enrolledCount":{"type":"integer","nullable":true},"overdueCount":{"type":"integer","nullable":true},"wonCount":{"type":"integer","nullable":true},"lostCount":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CadenceEnrollmentPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CadenceEnrollmentItem"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"CadenceEnrollmentItem":{"type":"object","properties":{"enrollmentId":{"type":"string"},"dealId":{"type":"string"},"dealSeq":{"type":"integer","deprecated":true,"description":"Obsoleto. Identifique o negócio por `dealId`."},"dealName":{"type":"string"},"responsibleUserId":{"type":"string"},"responsibleName":{"type":"string","nullable":true},"trackType":{"type":"string","enum":["entry","stage_playbook","none"]},"stageId":{"type":"string","nullable":true},"status":{"type":"string","description":"active | paused | completed | stopped_dnc | stopped_stage_end"},"startedAt":{"type":"string","format":"date-time"},"outcome":{"type":"string","nullable":true,"description":"Resultado da rotina. Nulo indica que ainda está em andamento ou terminou sem uma regra correspondente. Permite distinguir o resultado dos estados completed, stopped_dnc e stopped_stage_end."},"outcomeLabel":{"type":"string","nullable":true,"description":"Etapa do negócio quando a matrícula foi encerrada, não sua etapa atual."}}},"DealCadenceInstanceEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealCadenceInstance"},"message":{"type":"string","nullable":true}}},"DealCadenceInstance":{"type":"object","properties":{"id":{"type":"string"},"dealId":{"type":"string"},"dealSeq":{"type":"integer"},"cadenceId":{"type":"string","nullable":true},"trackType":{"type":"string","enum":["entry","stage_playbook","none"]},"stageId":{"type":"string","nullable":true},"cadenceVersion":{"type":"integer","nullable":true},"status":{"type":"string","description":"active | paused | completed | stopped_dnc | stopped_stage_end"},"startedAt":{"type":"string","format":"date-time"},"pausedAt":{"type":"string","format":"date-time","nullable":true},"resumedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"stoppedAt":{"type":"string","format":"date-time","nullable":true},"pauseReason":{"type":"string","nullable":true},"stopReason":{"type":"string","nullable":true},"stageCadenceCompleted":{"type":"boolean"},"workspaceId":{"type":"string"},"tasks":{"type":"array","items":{"$ref":"#/components/schemas/DealCadenceTask"}}}},"DealCadenceTask":{"type":"object","properties":{"id":{"type":"string"},"channel":{"type":"string","enum":["whatsapp","voice_call","email","research"]},"dayNumber":{"type":"integer"},"stepOrder":{"type":"integer"},"quantity":{"type":"integer"},"attemptCount":{"type":"integer"},"status":{"type":"string","description":"pending | due | done | overdue | skipped | canceled | blocked"},"ownerUserId":{"type":"string"},"dueAt":{"type":"string","format":"date-time"},"doneAt":{"type":"string","format":"date-time","nullable":true},"overdueAt":{"type":"string","format":"date-time","nullable":true},"description":{"type":"string","nullable":true},"whatsappTemplateName":{"type":"string","nullable":true},"skipReason":{"type":"string","nullable":true},"attempts":{"type":"array","items":{"$ref":"#/components/schemas/CadenceTaskAttempt"},"description":"Histórico de tentativas de execução da tarefa."}}},"TaskExecutionEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TaskExecution"},"message":{"type":"string","nullable":true}}},"TaskExecution":{"type":"object","properties":{"ok":{"type":"boolean"},"duplicated":{"type":"boolean","description":"Verdadeiro quando a mesma execução já estava registrada."},"taskStatus":{"type":"string"},"attemptNumber":{"type":"integer"},"attemptId":{"type":"string","nullable":true},"providerMessageId":{"type":"string","nullable":true},"voiceCallId":{"type":"string","nullable":true},"emailMessageId":{"type":"string","nullable":true},"idempotencyKey":{"type":"string","nullable":true},"executedAt":{"type":"string","format":"date-time"}}},"PipelineCadenceStep":{"type":"object","description":"Uma atividade da rotina de cadência.","properties":{"id":{"type":"string"},"version":{"type":"integer"},"dayNumber":{"type":"integer","description":"Dia da rotina em que a atividade ocorre."},"stepOrder":{"type":"integer","description":"Ordem da atividade dentro do dia."},"channel":{"type":"string","enum":["whatsapp","voice_call","email","research"]},"quantity":{"type":"integer"},"delayMinutes":{"type":"integer"},"templateId":{"type":"string","nullable":true},"scriptId":{"type":"string","nullable":true},"messageRequired":{"type":"boolean"},"description":{"type":"string","nullable":true,"description":"Objetivo da atividade para a pessoa responsável pelo atendimento."},"guardrailPrompt":{"type":"string","nullable":true}}},"AutomationEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Automation"},"message":{"type":"string","nullable":true}}},"AutomationListEnvelope":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Automation"}},"message":{"type":"string","nullable":true}}},"AutomationTriggerCatalogEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AutomationTriggerCatalog"},"message":{"type":"string","nullable":true}}},"AutomationTestEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AutomationTest"},"message":{"type":"string","nullable":true}}},"AutomationLogPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AutomationLog"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"AutomationDeliveryPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AutomationDelivery"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"AutomationRunPageEnvelope":{"type":"object","properties":{"data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRun"}},"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"}}},"message":{"type":"string","nullable":true}}},"AutomationRunDetailEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AutomationRunDetail"},"message":{"type":"string","nullable":true}}},"CreateAutomationRequest":{"type":"object","description":"Corpo de criação ou substituição. `scope: pipeline` exige `pipelineId`; `scope: stage` exige `stageId`. Gatilhos manual e webhook usam obrigatoriamente o escopo global. `respectBusinessHours` e uma triggerWindow não vazia são incompatíveis. O gatilho manual não aceita conditions, triggerWindow nem respectBusinessHours.","properties":{"name":{"type":"string","maxLength":255},"triggerType":{"type":"string","description":"Um dos valores de `GET /api/v1/automations/triggers`.","enum":["deal_created","deal_stage_changed","deal_won","deal_lost","deal_assigned","message_received","conversation_closed","contact_no_reply","team_no_reply","field_filled","timer","instagram_comment_received","manual","webhook"]},"scope":{"type":"string","enum":["global","pipeline","stage"]},"pipelineId":{"type":"string","nullable":true},"stageId":{"type":"string","nullable":true},"outboundChannelId":{"type":"string","nullable":true,"description":"Não existe rota pública para listar canais; obtenha o identificador por outro meio."},"graphDefinition":{"$ref":"#/components/schemas/AutomationGraph"},"respectBusinessHours":{"type":"boolean","nullable":true},"triggerWindow":{"type":"object","nullable":true,"additionalProperties":true},"conditions":{"type":"object","nullable":true,"additionalProperties":true},"triggerConfig":{"type":"object","nullable":true,"additionalProperties":true,"description":"O formato depende de triggerType. field_filled usa {fieldSlug, fillMode}; timer aceita {mode: date_field, dateFieldSlug, offsetMinutes, onPastDate} ou {mode: recurring, cron}; contact_no_reply e team_no_reply usam {timeoutSeconds} entre 60 e 2592000; webhook usa {path, httpMethod, authentication e outras propriedades}."},"enabled":{"type":"boolean","nullable":true,"description":"Na criação, omitir significa **true**: o fluxo começa a reagir aos gatilhos. Na substituição, omitir preserva o estado atual."},"actions":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/AutomationActionRequest"},"description":"Ações do formato legado. Para novos fluxos, use graphDefinition."},"webhookUrl":{"type":"string","description":"URL de webhook do formato legado.","nullable":true},"webhookHeaders":{"type":"object","nullable":true,"additionalProperties":true,"description":"Cabeçalhos de webhook do formato legado."}},"required":["name","triggerType","scope"],"example":{"name":"Fluxo manual de exemplo","triggerType":"manual","scope":"global","enabled":false,"graphDefinition":{"version":2,"nodes":[{"id":"inicio","type":"trigger"},{"id":"fim","type":"end"}],"edges":[{"id":"inicio-fim","source":"inicio","target":"fim","sourceHandle":"next"}]}}},"AutomationGraph":{"type":"object","description":"Grafo do fluxo: até 50 nós e 30 esperas, exatamente um nó trigger, sem ciclos e com todos os nós alcançáveis pelo gatilho. Cada tipo tem regras de saída: condition exige uma aresta branch_<id> por ramo; round_robin, uma rr_<id> por saída; end não permite saída. A validação retorna todos os problemas em conjunto.","properties":{"version":{"type":"integer","enum":[2]},"nodes":{"type":"array","maxItems":50,"items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["trigger","action","condition","wait","round_robin","end"]},"actionType":{"type":"string","nullable":true,"enum":["webhook","send_whatsapp","move_stage","add_tag","remove_tag","set_custom_field","wait","create_task","assign_responsible","add_co_owner","send_meta_conversion","create_lead","send_email","reply_instagram_comment","send_instagram_private_reply","hide_instagram_comment","cia_deal_analysis","create_calendar_event","close_conversation","stop_automations"]},"config":{"type":"object","additionalProperties":true,"description":"As propriedades obrigatórias dependem de actionType: webhook exige url; move_stage exige targetStageId; add_tag/remove_tag exigem tagIds não vazio; set_custom_field exige exatamente um entre fieldId e fieldSlug, além de value; assign_responsible exige userId; wait exige delaySeconds, com mínimo de 5."},"condition":{"type":"object","nullable":true,"additionalProperties":true}},"required":["id","type"]}},"edges":{"type":"array","maxItems":200,"items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"target":{"type":"string"},"sourceHandle":{"type":"string","description":"`next`, `fallback`, `branch_<id>`, `rr_<id>`, `btn_<id>`, `replied`, `timeout` ou `text_reply`."}},"required":["source","target"]}}},"required":["version","nodes"]},"Automation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"type":"integer","description":"Versão da definição. A troca de enabled não incrementa a versão."},"enabled":{"type":"boolean"},"triggerType":{"type":"string"},"scope":{"type":"string","enum":["global","pipeline","stage"]},"pipelineId":{"type":"string","nullable":true},"stageId":{"type":"string","nullable":true},"outboundChannelId":{"type":"string","nullable":true},"respectBusinessHours":{"type":"boolean"},"triggerWindow":{"type":"object","nullable":true,"additionalProperties":true},"conditions":{"type":"object","nullable":true,"additionalProperties":true},"triggerConfig":{"type":"object","nullable":true,"additionalProperties":true,"description":"As credenciais de webhook (headerValue, password) são removidas."},"graphDefinition":{"$ref":"#/components/schemas/AutomationGraph"},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"ID da ação. As ações são substituídas na atualização, não alteradas individualmente."},"type":{"type":"string"},"order":{"type":"integer"},"config":{"type":"object","additionalProperties":true,"description":"O secret do webhook é removido."}}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"secret":{"type":"string","nullable":true,"description":"Presente somente na resposta de criação ou substituição que gerou o segredo. Nunca aparece na leitura. Salve-o: assina X-PipeFacil-Signature-256 e não pode ser consultado depois."}}},"AutomationTriggerCatalog":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string"},"label":{"type":"string"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","description":"Valor aceito em triggerType."},"label":{"type":"string"},"conditionFields":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"Caminho aceito no field de uma regra de condição."},"label":{"type":"string"}}}}}}}}}}}},"AutomationTest":{"type":"object","description":"Entrega que seria enviada. Nada é enviado por esta operação.","properties":{"url":{"type":"string","nullable":true},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Inclui a assinatura real X-PipeFacil-Signature-256 do body."},"body":{"type":"string","description":"Corpo serializado de um evento de exemplo deal.stage_changed."}}},"AutomationLog":{"type":"object","description":"Execução de um nó. Segredos são removidos de input/output em todos os níveis.","properties":{"id":{"type":"string"},"runId":{"type":"string"},"dealId":{"type":"string","nullable":true},"actionId":{"type":"string","nullable":true},"actionType":{"type":"string"},"status":{"type":"string"},"input":{"type":"object","nullable":true,"additionalProperties":true},"output":{"type":"object","nullable":true,"additionalProperties":true},"error":{"type":"string","nullable":true},"automationVersion":{"type":"integer"},"chainId":{"type":"string","nullable":true},"triggerDepth":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true}}},"AutomationDelivery":{"type":"object","properties":{"id":{"type":"string"},"dealId":{"type":"string","nullable":true},"eventType":{"type":"string"},"status":{"type":"string","enum":["queued","sent","failed","dead_letter"]},"attempts":{"type":"integer"},"responseStatusCode":{"type":"integer","nullable":true},"lastError":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}},"AutomationRun":{"type":"object","properties":{"runId":{"type":"string"},"dealId":{"type":"string","nullable":true},"status":{"type":"string","enum":["queued","running","waiting","completed","failed","dead_letter","skipped","cancelled"]},"triggerType":{"type":"string","description":"Evento de origem (event_type)."},"automationVersion":{"type":"integer","description":"Versão da definição preservada nesta execução."},"attempts":{"type":"integer"},"lastError":{"type":"string","nullable":true},"currentNodeId":{"type":"string","nullable":true},"chainId":{"type":"string","nullable":true},"triggerDepth":{"type":"integer"},"waitingForReply":{"type":"boolean","description":"Em uma execução waiting, indica se nextAttemptAt é o prazo de resposta em vez do fim de uma espera por tempo."},"createdAt":{"type":"string","format":"date-time"},"startedAt":{"type":"string","format":"date-time","nullable":true},"lastAttemptAt":{"type":"string","format":"date-time","nullable":true},"nextAttemptAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true}}},"AutomationRunDetail":{"type":"object","properties":{"runId":{"type":"string"},"automationId":{"type":"string"},"automationName":{"type":"string","nullable":true},"automationVersion":{"type":"integer"},"dealId":{"type":"string","nullable":true},"dealSeq":{"type":"integer","nullable":true,"description":"Número do negócio dentro do workspace. Nulo se não houver negócio ou se ele tiver sido excluído."},"dealName":{"type":"string","nullable":true},"status":{"type":"string"},"eventType":{"type":"string","nullable":true},"attempts":{"type":"integer"},"lastError":{"type":"string","nullable":true},"currentNodeId":{"type":"string","nullable":true},"chainId":{"type":"string","nullable":true},"triggerDepth":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"lastAttemptAt":{"type":"string","format":"date-time","nullable":true},"nextAttemptAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true},"graph":{"type":"object","nullable":true,"additionalProperties":true,"description":"Definição preservada no momento do disparo, para explicar a execução mesmo após alterações no fluxo. Segredos removidos."},"nodes":{"type":"array","description":"Todos os nós do grafo preservado, com o estado alcançado.","items":{"$ref":"#/components/schemas/AutomationRunNode"}},"steps":{"type":"array","description":"Somente os nós realmente executados, em ordem.","items":{"$ref":"#/components/schemas/AutomationRunNode"}}}},"AutomationRunNode":{"type":"object","properties":{"nodeId":{"type":"string"},"nodeType":{"type":"string","nullable":true},"actionType":{"type":"string","nullable":true},"status":{"type":"string","enum":["completed","failed","waiting","running","not_reached"]},"input":{"type":"object","nullable":true,"additionalProperties":true},"output":{"type":"object","nullable":true,"additionalProperties":true},"error":{"type":"string","nullable":true},"startedAt":{"type":"string","format":"date-time","nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true}}},"DealTracking":{"type":"object","properties":{"utmContent":{"type":"string","nullable":true},"utmMedium":{"type":"string","nullable":true},"utmCampaign":{"type":"string","nullable":true},"utmSource":{"type":"string","nullable":true},"utmTerm":{"type":"string","nullable":true},"utmReferrer":{"type":"string","nullable":true},"referrer":{"type":"string","nullable":true},"gclientid":{"type":"string","nullable":true},"gclid":{"type":"string","nullable":true},"fbclid":{"type":"string","nullable":true},"metaLeadId":{"type":"string","nullable":true},"fbp":{"type":"string","nullable":true},"fbc":{"type":"string","nullable":true},"clientIpAddress":{"type":"string","nullable":true},"clientUserAgent":{"type":"string","nullable":true},"ctwaClid":{"type":"string","nullable":true}},"description":"Dados de atribuição de origem e campanha. As chaves mantêm os identificadores usados pelas plataformas de anúncios."},"DealLostFromStage":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"pipelineId":{"type":"string"}},"description":"Etapa em que o negócio estava antes de ser marcado como perdido."},"DealNextTask":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"dueAt":{"type":"string","nullable":true,"format":"date-time"},"categoryName":{"type":"string","nullable":true},"categoryColor":{"type":"string","nullable":true}}},"DealTaskSummary":{"type":"object","properties":{"pendingCount":{"type":"integer"},"overdueCount":{"type":"integer"},"nextTask":{"allOf":[{"$ref":"#/components/schemas/DealNextTask"}],"nullable":true}}},"DealTimelineItem":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"occurredAt":{"type":"string","format":"date-time"},"title":{"type":"string"},"body":{"type":"string","nullable":true},"meta":{"type":"object","additionalProperties":true},"actor":{"allOf":[{"$ref":"#/components/schemas/DealActivityActor"}],"nullable":true}}},"DealActivityActor":{"type":"object","properties":{"actorType":{"type":"string"},"userId":{"type":"string","nullable":true},"userName":{"type":"string","nullable":true},"userAvatarUrl":{"type":"string","nullable":true},"automationId":{"type":"string","nullable":true},"automationName":{"type":"string","nullable":true},"copilotActionId":{"type":"string","nullable":true},"apiKeyId":{"type":"string","nullable":true}}},"CalendarMember":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true},"role":{"type":"string"}}},"CalendarContact":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"email":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}}},"CalendarAttendeeRequest":{"type":"object","properties":{"type":{"type":"string","enum":["member","contact"]},"memberId":{"type":"string","nullable":true},"contactId":{"type":"string","nullable":true},"responseStatus":{"type":"string","enum":["needs_action","accepted","declined","tentative"]},"organizer":{"type":"boolean"},"optional":{"type":"boolean"}},"description":"Informe memberId para member ou contactId para contact."},"CadenceTaskAttempt":{"type":"object","properties":{"id":{"type":"string"},"attemptNumber":{"type":"integer"},"channel":{"type":"string"},"success":{"type":"boolean"},"providerMessageId":{"type":"string","nullable":true},"voiceCallId":{"type":"string","nullable":true},"emailMessageId":{"type":"string","nullable":true},"executedByUserId":{"type":"string","nullable":true},"errorMessage":{"type":"string","nullable":true},"executedAt":{"type":"string","format":"date-time"}}},"AutomationActionRequest":{"type":"object","properties":{"type":{"type":"string","description":"Tipo de ação legado."},"order":{"type":"integer"},"config":{"type":"object","additionalProperties":true}}},"EventFieldAttendee":{"type":"object","properties":{"type":{"type":"string","enum":["lead_contact","deal_co_owner","member","contact","member_field"]},"userId":{"type":"string","nullable":true},"contactId":{"type":"string","nullable":true},"fieldSlug":{"type":"string","description":"Slug do campo members cujo usuário será convidado. Lido novamente quando o campo mudar.","nullable":true},"label":{"type":"string","description":"Rótulo usado pelo editor; não determina a identidade do convidado.","nullable":true,"maxLength":255}}},"EventFieldConfig":{"type":"object","properties":{"title":{"type":"string","maxLength":255},"description":{"type":"string","nullable":true,"maxLength":2000},"durationMinutes":{"type":"integer","minimum":1,"maximum":1440},"conferenceMode":{"type":"string","enum":["none","google_meet","custom_field"],"nullable":true},"conferenceFieldSlug":{"type":"string","nullable":true},"recordWithBot":{"type":"boolean","nullable":true},"attendees":{"type":"array","nullable":true,"maxItems":50,"items":{"$ref":"#/components/schemas/EventFieldAttendee"}}},"required":["title","durationMinutes"]},"DealPropertyFile":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"size":{"type":"integer","format":"int64"},"mimeType":{"type":"string"},"downloadUrl":{"type":"string","nullable":true},"downloadUrlExpiresAt":{"type":"string","nullable":true,"format":"date-time"}}},"DealPropertyFileEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DealPropertyFile"}}},"FileUploadReceiptEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FileUploadReceipt"}}},"PublicUser":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true}}},"PublicUserEnvelope":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublicUser"}}}}}}