v1
Negócios

Marcar o negócio como ganho ou perdido

PUT/api/v1/deals/{id}/status

Fecha o negócio como ganho ou perdido, ou o reabre.

Ganho e perda pedem escopos próprios além do de edição: deals.mark_won para Won e deals.mark_lost para Lost. Sem o escopo, a resposta é 403. Marcar como ganho dispara o que a empresa configurou para a venda fechada: contrato e faturamento.

A chave de API precisa do escopoEditar negóciosdeals.edit

Parâmetros

NomeOndeDescrição
idobrigatóriostring (uuid)pathId do negócio.

Corpo da requisição

CampoDescrição
statusobrigatóriostringO novo status do negócio.OpenWonLost
lossReasonstringPor que o negócio foi perdido, em texto livre. Só faz sentido com Lost.
lossReasonIdstring (uuid)Motivo de perda do catálogo da empresa, no lugar do texto livre.

Respostas

200O negócio com o novo status e se a venda pede a geração de contrato.
application/json
{
  "deal": {
    "id": "f6fe1e97-0bb3-4379-acd4-2e3523cc6110",
    "contactId": "af147888-ebb0-4ec9-92e5-da66cd561461",
    "companyId": null,
    "pipelineStageId": "72abe4d8-8ecb-4daa-8ae0-e8418a006488",
    "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
    "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
    "title": "Plano Premium",
    "status": "Won",
    "lossReason": null,
    "lossReasonId": null,
    "totalValue": 199,
    "recurringValue": 199,
    "setupValue": 0,
    "currency": "BRL",
    "customFields": null,
    "closedAt": "2026-11-25T17:42:10.204118Z",
    "expectedCloseDate": "2026-12-15T00:00:00Z",
    "stageEnteredAt": "2026-11-23T11:44:49.556388Z",
    "lastActivityAt": null,
    "createdAt": "2026-11-23T01:00:08.333095Z",
    "updatedAt": "2026-11-23T11:46:03.571848Z",
    "contact": {
      "id": "af147888-ebb0-4ec9-92e5-da66cd561461",
      "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
      "name": "Fulano de Tal",
      "firstName": "Fulano",
      "phoneNumber": "5511988887777",
      "instagramUsername": null,
      "tikTokUsername": null,
      "telegramUsername": null,
      "email": "[email protected]",
      "emailBouncedAt": null,
      "messagingOptedOutAt": null,
      "emailOptedOutAt": null,
      "tags": null,
      "customFields": null,
      "profileImageUrl": null,
      "pipelineStageId": "14592c48-f334-4d8c-b318-8d95b6bc1831",
      "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
      "teamId": null,
      "source": "SiteForm",
      "score": 72,
      "status": "Qualified",
      "convertedAt": null,
      "lossReason": null,
      "lossReasonId": null,
      "stageEnteredAt": "2026-11-23T00:58:52.335976Z",
      "lastActivityAt": "2026-11-23T11:44:19.871857Z",
      "lastInboundMessageAt": null,
      "lastOutboundMessageAt": null,
      "firstTouchAt": null,
      "firstContactAt": null,
      "documentNumber": null,
      "addressZipcode": null,
      "addressStreet": null,
      "addressNumber": null,
      "addressComplement": null,
      "addressNeighborhood": null,
      "addressCity": "São Paulo",
      "addressState": "SP",
      "addressCountry": "BR",
      "createdAt": "2026-11-23T00:58:52.335976Z",
      "updatedAt": "2026-11-23T11:44:19.888105Z"
    },
    "company": null,
    "products": [
      {
        "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
        "id": "7729f0fe-5a0b-4bb2-ba0a-89c3e3ce34fd",
        "dealId": "f6fe1e97-0bb3-4379-acd4-2e3523cc6110",
        "productId": "23ce82a0-c04c-4df9-b8de-b15a384ddf58",
        "quantity": 1,
        "unitPrice": 199,
        "setupFee": 0,
        "discount": 0,
        "customPrice": null,
        "deal": {
          "id": "f6fe1e97-0bb3-4379-acd4-2e3523cc6110",
          "contactId": "af147888-ebb0-4ec9-92e5-da66cd561461",
          "companyId": null,
          "pipelineStageId": "72abe4d8-8ecb-4daa-8ae0-e8418a006488",
          "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
          "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
          "title": "Plano Premium",
          "status": "Won",
          "lossReason": null,
          "lossReasonId": null,
          "totalValue": 199,
          "recurringValue": 199,
          "setupValue": 0,
          "currency": "BRL",
          "customFields": null,
          "closedAt": "2026-11-23T11:46:03.533627Z",
          "expectedCloseDate": null,
          "stageEnteredAt": "2026-11-23T11:44:49.556388Z",
          "lastActivityAt": null,
          "createdAt": "2026-11-23T01:00:08.333095Z",
          "updatedAt": "2026-11-23T11:46:03.571848Z",
          "contact": {
            "id": "af147888-ebb0-4ec9-92e5-da66cd561461",
            "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
            "name": "Marcelo Lima",
            "firstName": "Marcelo",
            "phoneNumber": "5531999990000",
            "instagramUsername": null,
            "tikTokUsername": null,
            "telegramUsername": null,
            "email": null,
            "emailBouncedAt": null,
            "messagingOptedOutAt": null,
            "emailOptedOutAt": null,
            "tags": null,
            "customFields": null,
            "profileImageUrl": null,
            "pipelineStageId": "14592c48-f334-4d8c-b318-8d95b6bc1831",
            "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
            "teamId": null,
            "source": "Manual",
            "score": 0,
            "status": "New",
            "convertedAt": null,
            "lossReason": null,
            "lossReasonId": null,
            "stageEnteredAt": "2026-11-23T00:58:52.335976Z",
            "lastActivityAt": "2026-11-23T11:44:19.871857Z",
            "lastInboundMessageAt": null,
            "lastOutboundMessageAt": null,
            "firstTouchAt": null,
            "firstContactAt": null,
            "documentNumber": null,
            "addressZipcode": null,
            "addressStreet": null,
            "addressNumber": null,
            "addressComplement": null,
            "addressNeighborhood": null,
            "addressCity": null,
            "addressState": null,
            "addressCountry": null,
            "createdAt": "2026-11-23T00:58:52.335976Z",
            "updatedAt": "2026-11-23T11:44:19.888105Z"
          },
          "company": null,
          "products": null
        },
        "product": {
          "id": "23ce82a0-c04c-4df9-b8de-b15a384ddf58",
          "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
          "name": "Plano Premium",
          "description": null,
          "type": "Recurring",
          "recurrencePeriod": "Monthly",
          "price": 199,
          "setupFee": 0,
          "currency": "BRL",
          "category": null,
          "tags": null,
          "media": null,
          "requiresContract": false,
          "contractTemplateId": null,
          "contractRequiresBusinessSignature": false,
          "isActive": true,
          "createdAt": "2026-11-23T00:59:13.603858Z",
          "updatedAt": null
        }
      }
    ]
  },
  "shouldGenerateContract": false
}
400Requisição inválida: corpo que não é JSON, campo obrigatório ausente ou valor fora do formato.
application/json
{
  "error": "validation_failed",
  "message": "O campo name é obrigatório."
}
401Credenciais ausentes ou inválidas. A resposta é a mesma para chave inexistente e secret errada; sem o cabeçalho X-API-KEY, ela chega sem corpo.
application/json
{
  "error": "unauthorized",
  "message": "Credenciais de API inválidas."
}
403A chave autenticou, mas não tem o escopo que a rota exige, ou o plano não inclui o recurso.
application/json
{
  "error": "forbidden",
  "message": "A chave de API não tem acesso a esta rota: falta o escopo exigido, ou a rota não aceita chave de API."
}
404O registro não existe nesta empresa.
application/json
{
  "error": "not_found",
  "message": "Registro não encontrado."
}
429O limite de requisições por minuto foi atingido. Aguarde o tempo do cabeçalho Retry-After.
application/json
{
  "error": "too_many_requests",
  "message": "Muitas requisições com esta chave de API. Aguarde o fim da janela e tente novamente."
}
curl -X PUT "https://api.guria.io/api/v1/deals/{id}/status" \
  -H "X-API-KEY: $GURIA_API_KEY" \
  -H "X-API-SECRET: $GURIA_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "Won",
    "lossReason": "Fechou com o concorrente"
  }'
Resposta · 200
{
  "deal": {
    "id": "f6fe1e97-0bb3-4379-acd4-2e3523cc6110",
    "contactId": "af147888-ebb0-4ec9-92e5-da66cd561461",
    "companyId": null,
    "pipelineStageId": "72abe4d8-8ecb-4daa-8ae0-e8418a006488",
    "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
    "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
    "title": "Plano Premium",
    "status": "Won",
    "lossReason": null,
    "lossReasonId": null,
    "totalValue": 199,
    "recurringValue": 199,
    "setupValue": 0,
    "currency": "BRL",
    "customFields": null,
    "closedAt": "2026-11-25T17:42:10.204118Z",
    "expectedCloseDate": "2026-12-15T00:00:00Z",
    "stageEnteredAt": "2026-11-23T11:44:49.556388Z",
    "lastActivityAt": null,
    "createdAt": "2026-11-23T01:00:08.333095Z",
    "updatedAt": "2026-11-23T11:46:03.571848Z",
    "contact": {
      "id": "af147888-ebb0-4ec9-92e5-da66cd561461",
      "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
      "name": "Fulano de Tal",
      "firstName": "Fulano",
      "phoneNumber": "5511988887777",
      "instagramUsername": null,
      "tikTokUsername": null,
      "telegramUsername": null,
      "email": "[email protected]",
      "emailBouncedAt": null,
      "messagingOptedOutAt": null,
      "emailOptedOutAt": null,
      "tags": null,
      "customFields": null,
      "profileImageUrl": null,
      "pipelineStageId": "14592c48-f334-4d8c-b318-8d95b6bc1831",
      "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
      "teamId": null,
      "source": "SiteForm",
      "score": 72,
      "status": "Qualified",
      "convertedAt": null,
      "lossReason": null,
      "lossReasonId": null,
      "stageEnteredAt": "2026-11-23T00:58:52.335976Z",
      "lastActivityAt": "2026-11-23T11:44:19.871857Z",
      "lastInboundMessageAt": null,
      "lastOutboundMessageAt": null,
      "firstTouchAt": null,
      "firstContactAt": null,
      "documentNumber": null,
      "addressZipcode": null,
      "addressStreet": null,
      "addressNumber": null,
      "addressComplement": null,
      "addressNeighborhood": null,
      "addressCity": "São Paulo",
      "addressState": "SP",
      "addressCountry": "BR",
      "createdAt": "2026-11-23T00:58:52.335976Z",
      "updatedAt": "2026-11-23T11:44:19.888105Z"
    },
    "company": null,
    "products": [
      {
        "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
        "id": "7729f0fe-5a0b-4bb2-ba0a-89c3e3ce34fd",
        "dealId": "f6fe1e97-0bb3-4379-acd4-2e3523cc6110",
        "productId": "23ce82a0-c04c-4df9-b8de-b15a384ddf58",
        "quantity": 1,
        "unitPrice": 199,
        "setupFee": 0,
        "discount": 0,
        "customPrice": null,
        "deal": {
          "id": "f6fe1e97-0bb3-4379-acd4-2e3523cc6110",
          "contactId": "af147888-ebb0-4ec9-92e5-da66cd561461",
          "companyId": null,
          "pipelineStageId": "72abe4d8-8ecb-4daa-8ae0-e8418a006488",
          "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
          "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
          "title": "Plano Premium",
          "status": "Won",
          "lossReason": null,
          "lossReasonId": null,
          "totalValue": 199,
          "recurringValue": 199,
          "setupValue": 0,
          "currency": "BRL",
          "customFields": null,
          "closedAt": "2026-11-23T11:46:03.533627Z",
          "expectedCloseDate": null,
          "stageEnteredAt": "2026-11-23T11:44:49.556388Z",
          "lastActivityAt": null,
          "createdAt": "2026-11-23T01:00:08.333095Z",
          "updatedAt": "2026-11-23T11:46:03.571848Z",
          "contact": {
            "id": "af147888-ebb0-4ec9-92e5-da66cd561461",
            "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
            "name": "Marcelo Lima",
            "firstName": "Marcelo",
            "phoneNumber": "5531999990000",
            "instagramUsername": null,
            "tikTokUsername": null,
            "telegramUsername": null,
            "email": null,
            "emailBouncedAt": null,
            "messagingOptedOutAt": null,
            "emailOptedOutAt": null,
            "tags": null,
            "customFields": null,
            "profileImageUrl": null,
            "pipelineStageId": "14592c48-f334-4d8c-b318-8d95b6bc1831",
            "ownerId": "5a3dc17c-3dc5-4770-bb35-0bff55f3151b",
            "teamId": null,
            "source": "Manual",
            "score": 0,
            "status": "New",
            "convertedAt": null,
            "lossReason": null,
            "lossReasonId": null,
            "stageEnteredAt": "2026-11-23T00:58:52.335976Z",
            "lastActivityAt": "2026-11-23T11:44:19.871857Z",
            "lastInboundMessageAt": null,
            "lastOutboundMessageAt": null,
            "firstTouchAt": null,
            "firstContactAt": null,
            "documentNumber": null,
            "addressZipcode": null,
            "addressStreet": null,
            "addressNumber": null,
            "addressComplement": null,
            "addressNeighborhood": null,
            "addressCity": null,
            "addressState": null,
            "addressCountry": null,
            "createdAt": "2026-11-23T00:58:52.335976Z",
            "updatedAt": "2026-11-23T11:44:19.888105Z"
          },
          "company": null,
          "products": null
        },
        "product": {
          "id": "23ce82a0-c04c-4df9-b8de-b15a384ddf58",
          "businessId": "2ea7ad0d-8e13-4008-9fd8-7c92fe8677f2",
          "name": "Plano Premium",
          "description": null,
          "type": "Recurring",
          "recurrencePeriod": "Monthly",
          "price": 199,
          "setupFee": 0,
          "currency": "BRL",
          "category": null,
          "tags": null,
          "media": null,
          "requiresContract": false,
          "contractTemplateId": null,
          "contractRequiresBusinessSignature": false,
          "isActive": true,
          "createdAt": "2026-11-23T00:59:13.603858Z",
          "updatedAt": null
        }
      }
    ]
  },
  "shouldGenerateContract": false
}