Atualizar atributos da entidade
curl --request PATCH \
--url http://api.gu1.ai/entities/{id}/attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"attributes": {},
"mode": "<string>",
"skipRulesExecution": true
}
'import requests
url = "http://api.gu1.ai/entities/{id}/attributes"
payload = {
"attributes": {},
"mode": "<string>",
"skipRulesExecution": True
}
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({attributes: {}, mode: '<string>', skipRulesExecution: true})
};
fetch('http://api.gu1.ai/entities/{id}/attributes', 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}/attributes",
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([
'attributes' => [
],
'mode' => '<string>',
'skipRulesExecution' => true
]),
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}/attributes"
payload := strings.NewReader("{\n \"attributes\": {},\n \"mode\": \"<string>\",\n \"skipRulesExecution\": true\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}/attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"attributes\": {},\n \"mode\": \"<string>\",\n \"skipRulesExecution\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}/attributes")
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 \"attributes\": {},\n \"mode\": \"<string>\",\n \"skipRulesExecution\": true\n}"
response = http.request(request)
puts response.read_bodyReferência API
Atualizar atributos da entidade
Atualiza apenas atributos personalizados — modo merge aditivo ou substituição total. Dispara matrizes de risco entity_updated quando configurado.
PATCH
/
entities
/
{id}
/
attributes
Atualizar atributos da entidade
curl --request PATCH \
--url http://api.gu1.ai/entities/{id}/attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"attributes": {},
"mode": "<string>",
"skipRulesExecution": true
}
'import requests
url = "http://api.gu1.ai/entities/{id}/attributes"
payload = {
"attributes": {},
"mode": "<string>",
"skipRulesExecution": True
}
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({attributes: {}, mode: '<string>', skipRulesExecution: true})
};
fetch('http://api.gu1.ai/entities/{id}/attributes', 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}/attributes",
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([
'attributes' => [
],
'mode' => '<string>',
'skipRulesExecution' => true
]),
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}/attributes"
payload := strings.NewReader("{\n \"attributes\": {},\n \"mode\": \"<string>\",\n \"skipRulesExecution\": true\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}/attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"attributes\": {},\n \"mode\": \"<string>\",\n \"skipRulesExecution\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/{id}/attributes")
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 \"attributes\": {},\n \"mode\": \"<string>\",\n \"skipRulesExecution\": true\n}"
response = http.request(request)
puts response.read_bodyVisão geral
Atualiza somenteattributes sem alterar outros campos do perfil. Dois modos:
| Modo | Comportamento |
|---|---|
merge (padrão) | Merge superficial: chaves enviadas sobrescrevem ou criam valores; chaves não enviadas são mantidas |
replace | Substituição total: o objeto attributes do body vira o mapa completo ({} limpa tudo) |
{
"mode": "merge",
"attributes": {
"contact": { "phone": "+54..." },
"otro_grupo": { "branchCode": "AR-01" }
}
}
O merge é raso no primeiro nível: enviar um objeto de categoria (ex.:
contact) substitui toda essa categoria. Chaves internas não incluídas são descartadas. Use replace para reescrever tudo.entity_updated, as regras rodam após o patch (respeita skipRulesExecution e watchFields). Webhook entity.updated é emitido com changes.attributes.
Endpoint
PATCH http://api.gu1.ai/entities/{id}/attributes
Autenticação
Requerentities:edit (fallback legacy: entities:write).
Authorization: Bearer YOUR_API_KEY
Parâmetros de rota
string
required
UUID da entidade.
Body
object
required
Mapa de atributos. Armazenado exatamente como enviado: valores escalares/array na raiz ficam sem categoria; objetos aninhados atuam como categorias.
string
default:"merge"
merge — patch aditivo (padrão). replace — substituição completa.boolean
Com
true, omite execução de matrizes de risco após a atualização.Resposta
| Campo | Tipo | Descrição |
|---|---|---|
data.entityId | string | UUID da entidade |
data.mode | string | merge ou replace aplicado |
data.attributes | object | Atributos finais |
data.updatedAt | string | Timestamp ISO 8601 |
data.rulesExecutionSummary | object | Resumo da execução de regras |
Exemplos
Merge (padrão)
curl -X PATCH "https://api.gu1.ai/entities/{id}/attributes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"attributes": {
"contact": { "phone": "+54115550000" }
}
}'
Substituição total
curl -X PATCH "https://api.gu1.ai/entities/{id}/attributes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "replace",
"attributes": {
"commercial": { "mcc": "5411" }
}
}'
attributes são removidas.
Erros
| HTTP | Código | Quando |
|---|---|---|
| 404 | ENTITY_NOT_FOUND | Entidade inexistente ou outra org |
| 400 | validation | Body inválido |
Was this page helpful?