Actualizar atributos de entidad
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_bodyReferencia API
Actualizar atributos de entidad
Actualiza solo los atributos personalizados de una entidad — modo merge aditivo o reemplazo total. Dispara matrices de riesgo entity_updated cuando corresponde.
PATCH
/
entities
/
{id}
/
attributes
Actualizar atributos de entidad
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_bodyResumen
Actualiza soloattributes sin modificar el resto del perfil. Dos modos:
| Modo | Comportamiento |
|---|---|
merge (default) | Merge superficial: las claves enviadas pisan o crean valores; las no enviadas se conservan |
replace | Reemplazo total: el objeto attributes del body es el mapa completo ({} borra todo) |
{
"mode": "merge",
"attributes": {
"contact": { "phone": "+54..." },
"otro_grupo": { "branchCode": "AR-01" }
}
}
El merge es superficial en el primer nivel: enviar un objeto de categoría (p. ej.
contact) reemplaza toda esa categoría. Las claves internas no incluidas se pierden. Usá replace para reescribir todo.entity_updated, corren reglas tras el patch (respeta skipRulesExecution y watchFields). Se emite webhook entity.updated con changes.attributes.
Endpoint
PATCH http://api.gu1.ai/entities/{id}/attributes
Autenticación
Requiereentities:edit (fallback legacy: entities:write).
Authorization: Bearer YOUR_API_KEY
Parámetros de ruta
string
required
UUID de la entidad.
Body
object
required
Mapa de atributos. Se almacena tal cual: valores escalares/array en la raíz quedan sin categoría; los objetos anidados actúan como categorías.
string
default:"merge"
merge — patch aditivo (default). replace — reemplazo completo.boolean
Con
true, omite ejecución de matrices de riesgo tras la actualización.Respuesta
| Campo | Tipo | Descripción |
|---|---|---|
data.entityId | string | UUID de la entidad |
data.mode | string | merge o replace aplicado |
data.attributes | object | Atributos finales |
data.updatedAt | string | Timestamp ISO 8601 |
data.rulesExecutionSummary | object | Resumen de ejecución de reglas |
Ejemplos
Merge (default)
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" }
}
}'
Reemplazo 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 se eliminan.
Errores
| HTTP | Código | Cuándo |
|---|---|---|
| 404 | ENTITY_NOT_FOUND | Entidad inexistente u otra org |
| 400 | validation | Body inválido |
Was this page helpful?