Criar Regra
curl --request POST \
--url http://api.gu1.ai/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"category": "<string>",
"targetEntityTypes": [
{}
],
"conditions": {},
"actions": [
{}
],
"enabled": true,
"priority": 123,
"score": 123,
"status": "<string>",
"evaluationMode": "<string>",
"riskMatrixId": "<string>",
"countries": [
{}
],
"scope": {},
"tags": [
{}
],
"creationProvenance": {}
}
'import requests
url = "http://api.gu1.ai/rules"
payload = {
"name": "<string>",
"description": "<string>",
"category": "<string>",
"targetEntityTypes": [{}],
"conditions": {},
"actions": [{}],
"enabled": True,
"priority": 123,
"score": 123,
"status": "<string>",
"evaluationMode": "<string>",
"riskMatrixId": "<string>",
"countries": [{}],
"scope": {},
"tags": [{}],
"creationProvenance": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
category: '<string>',
targetEntityTypes: [{}],
conditions: {},
actions: [{}],
enabled: true,
priority: 123,
score: 123,
status: '<string>',
evaluationMode: '<string>',
riskMatrixId: '<string>',
countries: [{}],
scope: {},
tags: [{}],
creationProvenance: {}
})
};
fetch('http://api.gu1.ai/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://api.gu1.ai/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'category' => '<string>',
'targetEntityTypes' => [
[
]
],
'conditions' => [
],
'actions' => [
[
]
],
'enabled' => true,
'priority' => 123,
'score' => 123,
'status' => '<string>',
'evaluationMode' => '<string>',
'riskMatrixId' => '<string>',
'countries' => [
[
]
],
'scope' => [
],
'tags' => [
[
]
],
'creationProvenance' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://api.gu1.ai/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"targetEntityTypes\": [\n {}\n ],\n \"conditions\": {},\n \"actions\": [\n {}\n ],\n \"enabled\": true,\n \"priority\": 123,\n \"score\": 123,\n \"status\": \"<string>\",\n \"evaluationMode\": \"<string>\",\n \"riskMatrixId\": \"<string>\",\n \"countries\": [\n {}\n ],\n \"scope\": {},\n \"tags\": [\n {}\n ],\n \"creationProvenance\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api.gu1.ai/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"targetEntityTypes\": [\n {}\n ],\n \"conditions\": {},\n \"actions\": [\n {}\n ],\n \"enabled\": true,\n \"priority\": 123,\n \"score\": 123,\n \"status\": \"<string>\",\n \"evaluationMode\": \"<string>\",\n \"riskMatrixId\": \"<string>\",\n \"countries\": [\n {}\n ],\n \"scope\": {},\n \"tags\": [\n {}\n ],\n \"creationProvenance\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/rules")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"targetEntityTypes\": [\n {}\n ],\n \"conditions\": {},\n \"actions\": [\n {}\n ],\n \"enabled\": true,\n \"priority\": 123,\n \"score\": 123,\n \"status\": \"<string>\",\n \"evaluationMode\": \"<string>\",\n \"riskMatrixId\": \"<string>\",\n \"countries\": [\n {}\n ],\n \"scope\": {},\n \"tags\": [\n {}\n ],\n \"creationProvenance\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"organizationId": "<string>",
"status": "<string>",
"enabled": true,
"version": 123,
"createdAt": "<string>",
"createdBy": "<string>",
"creationProvenance": {},
"aiReview": {}
}Referência API
Criar Regra
Criar uma nova regra para detecção de riscos e monitoramento de conformidade — no motor de regras gu1 para compliance e detecção de risco.
POST
/
rules
Criar Regra
curl --request POST \
--url http://api.gu1.ai/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"category": "<string>",
"targetEntityTypes": [
{}
],
"conditions": {},
"actions": [
{}
],
"enabled": true,
"priority": 123,
"score": 123,
"status": "<string>",
"evaluationMode": "<string>",
"riskMatrixId": "<string>",
"countries": [
{}
],
"scope": {},
"tags": [
{}
],
"creationProvenance": {}
}
'import requests
url = "http://api.gu1.ai/rules"
payload = {
"name": "<string>",
"description": "<string>",
"category": "<string>",
"targetEntityTypes": [{}],
"conditions": {},
"actions": [{}],
"enabled": True,
"priority": 123,
"score": 123,
"status": "<string>",
"evaluationMode": "<string>",
"riskMatrixId": "<string>",
"countries": [{}],
"scope": {},
"tags": [{}],
"creationProvenance": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
category: '<string>',
targetEntityTypes: [{}],
conditions: {},
actions: [{}],
enabled: true,
priority: 123,
score: 123,
status: '<string>',
evaluationMode: '<string>',
riskMatrixId: '<string>',
countries: [{}],
scope: {},
tags: [{}],
creationProvenance: {}
})
};
fetch('http://api.gu1.ai/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://api.gu1.ai/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'category' => '<string>',
'targetEntityTypes' => [
[
]
],
'conditions' => [
],
'actions' => [
[
]
],
'enabled' => true,
'priority' => 123,
'score' => 123,
'status' => '<string>',
'evaluationMode' => '<string>',
'riskMatrixId' => '<string>',
'countries' => [
[
]
],
'scope' => [
],
'tags' => [
[
]
],
'creationProvenance' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://api.gu1.ai/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"targetEntityTypes\": [\n {}\n ],\n \"conditions\": {},\n \"actions\": [\n {}\n ],\n \"enabled\": true,\n \"priority\": 123,\n \"score\": 123,\n \"status\": \"<string>\",\n \"evaluationMode\": \"<string>\",\n \"riskMatrixId\": \"<string>\",\n \"countries\": [\n {}\n ],\n \"scope\": {},\n \"tags\": [\n {}\n ],\n \"creationProvenance\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api.gu1.ai/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"targetEntityTypes\": [\n {}\n ],\n \"conditions\": {},\n \"actions\": [\n {}\n ],\n \"enabled\": true,\n \"priority\": 123,\n \"score\": 123,\n \"status\": \"<string>\",\n \"evaluationMode\": \"<string>\",\n \"riskMatrixId\": \"<string>\",\n \"countries\": [\n {}\n ],\n \"scope\": {},\n \"tags\": [\n {}\n ],\n \"creationProvenance\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/rules")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"category\": \"<string>\",\n \"targetEntityTypes\": [\n {}\n ],\n \"conditions\": {},\n \"actions\": [\n {}\n ],\n \"enabled\": true,\n \"priority\": 123,\n \"score\": 123,\n \"status\": \"<string>\",\n \"evaluationMode\": \"<string>\",\n \"riskMatrixId\": \"<string>\",\n \"countries\": [\n {}\n ],\n \"scope\": {},\n \"tags\": [\n {}\n ],\n \"creationProvenance\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"organizationId": "<string>",
"status": "<string>",
"enabled": true,
"version": 123,
"createdAt": "<string>",
"createdBy": "<string>",
"creationProvenance": {},
"aiReview": {}
}Visão Geral
Cria uma nova regra para detecção automatizada de riscos, monitoramento de conformidade e prevenção de fraudes. Toda criação executa revisão IA síncrona (incluída; não debita tokens de IA) antes de persistir. Regras novas ficam sempre emin_progress com enabled: false.
Os campos
status e enabled no create são ignorados — a API força in_progress e enabled: false. Espere vários segundos de latência. Bundles/modelos disparam uma revisão por regra.Endpoint
POST http://api.gu1.ai/rules
Autenticação
Requer uma chave API válida no cabeçalho de Authorization:Authorization: Bearer YOUR_API_KEY
Corpo da Requisição
string
required
Nome descritivo para a regra
string
required
Descrição detalhada do que a regra detecta
string
required
Categoria da regra:
kyc, kyb, aml, fraud, compliance, customarray
required
Array de tipos de entidade aos quais esta regra se aplica:
["person"], ["company"], ["transaction"], ["person", "company"]object
required
Estrutura de lógica de condições (veja Estrutura de Condições abaixo)
boolean
Ignorado no create — sempre salva
enabled: false.number
default:"50"
Prioridade da regra (1-100). Valores maiores = maior prioridade
number
Pontuação de risco a atribuir quando a regra corresponder (0-100). Usado em matrizes de risco baseadas em pontuação
string
Ignorado no create — sempre salva
in_progress (em configuração).string
default:"async"
Modo de avaliação:
sync (imediato) ou async (processamento em segundo plano)string
UUID da matriz de risco para associar esta regra
array
Array de códigos de país ISO para restringir a execução da regra:
["BR", "AR", "US"]object
Configuração de escopo adicional incluindo janelas temporais e gatilhos
array
Array de tags para organizar regras:
["high-risk", "pep", "sanctions"]object
Metadados opcionais de origem. Se omitido, default
api ou user. Campos: sourceType, conversationId, messageId, platformAgentCategory, triggeredByUserId.Estrutura de Condições
As regras usam uma estrutura de condições aninhadas com operadores lógicos:{
"operator": "AND" | "OR" | "NOT" | "XOR",
"conditions": [
{
"id": "cond-unique-id",
"type": "simple",
"field": "enrichmentData.normalized.taxId",
"operator": "eq",
"value": "12.345.678/0001-90",
"filters": [],
"countryMetadata": {
"countryCode": "BR",
"confidence": 100,
"manuallySet": true,
"autoDetected": false,
"reason": "Selected from BR enrichment fields"
}
}
]
}
Campos de Condições
- operator: Operador lógico conectando condições (
AND,OR,NOT,XOR) - conditions: Array de objetos de condição (podem ser aninhados para lógica complexa)
- id: Identificador único para a condição
- type: Tipo de condição (
simple,complex,array,object) - field: Caminho do campo a avaliar (ex.,
taxId,entityData.company.revenue,enrichmentData.normalized.sanctions.$.type) - operator: Operador de comparação (veja Operadores abaixo)
- value: Valor para comparar
- filters: Array de filtros para campos de array/objeto
- countryMetadata: Metadados específicos do país para a condição
Operadores
Operadores de Comparação
eq- Igualneq- Não igualgt- Maior quegte- Maior ou iguallt- Menor quelte- Menor ou igual
Operadores de String
contains- Contém substringnotContains- Não contém substringstartsWith- Começa comendsWith- Termina comregex- Corresponde à expressão regular
Operadores de Array
in- Valor está no arraynotIn- Valor não está no arrayhasAny- Tem algum dos valoreshasAll- Tem todos os valores
Operadores de Lista
inList- Valor existe em uma lista de dadosnotInList- Valor não existe em uma lista de dados
Operadores de Existência
exists- Campo existenotExists- Campo não existeisEmpty- Campo está vazio/nuloisNotEmpty- Campo não está vazio/nulo
Operadores Booleanos
isTrue- Campo booleano é verdadeiroisFalse- Campo booleano é falso
Sintaxe de Campos de Array
Para campos dentro de arrays, use o símbolo$:
{
"field": "enrichmentData.normalized.sanctions.$.type",
"operator": "in",
"value": "terrorism",
"filters": []
}
sanctions tem type igual a "terrorism".
Filtros
Você pode pré-filtrar itens do array antes da avaliação:{
"field": "enrichmentData.normalized.legalProceedings.$.amount",
"operator": "gt",
"value": 100000,
"filters": [
{
"field": "status",
"operator": "eq",
"value": "active"
}
]
}
Ações
As regras suportam múltiplos tipos de ações:Criar Alerta
{
"type": "createAlert",
"createAlert": {
"type": "FRAUD" | "COMPLIANCE" | "AML" | "KYC" | "OTHER",
"title": "High Risk Transaction Detected",
"description": "Transaction exceeds threshold",
"severity": "LOW" | "MEDIUM" | "HIGH" | "CRITICAL",
"recipients": ["user@example.com"]
},
"tags": ["high-value", "cross-border"]
}
Atualizar Status da Entidade
{
"type": "updateEntityStatus",
"updateEntityStatus": {
"status": "blocked",
"reason": "Failed sanctions check"
}
}
Enviar Notificação
{
"type": "sendNotification",
"sendNotification": {
"channel": "email" | "sms" | "webhook",
"recipients": ["compliance@company.com"],
"message": "Urgent: High risk entity detected"
}
}
Criar Caso
{
"type": "createCase",
"createCase": {
"title": "PEP Investigation Required",
"description": "Entity flagged as politically exposed person",
"assignee": "user-uuid"
}
}
Exemplos de Requisições
Regra KYC Simples - Verificar Tax ID
curl -X POST http://api.gu1.ai/rules \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "CNPJ Blocklist Check",
"description": "Block companies with specific CNPJ",
"category": "kyb",
"targetEntityTypes": ["company"],
"enabled": true,
"priority": 100,
"score": 85,
"conditions": {
"operator": "AND",
"conditions": [
{
"id": "cond-1",
"type": "simple",
"field": "enrichmentData.normalized.taxId",
"operator": "eq",
"value": "33.592.510/0001-54",
"filters": [],
"countryMetadata": {
"countryCode": "BR",
"confidence": 100,
"manuallySet": true,
"autoDetected": false,
"reason": "Selected from BR enrichment fields"
}
}
]
},
"actions": [
{
"type": "createAlert",
"createAlert": {
"type": "COMPLIANCE",
"title": "Blocklisted Company Detected",
"description": "Company CNPJ found in blocklist",
"severity": "CRITICAL",
"recipients": ["compliance@company.com"]
},
"tags": ["blocklist", "high-priority"]
},
{
"type": "updateEntityStatus",
"updateEntityStatus": {
"status": "blocked",
"reason": "CNPJ in blocklist"
}
}
],
"scope": {
"type": "entity",
"countries": ["BR"],
"entityTypes": ["company"]
},
"status": "active",
"evaluationMode": "sync"
}'
const response = await fetch('http://api.gu1.ai/rules', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'CNPJ Blocklist Check',
description: 'Block companies with specific CNPJ',
category: 'kyb',
targetEntityTypes: ['company'],
enabled: true,
priority: 100,
score: 85,
conditions: {
operator: 'AND',
conditions: [
{
id: 'cond-1',
type: 'simple',
field: 'enrichmentData.normalized.taxId',
operator: 'eq',
value: '33.592.510/0001-54',
filters: [],
countryMetadata: {
countryCode: 'BR',
confidence: 100,
manuallySet: true,
autoDetected: false,
reason: 'Selected from BR enrichment fields'
}
}
]
},
actions: [
{
type: 'createAlert',
createAlert: {
type: 'COMPLIANCE',
title: 'Blocklisted Company Detected',
description: 'Company CNPJ found in blocklist',
severity: 'CRITICAL',
recipients: ['compliance@company.com']
},
tags: ['blocklist', 'high-priority']
}
],
scope: {
type: 'entity',
countries: ['BR'],
entityTypes: ['company']
},
status: 'active',
evaluationMode: 'sync'
})
});
const rule = await response.json();
console.log('Regra criada:', rule.id);
import requests
response = requests.post(
'http://api.gu1.ai/rules',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'name': 'CNPJ Blocklist Check',
'description': 'Block companies with specific CNPJ',
'category': 'kyb',
'targetEntityTypes': ['company'],
'enabled': True,
'priority': 100,
'score': 85,
'conditions': {
'operator': 'AND',
'conditions': [
{
'id': 'cond-1',
'type': 'simple',
'field': 'enrichmentData.normalized.taxId',
'operator': 'eq',
'value': '33.592.510/0001-54',
'filters': [],
'countryMetadata': {
'countryCode': 'BR',
'confidence': 100,
'manuallySet': True,
'autoDetected': False,
'reason': 'Selected from BR enrichment fields'
}
}
]
},
'actions': [
{
'type': 'createAlert',
'createAlert': {
'type': 'COMPLIANCE',
'title': 'Blocklisted Company Detected',
'description': 'Company CNPJ found in blocklist',
'severity': 'CRITICAL',
'recipients': ['compliance@company.com']
},
'tags': ['blocklist', 'high-priority']
}
],
'scope': {
'type': 'entity',
'countries': ['BR'],
'entityTypes': ['company']
},
'status': 'active',
'evaluationMode': 'sync'
}
)
rule = response.json()
print(f"Regra criada: {rule['id']}")
Regra Complexa - Verificação de Sanções com Múltiplas Condições
curl -X POST http://api.gu1.ai/rules \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Terrorism Sanctions Check",
"description": "Detect entities with terrorism-related sanctions",
"category": "aml",
"targetEntityTypes": ["person", "company"],
"enabled": true,
"priority": 100,
"score": 95,
"conditions": {
"operator": "OR",
"conditions": [
{
"id": "cond-1",
"type": "simple",
"field": "enrichmentData.normalized.sanctions.$.type",
"operator": "in",
"value": "terrorism",
"filters": [],
"countryMetadata": {
"countryCode": "GLOBAL",
"confidence": 100,
"manuallySet": true,
"autoDetected": false,
"reason": "Global sanctions field"
}
},
{
"id": "cond-2",
"type": "simple",
"field": "enrichmentData.normalized.sanctioned",
"operator": "isTrue",
"value": true,
"filters": []
}
]
},
"actions": [
{
"type": "createAlert",
"createAlert": {
"type": "AML",
"title": "Sanctions Match - Immediate Review Required",
"description": "Entity matched terrorism sanctions list",
"severity": "CRITICAL",
"recipients": ["aml-team@company.com"]
},
"tags": ["sanctions", "terrorism", "critical"]
},
{
"type": "updateEntityStatus",
"updateEntityStatus": {
"status": "blocked",
"reason": "Terrorism sanctions match"
}
},
{
"type": "createCase",
"createCase": {
"title": "Sanctions Investigation Required",
"description": "Entity flagged for terrorism-related sanctions",
"assignee": "compliance-lead-uuid"
}
}
],
"scope": {
"type": "entity",
"entityTypes": ["person", "company"]
},
"status": "active",
"evaluationMode": "sync",
"tags": ["sanctions", "aml", "critical"]
}'
Regra de Monitoramento de Transações
curl -X POST http://api.gu1.ai/rules \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "High Value Transaction Alert",
"description": "Alert on transactions over $50,000 USD",
"category": "fraud",
"targetEntityTypes": ["transaction"],
"enabled": true,
"priority": 80,
"score": 70,
"conditions": {
"operator": "AND",
"conditions": [
{
"id": "cond-1",
"type": "simple",
"field": "amountInUsd",
"operator": "gt",
"value": 50000,
"filters": []
},
{
"id": "cond-2",
"type": "simple",
"field": "status",
"operator": "eq",
"value": "PENDING",
"filters": []
}
]
},
"actions": [
{
"type": "createAlert",
"createAlert": {
"type": "FRAUD",
"title": "High Value Transaction Detected",
"description": "Transaction exceeds $50,000 threshold",
"severity": "HIGH",
"recipients": ["fraud-team@company.com"]
},
"tags": ["high-value", "pending-review"]
}
],
"scope": {
"type": "transaction"
},
"status": "active",
"evaluationMode": "sync"
}'
Resposta
string
UUID da regra criada
string
Nome da regra
string
Descrição da regra
string
ID da sua organização
string
Status atual da regra
boolean
Se a regra está habilitada
number
Número da versão da regra
string
Timestamp ISO de criação
string
ID do usuário que criou a regra
object
Metadados de origem (
sourceType, ids opcionais de chat do agente).object
Resumo da revisão IA síncrona:
verified, reason, functionalityDescription, suggestions, issues.Exemplo de Resposta
{
"success": true,
"message": "Rule created successfully",
"rule": {
"id": "e2cdd639-52cc-4749-9b16-927bfa5dfaea",
"organizationId": "71e8f908-e032-4fcb-b0ce-ad0cd0ffb236",
"name": "CNPJ Blocklist Check",
"description": "Block companies with specific CNPJ",
"category": "kyb",
"status": "in_progress",
"enabled": false,
"priority": 100,
"score": 85,
"conditions": {
"operator": "AND",
"conditions": [...]
},
"actions": [
{
"type": "createAlert",
"createAlert": {...},
"tags": ["blocklist", "high-priority"]
}
],
"scope": {
"type": "entity",
"countries": ["BR"],
"entityTypes": ["company"]
},
"targetEntityTypes": ["company"],
"evaluationMode": "sync",
"version": 1,
"previousVersionId": null,
"tags": [],
"createdBy": "f35c10cb-9b67-4cda-9aea-f36567375dba",
"createdAt": "2024-12-23T10:00:00.000Z",
"updatedAt": "2024-12-23T10:00:00.000Z",
"stats": {
"executions": 0,
"successes": 0,
"failures": 0
}
},
"aiReview": {
"verified": true,
"reason": "Condições alinhadas com a descrição.",
"functionalityDescription": "Cria alerta KYB quando o CNPJ coincide com a blocklist.",
"suggestions": [],
"issues": []
}
}
Respostas de Erro
400 Bad Request - Condição Inválida
{
"error": "Validation failed",
"details": {
"field": "conditions",
"message": "Invalid operator 'xyz'"
}
}
400 Bad Request - Campos Obrigatórios Faltando
{
"error": "Validation failed",
"details": {
"missingFields": ["name", "targetEntityTypes", "conditions"]
}
}
401 Unauthorized
{
"error": "Invalid or missing API key"
}
Melhores Práticas
- Comece com Modo Shadow: Use
status: "shadow"para testar regras sem afetar produção - Use Nomes Descritivos: Torne os nomes das regras claros e pesquisáveis
- Defina Prioridades Apropriadas: Regras de maior prioridade executam primeiro (escala 1-100)
- Marque suas Regras: Use tags para organização e filtragem
- Regras Específicas por País: Use
scope.countriespara conformidade geo-específica - Teste Completamente: Teste regras com dados de exemplo antes de habilitar
- Monitore o Desempenho: Use modo sync para regras críticas em tempo real, async para processamento em lote
- Pontue Estrategicamente: Alinhe pontuações com os limites da sua matriz de risco
Veja Também
- Referência de Campos de Condições - Lista completa de campos de condição disponíveis por tipo de entidade e país
- Executar Regra - Testar regras contra entidades específicas
- Listar Regras - Consultar e filtrar regras
- Atualizar Regra - Modificar regras existentes
Was this page helpful?