Negocios (Deals)
Gerencie negocios (oportunidades comerciais e de servico) vinculados a sua empresa.
Listar Negocios
GET /external/v1/deals
Retorna uma lista paginada de negocios.
Query Parameters:
| Parametro | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
page | number | Nao | Pagina atual (default: 1) |
limit | number | Nao | Itens por pagina (default: 20, max: 100) |
search | string | Nao | Busca por titulo |
dealType | string | Nao | Filtro: COMMERCIAL ou SERVICE |
dealPipelineId | string | Nao | Filtro por pipeline |
customerId | string | Nao | Filtro por cliente (personId) |
orderBy | string | Nao | Campo: title, createdAt, amount (default: createdAt) |
order | string | Nao | ASC ou DESC (default: DESC) |
Exemplo de requisicao:
curl -X GET "https://api.tesselys.com.br/external/v1/deals?page=1&limit=10&dealType=COMMERCIAL" \
-H "Authorization: Bearer {accessToken}" \
-H "x-company-token: {companyToken}"
Resposta (200):
{
"data": [
{
"id": "clx3c4d5e6f7g8h9i0j1k2l3",
"code": "NEG-1042",
"title": "Implantacao Tesselys - Tech Solutions",
"customerId": "clx1a2b3c4d5e6f7g8h9i0j1",
"customerName": "Tech Solutions Ltda",
"dealType": "COMMERCIAL",
"dealPipelineId": "clxpipe001",
"dealPipelineName": "Vendas B2B",
"dealStageId": "clxstage003",
"dealStageName": "Proposta Enviada",
"amount": 85000.00,
"description": "Projeto de implantacao completa da plataforma",
"tags": ["implantacao", "enterprise"],
"isActive": true,
"createdAt": "2026-02-10T14:00:00.000Z",
"updatedAt": "2026-03-20T16:30:00.000Z"
}
],
"meta": {
"total": 67,
"page": 1,
"limit": 10,
"totalPages": 7
}
}
Buscar Negocio por ID
GET /external/v1/deals/:id
Exemplo de requisicao:
curl -X GET "https://api.tesselys.com.br/external/v1/deals/clx3c4d5e6f7g8h9i0j1k2l3" \
-H "Authorization: Bearer {accessToken}" \
-H "x-company-token: {companyToken}"
Resposta (200):
{
"id": "clx3c4d5e6f7g8h9i0j1k2l3",
"code": "NEG-1042",
"title": "Implantacao Tesselys - Tech Solutions",
"customerId": "clx1a2b3c4d5e6f7g8h9i0j1",
"customerName": "Tech Solutions Ltda",
"dealType": "COMMERCIAL",
"dealPipelineId": "clxpipe001",
"dealPipelineName": "Vendas B2B",
"dealStageId": "clxstage003",
"dealStageName": "Proposta Enviada",
"amount": 85000.00,
"expectedCloseDate": "2026-04-15T00:00:00.000Z",
"description": "Projeto de implantacao completa da plataforma com modulos financeiro, CRM e estoque.",
"tags": ["implantacao", "enterprise"],
"responsibleId": "clxuser001",
"responsibleName": "Carlos Silva",
"isActive": true,
"createdAt": "2026-02-10T14:00:00.000Z",
"updatedAt": "2026-03-20T16:30:00.000Z"
}
Criar Negocio
POST /external/v1/deals
Body:
| Campo | Tipo | Obrigatorio | Descricao |
|---|---|---|---|
title | string | Sim | Titulo do negocio (max: 255) |
customerId | string | Sim | ID da pessoa (cliente) vinculada |
dealType | string | Sim | COMMERCIAL ou SERVICE |
dealPipelineId | string | Sim | ID do pipeline de vendas |
amount | number | Nao | Valor estimado do negocio |
expectedCloseDate | string | Nao | Data prevista de fechamento (ISO 8601) |
description | string | Nao | Descricao detalhada |
tags | string[] | Nao | Tags livres |
Exemplo de requisicao:
curl -X POST "https://api.tesselys.com.br/external/v1/deals" \
-H "Authorization: Bearer {accessToken}" \
-H "x-company-token: {companyToken}" \
-H "Content-Type: application/json" \
-d '{
"title": "Consultoria Fiscal Q2 2026",
"customerId": "clx1a2b3c4d5e6f7g8h9i0j1",
"dealType": "SERVICE",
"dealPipelineId": "clxpipe002",
"amount": 15000.00,
"expectedCloseDate": "2026-06-30",
"description": "Consultoria tributaria para adequacao fiscal do segundo trimestre.",
"tags": ["consultoria", "fiscal"]
}'
Resposta (201):
{
"id": "clx4d5e6f7g8h9i0j1k2l3m4",
"code": "NEG-1043",
"title": "Consultoria Fiscal Q2 2026",
"customerId": "clx1a2b3c4d5e6f7g8h9i0j1",
"customerName": "Tech Solutions Ltda",
"dealType": "SERVICE",
"dealPipelineId": "clxpipe002",
"dealPipelineName": "Servicos Recorrentes",
"dealStageId": "clxstage001",
"dealStageName": "Qualificacao",
"amount": 15000.00,
"expectedCloseDate": "2026-06-30T00:00:00.000Z",
"description": "Consultoria tributaria para adequacao fiscal do segundo trimestre.",
"tags": ["consultoria", "fiscal"],
"isActive": true,
"createdAt": "2026-03-25T10:00:00.000Z",
"updatedAt": "2026-03-25T10:00:00.000Z"
}
Nota
O negocio e criado automaticamente no primeiro estagio do pipeline selecionado. O campo code e gerado automaticamente pelo sistema.
Atualizar Negocio
PUT /external/v1/deals/:id
Atualiza os dados de um negocio existente. Envie apenas os campos que deseja alterar.
Body (campos opcionais):
| Campo | Tipo | Descricao |
|---|---|---|
title | string | Novo titulo |
amount | number | Novo valor estimado |
expectedCloseDate | string | Nova data prevista (ISO 8601) |
dealStageId | string | ID do novo estagio (mover no pipeline) |
description | string | Nova descricao |
tags | string[] | Novas tags (substitui as anteriores) |
Exemplo de requisicao:
curl -X PUT "https://api.tesselys.com.br/external/v1/deals/clx4d5e6f7g8h9i0j1k2l3m4" \
-H "Authorization: Bearer {accessToken}" \
-H "x-company-token: {companyToken}" \
-H "Content-Type: application/json" \
-d '{
"amount": 18000.00,
"dealStageId": "clxstage002",
"tags": ["consultoria", "fiscal", "prioridade"]
}'
Resposta (200):
{
"id": "clx4d5e6f7g8h9i0j1k2l3m4",
"code": "NEG-1043",
"title": "Consultoria Fiscal Q2 2026",
"customerId": "clx1a2b3c4d5e6f7g8h9i0j1",
"customerName": "Tech Solutions Ltda",
"dealType": "SERVICE",
"dealPipelineId": "clxpipe002",
"dealPipelineName": "Servicos Recorrentes",
"dealStageId": "clxstage002",
"dealStageName": "Negociacao",
"amount": 18000.00,
"expectedCloseDate": "2026-06-30T00:00:00.000Z",
"description": "Consultoria tributaria para adequacao fiscal do segundo trimestre.",
"tags": ["consultoria", "fiscal", "prioridade"],
"isActive": true,
"createdAt": "2026-03-25T10:00:00.000Z",
"updatedAt": "2026-03-25T11:20:00.000Z"
}
Valores de Enum
dealType
| Valor | Descricao |
|---|---|
COMMERCIAL | Negocio comercial (venda de produto) |
SERVICE | Negocio de servico (prestacao de servico) |