Atualizar uma entidade por ID
curl --request PATCH \
--url http://api.gu1.ai/entities/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"taxId": "<string>",
"email": {},
"phone": {},
"nationality": {},
"countryCode": "<string>",
"attributes": {},
"status": "<string>",
"reason": "<string>",
"changeStatusManual": true,
"riskMatrixId": [
"<string>"
],
"riskMatrixIds": [
"<string>"
],
"skipRulesExecution": true,
"entityData": {}
}
'import requests
url = "http://api.gu1.ai/entities/{id}"
payload = {
"name": "<string>",
"taxId": "<string>",
"email": {},
"phone": {},
"nationality": {},
"countryCode": "<string>",
"attributes": {},
"status": "<string>",
"reason": "<string>",
"changeStatusManual": True,
"riskMatrixId": ["<string>"],
"riskMatrixIds": ["<string>"],
"skipRulesExecution": True,
"entityData": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
taxId: '<string>',
email: {},
phone: {},
nationality: {},
countryCode: '<string>',
attributes: {},
status: '<string>',
reason: '<string>',
changeStatusManual: true,
riskMatrixId: ['<string>'],
riskMatrixIds: ['<string>'],
skipRulesExecution: true,
entityData: {}
})
};
fetch('http://api.gu1.ai/entities/{id}', 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/entities/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'taxId' => '<string>',
'email' => [
],
'phone' => [
],
'nationality' => [
],
'countryCode' => '<string>',
'attributes' => [
],
'status' => '<string>',
'reason' => '<string>',
'changeStatusManual' => true,
'riskMatrixId' => [
'<string>'
],
'riskMatrixIds' => [
'<string>'
],
'skipRulesExecution' => true,
'entityData' => [
]
]),
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/entities/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"taxId\": \"<string>\",\n \"email\": {},\n \"phone\": {},\n \"nationality\": {},\n \"countryCode\": \"<string>\",\n \"attributes\": {},\n \"status\": \"<string>\",\n \"reason\": \"<string>\",\n \"changeStatusManual\": true,\n \"riskMatrixId\": [\n \"<string>\"\n ],\n \"riskMatrixIds\": [\n \"<string>\"\n ],\n \"skipRulesExecution\": true,\n \"entityData\": {}\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://api.gu1.ai/entities/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"taxId\": \"<string>\",\n \"email\": {},\n \"phone\": {},\n \"nationality\": {},\n \"countryCode\": \"<string>\",\n \"attributes\": {},\n \"status\": \"<string>\",\n \"reason\": \"<string>\",\n \"changeStatusManual\": true,\n \"riskMatrixId\": [\n \"<string>\"\n ],\n \"riskMatrixIds\": [\n \"<string>\"\n ],\n \"skipRulesExecution\": true,\n \"entityData\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"taxId\": \"<string>\",\n \"email\": {},\n \"phone\": {},\n \"nationality\": {},\n \"countryCode\": \"<string>\",\n \"attributes\": {},\n \"status\": \"<string>\",\n \"reason\": \"<string>\",\n \"changeStatusManual\": true,\n \"riskMatrixId\": [\n \"<string>\"\n ],\n \"riskMatrixIds\": [\n \"<string>\"\n ],\n \"skipRulesExecution\": true,\n \"entityData\": {}\n}"
response = http.request(request)
puts response.read_body{
"entity": {},
"previousEntity": {}
}Atualizar uma entidade por ID
Atualizar atributos e dados de uma pessoa ou empresa existente — no modelo universal de entidades gu1 para KYC, KYB e análise de risco.
PATCH
/
entities
/
{id}
Atualizar uma entidade por ID
curl --request PATCH \
--url http://api.gu1.ai/entities/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"taxId": "<string>",
"email": {},
"phone": {},
"nationality": {},
"countryCode": "<string>",
"attributes": {},
"status": "<string>",
"reason": "<string>",
"changeStatusManual": true,
"riskMatrixId": [
"<string>"
],
"riskMatrixIds": [
"<string>"
],
"skipRulesExecution": true,
"entityData": {}
}
'import requests
url = "http://api.gu1.ai/entities/{id}"
payload = {
"name": "<string>",
"taxId": "<string>",
"email": {},
"phone": {},
"nationality": {},
"countryCode": "<string>",
"attributes": {},
"status": "<string>",
"reason": "<string>",
"changeStatusManual": True,
"riskMatrixId": ["<string>"],
"riskMatrixIds": ["<string>"],
"skipRulesExecution": True,
"entityData": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
taxId: '<string>',
email: {},
phone: {},
nationality: {},
countryCode: '<string>',
attributes: {},
status: '<string>',
reason: '<string>',
changeStatusManual: true,
riskMatrixId: ['<string>'],
riskMatrixIds: ['<string>'],
skipRulesExecution: true,
entityData: {}
})
};
fetch('http://api.gu1.ai/entities/{id}', 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/entities/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'taxId' => '<string>',
'email' => [
],
'phone' => [
],
'nationality' => [
],
'countryCode' => '<string>',
'attributes' => [
],
'status' => '<string>',
'reason' => '<string>',
'changeStatusManual' => true,
'riskMatrixId' => [
'<string>'
],
'riskMatrixIds' => [
'<string>'
],
'skipRulesExecution' => true,
'entityData' => [
]
]),
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/entities/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"taxId\": \"<string>\",\n \"email\": {},\n \"phone\": {},\n \"nationality\": {},\n \"countryCode\": \"<string>\",\n \"attributes\": {},\n \"status\": \"<string>\",\n \"reason\": \"<string>\",\n \"changeStatusManual\": true,\n \"riskMatrixId\": [\n \"<string>\"\n ],\n \"riskMatrixIds\": [\n \"<string>\"\n ],\n \"skipRulesExecution\": true,\n \"entityData\": {}\n}")
req, _ := http.NewRequest("PATCH", 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.patch("http://api.gu1.ai/entities/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"taxId\": \"<string>\",\n \"email\": {},\n \"phone\": {},\n \"nationality\": {},\n \"countryCode\": \"<string>\",\n \"attributes\": {},\n \"status\": \"<string>\",\n \"reason\": \"<string>\",\n \"changeStatusManual\": true,\n \"riskMatrixId\": [\n \"<string>\"\n ],\n \"riskMatrixIds\": [\n \"<string>\"\n ],\n \"skipRulesExecution\": true,\n \"entityData\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"taxId\": \"<string>\",\n \"email\": {},\n \"phone\": {},\n \"nationality\": {},\n \"countryCode\": \"<string>\",\n \"attributes\": {},\n \"status\": \"<string>\",\n \"reason\": \"<string>\",\n \"changeStatusManual\": true,\n \"riskMatrixId\": [\n \"<string>\"\n ],\n \"riskMatrixIds\": [\n \"<string>\"\n ],\n \"skipRulesExecution\": true,\n \"entityData\": {}\n}"
response = http.request(request)
puts response.read_body{
"entity": {},
"previousEntity": {}
}Visão Geral
Atualiza os atributos e dados de uma entidade existente. Se a entidade tiver matriz atribuída com triggerentity_updated, o motor de regras pode executar após a atualização (respeitando watchFields opcionais na matriz e skipRulesExecution). Auditoria e eventos em tempo real são sempre registrados.
Endpoint
PATCH http://api.gu1.ai/entities/{id}
Autenticação
Requer uma chave de API válida no cabeçalho Authorization:Authorization: Bearer YOUR_API_KEY
Parâmetros de Caminho
string
required
O ID gu1 da entidade a ser atualizada
Corpo da Requisição
Todos os campos do schema de criação estão disponíveis, excetotype (o tipo de entidade não pode ser alterado). Todos os campos são opcionais - inclua apenas os campos que deseja atualizar.
string
Atualizar o nome de exibição da entidade
O ID externo não é atualizado neste endpoint. Use Alterar ID externo (
POST /entities/change-external-id) com reason obrigatório (mín. 5 caracteres). As rotas PATCH de atualização ignoram externalId no corpo.string
Atualizar número de identificação fiscal
string | null
Atualizar o e-mail de contato na raiz da entidade. Omita o campo para não alterar; envie
null para limpar.string | null
Atualizar o telefone de contato na raiz da entidade. Omita o campo para não alterar; envie
null para limpar.string | null
Nacionalidade na raiz (ISO 3166-1 alpha-2 ao persistir). Omita para não alterar;
null remove. Se atualizar nationality em entityData de pessoa/empresa, a raiz pode ser recalculada quando vier no mesmo request.string
Atualizar código de país ISO 3166-1 alpha-2
object
Atualizar atributos personalizados (mescla com as chaves de primeiro nível existentes).Os atributos são armazenados exatamente como enviados: a forma que você envia é a forma que recebe na leitura.Sem categoria (plano): valores escalares ou arrays no primeiro nível.Categorizado (aninhado): um objeto de primeiro nível agrupa suas chaves internas sob essa categoria. A chave do objeto é a categoria — use chaves seguras como identificador (ex.: Regras e webhooks leem a forma armazenada: chaves planas como
{ "phone": "+54...", "mcc": "5411" }
contact, category_billing) para funcionarem em caminhos de regra.{
"contact": { "phone": "+54..." },
"commercial": { "mcc": "5411" }
}
attributes.phone, aninhadas como attributes.contact.phone.string
Status do ciclo de vida (
active, inactive, blocked, under_review, pending_verification, awaiting_information, suspended, expired, rejected, deleted, not_started).Obrigatório com reason: qualquer mudança de status deve incluir reason para auditoria.string
Motivo da atualização (especialmente ao mudar o status para
blocked ou rejected).Obrigatório quando: mudança de status para blocked, rejected ou suspended.boolean
default:"false"
Com
true, atualizações automáticas de status são desativadas: regras de matriz de risco e automações como set_entity_status não alteram o status. Atualizações manuais por este endpoint (ou UI) continuam válidas.- Padrão:
false. - Enviar
falseexplicitamente remove o bloqueio. - Não desativa cálculo de risco nem outros efeitos de regras; apenas gravações de status por regras/automações.
reason: se changeStatusManual mudar (ativar ou desativar), enviar reason no mesmo PATCH para auditoria.Matrizes de risco
Atribuir ou substituir as matrizes de risco da entidade. Mesma semântica de Criar entidade (riskMatrixId / riskMatrixIds).
string | string[] | null
Legacy: um UUID, um array de UUIDs ou
null para remover todas as matrizes atribuídas. Se riskMatrixIds vier não vazio, tem precedência sobre este campo.string[]
Forma preferida para várias matrizes: lista ordenada de UUIDs da sua organização. Envie
[] (ou riskMatrixId: null) para desatribuir todas. Cada UUID deve existir na org; caso contrário a API retorna 400 com código INVALID_RISK_MATRIX.boolean
default:"false"
Com
true, pula a avaliação automática de matrizes na atualização mesmo que existam matrizes com trigger entity_updated.Atualizar matrizes apenas persiste a atribuição; a atribuição sozinha não executa regras.Regras na atualização: se a entidade tiver ao menos uma matriz com trigger
entity_updated e skipRulesExecution não for true, a API executa o motor após mudança de campos. Matrizes podem restringir com watchFields (somente quando paths listados mudam, ex. email, attributes.clientTypes). O webhook entity.updated inclui rulesExecutionSummary quando regras rodaram ou foram omitidas com motivo.Os mesmos campos se aplicam em Atualizar por ID externo e PATCH /entities/by-tax-id/{taxId}.object
Atualizar dados específicos do tipo (mescla com entityData existente)
Resposta
object
O objeto da entidade atualizada com todos os valores atuais
object
O estado da entidade antes da atualização (para auditoria/comparação)
O corpo HTTP não inclui
rulesExecutionSummary. Quando regras rodam (ou são omitidas), o resumo vai no webhook entity.updated.Comportamento
Quando você atualiza uma entidade, o sistema:- Registra a alteração na auditoria com valores antes/depois
- Executa matrizes de risco quando há matrizes atribuídas com
entity_updated,skipRulesExecutionnão étrue, ewatchFieldsopcionais coincidem com campos alterados - Emite evento em tempo real para clientes conectados
- Dispara webhook
entity.updatedcomchangese opcionalrulesExecutionSummary - Mantém trilha de auditoria para fins de conformidade e revisão
Exemplos
Atualizar Renda de Pessoa
curl -X PATCH http://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityData": {
"person": {
"income": 95000,
"occupation": "Senior Software Engineer"
}
}
}'
const response = await fetch(
'http://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityData: {
person: {
income: 95000,
occupation: 'Senior Software Engineer'
}
}
})
}
);
const result = await response.json();
console.log('Updated entity:', result.entity);
console.log('Re-evaluation triggered:', result.evaluation.id);
import requests
response = requests.patch(
'http://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'entityData': {
'person': {
'income': 95000,
'occupation': 'Senior Software Engineer'
}
}
}
)
result = response.json()
print(f"Updated entity: {result['entity']['name']}")
print(f"Re-evaluation ID: {result['evaluation']['id']}")
Atualizar Informações da Empresa
curl -X PATCH http://api.gu1.ai/entities/660e9511-f39c-52e5-b827-557766551111 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityData": {
"company": {
"employeeCount": 75,
"revenue": 7500000
}
},
"attributes": {
"partnershipTier": "platinum",
"monthlyVolume": 500000
}
}'
const response = await fetch(
'http://api.gu1.ai/entities/660e9511-f39c-52e5-b827-557766551111',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityData: {
company: {
employeeCount: 75,
revenue: 7500000
}
},
attributes: {
partnershipTier: 'platinum',
monthlyVolume: 500000
}
})
}
);
const result = await response.json();
console.log('Company updated:', result.entity.name);
console.log('New revenue:', result.entity.entityData.company.revenue);
import requests
response = requests.patch(
'http://api.gu1.ai/entities/660e9511-f39c-52e5-b827-557766551111',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'entityData': {
'company': {
'employeeCount': 75,
'revenue': 7500000
}
},
'attributes': {
'partnershipTier': 'platinum',
'monthlyVolume': 500000
}
}
)
result = response.json()
print(f"Company updated: {result['entity']['name']}")
print(f"New revenue: ${result['entity']['entityData']['company']['revenue']:,}")
Atualizar Apenas Atributos Personalizados
curl -X PATCH http://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"attributes": {
"accountTier": "premium",
"loyaltyPoints": 15000,
"lastLoginDate": "2024-10-03T14:00:00Z"
}
}'
const response = await fetch(
'http://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
attributes: {
accountTier: 'premium',
loyaltyPoints: 15000,
lastLoginDate: '2024-10-03T14:00:00Z'
}
})
}
);
const result = await response.json();
console.log('Attributes updated:', result.entity.attributes);
import requests
response = requests.patch(
'http://api.gu1.ai/entities/550e8400-e29b-41d4-a716-446655440000',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'attributes': {
'accountTier': 'premium',
'loyaltyPoints': 15000,
'lastLoginDate': '2024-10-03T14:00:00Z'
}
}
)
result = response.json()
print(f"Attributes updated: {result['entity']['attributes']}")
Atualizar Status da Transação
curl -X PATCH http://api.gu1.ai/entities/770f0622-g40d-63f6-c938-668877662222 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityData": {
"transaction": {
"status": "reviewed",
"flagged": false
}
}
}'
const response = await fetch(
'http://api.gu1.ai/entities/770f0622-g40d-63f6-c938-668877662222',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityData: {
transaction: {
status: 'reviewed',
flagged: false
}
}
})
}
);
const result = await response.json();
console.log('Transaction status updated');
import requests
response = requests.patch(
'http://api.gu1.ai/entities/770f0622-g40d-63f6-c938-668877662222',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'entityData': {
'transaction': {
'status': 'reviewed',
'flagged': False
}
}
}
)
result = response.json()
print("Transaction status updated")
Exemplo de Resposta
{
"entity": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"externalId": "customer_12345",
"organizationId": "8e2f89ab-c216-4eb4-90eb-ca5d44499aaa",
"type": "person",
"name": "María González",
"taxId": "20-12345678-9",
"countryCode": "AR",
"riskScore": 22,
"riskFactors": [...],
"status": "active",
"kycVerified": true,
"entityData": {
"person": {
"firstName": "María",
"lastName": "González",
"dateOfBirth": "1985-03-15",
"nationality": "AR",
"occupation": "Senior Software Engineer",
"income": 95000
}
},
"attributes": {
"email": "maria.gonzalez@example.com",
"phone": "+54 11 1234-5678",
"accountTier": "premium"
},
"createdAt": "2024-10-03T14:30:00.000Z",
"updatedAt": "2024-10-03T16:45:00.000Z",
"deletedAt": null
},
"evaluation": {
"id": "eval_new_123",
"entityId": "550e8400-e29b-41d4-a716-446655440000",
"decision": "PENDING",
"evaluationType": "SYSTEM",
"reasons": ["Re-evaluation triggered by attribute change"],
"rules": [],
"entitySnapshot": {...}
},
"previousEntity": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"entityData": {
"person": {
"occupation": "Software Engineer",
"income": 85000
}
},
"updatedAt": "2024-10-03T14:35:00.000Z"
}
}
Respostas de Erro
404 Not Found
{
"error": "Entity not found"
}
400 Bad Request - Dados Inválidos
{
"error": "Validation failed",
"details": ["Invalid country code format"]
}
401 Unauthorized
{
"error": "Invalid or missing API key"
}
500 Internal Server Error
{
"error": "Failed to update entity"
}
Casos de Uso
Atualizar Após Verificação KYC
// Após concluir a verificação KYC, atualizar a entidade
const response = await fetch(`http://api.gu1.ai/entities/${entityId}`, {
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
attributes: {
kycVerified: true,
kycVerificationDate: new Date().toISOString(),
kycProvider: 'manual_review'
}
})
});
Enriquecimento Progressivo de Perfil
# Enriquecer perfil do cliente conforme mais informações ficam disponíveis
def update_customer_info(entity_id, new_data):
response = requests.patch(
f'http://api.gu1.ai/entities/{entity_id}',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'entityData': {
'person': new_data
},
'attributes': {
'lastDataUpdate': datetime.now().isoformat(),
'dataCompleteness': calculate_completeness(new_data)
}
}
)
return response.json()
Resolução de Transação
// Marcar uma transação sinalizada como resolvida após investigação
async function resolveTransaction(txnId, resolution) {
const response = await fetch(`http://api.gu1.ai/entities/${txnId}`, {
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
entityData: {
transaction: {
status: 'resolved',
flagged: false
}
},
attributes: {
resolutionDate: new Date().toISOString(),
resolutionNotes: resolution,
reviewedBy: 'compliance_team'
}
})
});
return response.json();
}
Melhores Práticas
- Atualizações Parciais: Envie apenas os campos que deseja alterar - não é necessário enviar a entidade inteira
- Monitorar Reavaliações: Verifique o ID da avaliação retornado para acompanhar o recálculo da pontuação de risco
- Trilha de Auditoria: Use o
previousEntityna resposta para manter o histórico de alterações - Sincronização em Tempo Real: Atualizações emitem eventos WebSocket para sincronização de UI em tempo real
- Idempotência: Seguro para tentar novamente - atualizações com os mesmos dados não criarão eventos duplicados
Próximos Passos
- Obter Entidade - Visualizar detalhes da entidade atualizada
- Listar Entidades - Consultar entidades com filtros
- Upsert Entidade - Criar ou atualizar em uma operação
- Solicitar Análise de IA - Obter avaliação de risco atualizada
Was this page helpful?