Oportunidades
Buscar oportunidades
GET /v1/opportunities · escopo crm:read · ferramenta MCP search_opportunities
Lista oportunidades visíveis ao usuário (funis permitidos; vendedor vê as próprias e as sem responsável; gestor vê as do time), do negócio criado mais recentemente (maior id) para o mais antigo.
| Campo | Onde | Tipo | Obrigatório | ||
|---|---|---|---|---|---|
query | query | string | não | ||
status | query | open \ | won \ | lost | não |
pipelineId | query | integer | não | ||
stepId | query | integer | não | ||
contactId | query | integer | não | ||
responsibleId | query | integer | não | ||
withoutNextStep | query | boolean ou true \ | false | não | |
stalled | query | boolean ou true \ | false | não | |
overdueClose | query | boolean ou true \ | false | não | |
inactiveDays | query | integer | não | ||
snoozed | query | exclude \ | only \ | include | não |
cursor | query | string | não | ||
limit | query | integer | não |
curl https://api.digla.io/v1/opportunities \
-H "Authorization: Bearer dg_seu_token"
Resposta:
{
"items": [
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
],
"nextCursor": "texto"
}
Totais por etapa
GET /v1/opportunities/summary · escopo crm:read · ferramenta MCP summarize_pipeline
Quantidade e valor dos negócios por etapa de um funil, com os mesmos filtros de higiene da busca e o mesmo recorte de visibilidade.
| Campo | Onde | Tipo | Obrigatório | ||
|---|---|---|---|---|---|
pipelineId | query | integer | sim | ||
status | query | open \ | won \ | lost | não |
responsibleId | query | integer | não | ||
withoutNextStep | query | boolean ou true \ | false | não | |
stalled | query | boolean ou true \ | false | não | |
overdueClose | query | boolean ou true \ | false | não | |
inactiveDays | query | integer | não | ||
snoozed | query | exclude \ | only \ | include | não |
curl https://api.digla.io/v1/opportunities/summary \
-H "Authorization: Bearer dg_seu_token"
Resposta:
{
"pipelineId": 1,
"totals": {
"count": 1,
"value": 1
},
"steps": [
{
"stepId": 1,
"name": "texto",
"order": 1,
"count": 1,
"value": 1
}
]
}
Ler oportunidade
GET /v1/opportunities/{id} · escopo crm:read · ferramenta MCP get_opportunity
Dados da oportunidade, motivo de ganho/perda e as 5 notas mais recentes.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
id | caminho | integer | sim |
curl https://api.digla.io/v1/opportunities/1 \
-H "Authorization: Bearer dg_seu_token"
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto",
"description": "texto",
"createdAt": "texto",
"closeDate": "texto",
"winReason": {
"id": 1,
"name": "texto"
},
"lossReason": {
"id": 1,
"name": "texto"
},
"notes": [
{
"id": 1,
"body": "texto",
"createdAt": "texto"
}
],
"stageEnteredAt": "texto",
"daysInStage": 1,
"snoozeReason": "texto",
"forecastCategory": "texto",
"leadScore": 1,
"temperature": "texto",
"lostToCompetitor": {
"id": 1,
"name": "texto"
},
"products": [
{
"lineId": 1,
"productId": 1,
"name": "texto",
"quantity": 1,
"unitValue": 1,
"discount": 1
}
],
"customFields": [
{
"id": 1,
"key": "texto",
"name": "texto",
"type": "texto",
"value": null
}
],
"openTasks": [
{
"id": 1,
"name": "texto",
"type": "texto",
"date": "texto",
"time": "texto",
"responsibleUserId": 1
}
]
}
Criar oportunidade
POST /v1/opportunities · escopo crm:write · ferramenta MCP create_opportunity
Cria uma oportunidade para um contato. Informe a etapa (stepId) ou o funil (pipelineId, entra na primeira etapa). Sem responsável, vale a distribuição do funil.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
contactId | corpo | integer | sim |
name | corpo | string | sim |
stepId | corpo | integer | não |
pipelineId | corpo | integer | não |
value | corpo | number | não |
responsibleId | corpo | integer | não |
description | corpo | string | não |
expectedCloseDate | corpo | string (formato) | não |
curl -X POST https://api.digla.io/v1/opportunities \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{"contactId":1,"name":"texto"}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
Alterar oportunidade
PATCH /v1/opportunities/{id} · escopo crm:write · ferramenta MCP update_opportunity
Altera nome, valor, descrição, previsão de fechamento, responsável ou etapa. Campos ausentes ficam como estão. Para ganhar, perder ou reabrir use /status.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
id | caminho | integer | sim |
name | corpo | string | não |
value | corpo | number | não |
description | corpo | string | não |
expectedCloseDate | corpo | string (formato) | não |
responsibleId | corpo | integer | não |
stepId | corpo | integer | não |
customFields | corpo | object | não |
curl -X PATCH https://api.digla.io/v1/opportunities/1 \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
Ganhar, perder ou reabrir
POST /v1/opportunities/{id}/status · escopo crm:write · ferramenta MCP set_opportunity_status
Marca a oportunidade como ganha (won), perdida (lost) ou reaberta (open). Funis podem exigir motivo: use os ids de /v1/directory.
| Campo | Onde | Tipo | Obrigatório | ||
|---|---|---|---|---|---|
id | caminho | integer | sim | ||
status | corpo | open \ | won \ | lost | sim |
winReasonId | corpo | integer | não | ||
lossReasonId | corpo | integer | não | ||
lostToCompetitorId | corpo | integer | não | ||
note | corpo | string | não |
curl -X POST https://api.digla.io/v1/opportunities/1/status \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{"status":"open"}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
Pôr em espera
POST /v1/opportunities/{id}/snooze · escopo crm:write · ferramenta MCP snooze_opportunity
Tira o negócio aberto das colunas até a data (AAAA-MM-DD, no fuso da empresa). Por padrão cria a tarefa de retomada para o responsável.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
id | caminho | integer | sim |
until | corpo | string (formato) | sim |
reason | corpo | string | não |
createTask | corpo | boolean | não |
curl -X POST https://api.digla.io/v1/opportunities/1/snooze \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{"until":"texto"}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
Tirar da espera
POST /v1/opportunities/{id}/unsnooze · escopo crm:write · ferramenta MCP unsnooze_opportunity
Devolve o negócio às colunas do funil antes da data marcada.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
id | caminho | integer | sim |
curl -X POST https://api.digla.io/v1/opportunities/1/unsnooze \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
Assumir negócio sem responsável
POST /v1/opportunities/{id}/take · escopo crm:write · ferramenta MCP take_opportunity
O usuário da credencial vira responsável por um negócio que está sem responsável. Negócio com responsável devolve ERR_OPPORTUNITY_HAS_OWNER.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
id | caminho | integer | sim |
curl -X POST https://api.digla.io/v1/opportunities/1/take \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}
Definir produtos do negócio
PUT /v1/opportunities/{id}/products · escopo crm:write · ferramenta MCP set_opportunity_products
Substitui a lista de produtos do negócio (lista vazia remove todos). Produtos ativos da empresa, com quantidade, valor unitário e desconto opcional.
| Campo | Onde | Tipo | Obrigatório |
|---|---|---|---|
id | caminho | integer | sim |
items | corpo | lista de object | sim |
curl -X PUT https://api.digla.io/v1/opportunities/1/products \
-H "Authorization: Bearer dg_seu_token" \
-H "Content-Type: application/json" \
-d '{"items":[{"productId":1,"quantity":1,"unitValue":1,"discount":1}]}'
Resposta:
{
"id": 1,
"name": "texto",
"status": "texto",
"value": 1,
"contact": {
"id": 1,
"name": "texto"
},
"pipeline": {
"id": 1,
"name": "texto"
},
"step": {
"id": 1,
"name": "texto"
},
"responsible": {
"id": 1,
"name": "texto"
},
"expectedCloseDate": "texto",
"snoozedUntil": "texto",
"updatedAt": "texto"
}