Ver .md

crm.sale_cancel

Cancelar venda. Marca a venda como cancelada: ela sai das métricas do Gerenciador. A oportunidade não muda. Cancelar de novo não faz nada.

  • Endpoint: POST https://app.atomiks.com.br/api/v1/crm.sale_cancel (corpo JSON)
  • Quem pode chamar: membro da conta
  • Escopo da chave: crm:write
  • Grava dados: sim
  • Pela chave de API: sim
  • Ferramenta MCP: crm_sale_cancel
  • Ficha em JSON: https://app.atomiks.com.br/api/v1/openapi.json (operationId crm.sale_cancel)

Entrada

CampoTipoObrigatórioNota
idstring (uuid)sim
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    }
  },
  "required": [
    "id"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/crm.sale_cancel \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"00000000-0000-0000-0000-000000000000"}'

CLI:

node cli/atomiks.mjs crm.sale_cancel --json '{"id":"00000000-0000-0000-0000-000000000000"}'

MCP: ferramenta crm_sale_cancel com a mesma entrada.

Saída

Sucesso: {"data": ...} com o formato abaixo.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "contactId": {
      "type": "string"
    },
    "contact": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name"
      ],
      "additionalProperties": false
    },
    "product": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "valueCents": {
      "type": "number"
    },
    "source": {
      "type": "string",
      "enum": [
        "manual",
        "message"
      ]
    },
    "message": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "body": {
              "type": [
                "string",
                "null"
              ]
            },
            "at": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "body",
            "at"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "rule": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "soldAt": {
      "type": "string"
    },
    "cancelled": {
      "type": "boolean"
    },
    "opportunityId": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "contactId",
    "contact",
    "product",
    "valueCents",
    "source",
    "message",
    "rule",
    "soldAt",
    "cancelled",
    "opportunityId"
  ],
  "additionalProperties": false
}

Erros

{"error": {"code", "message", "requestId"}}. Códigos: invalid_input (400), unauthorized (401), forbidden / account_pending / scope_missing (403), not_found (404), limit_reached (409), internal (500).