Ver .md

crm.opportunity_create

Criar oportunidade. Cria o card do contato. Padrões: pipeline padrão, primeira etapa aberta, título = nome do contato. O contato precisa estar visível ao chamador. Aceita prioridade, previsão de fechamento (AAAA-MM-DD), probabilidade (0-100), origem, empresa (companyId). removeFromOthers: true apaga as outras oportunidades abertas do contato em outras pipelines.

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

Entrada

CampoTipoObrigatórioNota
contactIdstring (uuid)sim
pipelineIdstring (uuid)não
stageIdstring (uuid)não
titlestringnão
productIdstring (uuid) | nullnão
valueCentsinteger | nullnão
priority"low" | "normal" | "high" | "urgent" | nullnão
expectedCloseDatestring | nullnão
probabilityinteger | nullnão
originstring | nullnão
lostReasonstring | nullnão
companyIdstring (uuid) | nullnão
removeFromOthersbooleannão
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contactId": {
      "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)$"
    },
    "pipelineId": {
      "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)$"
    },
    "stageId": {
      "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)$"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "productId": {
      "anyOf": [
        {
          "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "valueCents": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "priority": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "low",
            "normal",
            "high",
            "urgent"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "expectedCloseDate": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        {
          "type": "null"
        }
      ]
    },
    "probability": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        {
          "type": "null"
        }
      ]
    },
    "origin": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 120
        },
        {
          "type": "null"
        }
      ]
    },
    "lostReason": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 200
        },
        {
          "type": "null"
        }
      ]
    },
    "companyId": {
      "anyOf": [
        {
          "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "removeFromOthers": {
      "type": "boolean"
    }
  },
  "required": [
    "contactId"
  ]
}

Exemplo

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

CLI:

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

MCP: ferramenta crm_opportunity_create 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"
    },
    "pipelineId": {
      "type": "string"
    },
    "stageId": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "open",
        "won",
        "lost"
      ]
    },
    "title": {
      "type": "string"
    },
    "valueCents": {
      "type": [
        "number",
        "null"
      ]
    },
    "product": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "contact": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "phone": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "phone"
      ],
      "additionalProperties": false
    },
    "owner": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "openTasks": {
      "type": "number"
    },
    "updatedAt": {
      "type": "string"
    },
    "priority": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "low",
            "normal",
            "high",
            "urgent"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "expectedCloseDate": {
      "type": [
        "string",
        "null"
      ]
    },
    "probability": {
      "type": [
        "number",
        "null"
      ]
    },
    "origin": {
      "type": [
        "string",
        "null"
      ]
    },
    "lostReason": {
      "type": [
        "string",
        "null"
      ]
    },
    "company": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "pipelineId",
    "stageId",
    "status",
    "title",
    "valueCents",
    "product",
    "contact",
    "owner",
    "openTasks",
    "updatedAt",
    "priority",
    "expectedCloseDate",
    "probability",
    "origin",
    "lostReason",
    "company"
  ],
  "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).