crm.score_rule_preview
Prévia de uma regra de Score antes de salvar. Admin. Para o filtro de segmento (filters, o mesmo de contacts.list) e os points da regra: quantos contatos ela alcança (matchingContacts de totalContacts), quantos mudam de faixa (bandShift, por faixa) e três exemplos de quem entra, com o Score de antes e de depois. Com ruleId, desconta o que a versão salva da regra já soma, para mostrar só o efeito da mudança. Não grava nada. Sem a migration 20261026000008 responde migration_pendente.
- Endpoint:
POST https://app.atomiks.com.br/api/v1/crm.score_rule_preview(corpo JSON) - Quem pode chamar: administrador da conta
- Escopo da chave:
crm:read - Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP:
crm_score_rule_preview - Ficha em JSON:
https://app.atomiks.com.br/api/v1/openapi.json(operationIdcrm.score_rule_preview)
Entrada
| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
filters | object[] | sim | |
points | integer | não | |
ruleId | string (uuid) | não |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"filters": {
"maxItems": 200,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"maxLength": 64
},
"order": {
"type": "integer",
"minimum": 0,
"maximum": 1000
},
"field": {
"type": "string",
"maxLength": 60
},
"operator": {
"type": "string",
"maxLength": 30
},
"negation": {
"default": false,
"type": "boolean"
},
"parentId": {
"anyOf": [
{
"type": "string",
"maxLength": 64
},
{
"type": "null"
}
]
},
"valueString": {
"anyOf": [
{
"type": "string",
"maxLength": 4000
},
{
"type": "null"
}
]
},
"valueNumber": {
"type": [
"number",
"null"
]
},
"valueDate": {
"anyOf": [
{
"type": "string",
"maxLength": 40
},
{
"type": "null"
}
]
},
"valueBool": {
"type": [
"boolean",
"null"
]
},
"valueUuid": {
"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"
}
]
}
},
"required": [
"field",
"operator"
],
"additionalProperties": false
}
},
"points": {
"type": "integer",
"minimum": -1000,
"maximum": 1000
},
"ruleId": {
"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": [
"filters"
]
}Exemplo
curl -X POST https://app.atomiks.com.br/api/v1/crm.score_rule_preview \
-H "Authorization: Bearer $ATOMIKS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filters":[{"field":"is_customer","operator":"equals","negation":false,"valueBool":true}],"points":20,"ruleId":"00000000-0000-0000-0000-000000000000"}'CLI:
node cli/atomiks.mjs crm.score_rule_preview --json '{"filters":[{"field":"is_customer","operator":"equals","negation":false,"valueBool":true}],"points":20,"ruleId":"00000000-0000-0000-0000-000000000000"}'MCP: ferramenta crm_score_rule_preview com a mesma entrada.
Saída
Sucesso: {"data": ...} com o formato abaixo.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"totalContacts": {
"type": "number"
},
"matchingContacts": {
"type": "number"
},
"bandShift": {
"type": "object",
"properties": {
"low": {
"type": "number"
},
"medium": {
"type": "number"
},
"high": {
"type": "number"
}
},
"required": [
"low",
"medium",
"high"
],
"additionalProperties": false
},
"samples": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": [
"string",
"null"
]
},
"email": {
"type": [
"string",
"null"
]
},
"fromScore": {
"type": [
"number",
"null"
]
},
"toScore": {
"type": "number"
}
},
"required": [
"id",
"name",
"email",
"fromScore",
"toScore"
],
"additionalProperties": false
}
}
},
"required": [
"totalContacts",
"matchingContacts",
"bandShift",
"samples"
],
"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).