Cambiar el tipo de una empresa
curl --request POST \
--url http://api.gu1.ai/entities/change-type \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityId": {},
"externalId": "<string>",
"taxId": "<string>",
"type": "<string>",
"reason": "<string>"
}
'import requests
url = "http://api.gu1.ai/entities/change-type"
payload = {
"entityId": {},
"externalId": "<string>",
"taxId": "<string>",
"type": "<string>",
"reason": "<string>"
}
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({
entityId: {},
externalId: '<string>',
taxId: '<string>',
type: '<string>',
reason: '<string>'
})
};
fetch('http://api.gu1.ai/entities/change-type', 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/change-type",
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([
'entityId' => [
],
'externalId' => '<string>',
'taxId' => '<string>',
'type' => '<string>',
'reason' => '<string>'
]),
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/change-type"
payload := strings.NewReader("{\n \"entityId\": {},\n \"externalId\": \"<string>\",\n \"taxId\": \"<string>\",\n \"type\": \"<string>\",\n \"reason\": \"<string>\"\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/entities/change-type")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityId\": {},\n \"externalId\": \"<string>\",\n \"taxId\": \"<string>\",\n \"type\": \"<string>\",\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/change-type")
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 \"entityId\": {},\n \"externalId\": \"<string>\",\n \"taxId\": \"<string>\",\n \"type\": \"<string>\",\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"changed": true,
"entity": {},
"riskMatrixExecuted": true
}Referencia API
Cambiar el tipo de una empresa
Reclasificar una empresa como persona, o una persona como empresa. El motivo es opcional y, si se envía, queda en la auditoría. No se vuelve a ejecutar la matriz de riesgo.
POST
/
entities
/
change-type
Cambiar el tipo de una empresa
curl --request POST \
--url http://api.gu1.ai/entities/change-type \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entityId": {},
"externalId": "<string>",
"taxId": "<string>",
"type": "<string>",
"reason": "<string>"
}
'import requests
url = "http://api.gu1.ai/entities/change-type"
payload = {
"entityId": {},
"externalId": "<string>",
"taxId": "<string>",
"type": "<string>",
"reason": "<string>"
}
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({
entityId: {},
externalId: '<string>',
taxId: '<string>',
type: '<string>',
reason: '<string>'
})
};
fetch('http://api.gu1.ai/entities/change-type', 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/change-type",
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([
'entityId' => [
],
'externalId' => '<string>',
'taxId' => '<string>',
'type' => '<string>',
'reason' => '<string>'
]),
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/change-type"
payload := strings.NewReader("{\n \"entityId\": {},\n \"externalId\": \"<string>\",\n \"taxId\": \"<string>\",\n \"type\": \"<string>\",\n \"reason\": \"<string>\"\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/entities/change-type")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entityId\": {},\n \"externalId\": \"<string>\",\n \"taxId\": \"<string>\",\n \"type\": \"<string>\",\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/entities/change-type")
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 \"entityId\": {},\n \"externalId\": \"<string>\",\n \"taxId\": \"<string>\",\n \"type\": \"<string>\",\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"changed": true,
"entity": {},
"riskMatrixExecuted": true
}Resumen
Usá este endpoint para cambiar una entidad entre company y person.PATCH /entities/:id, PATCH /entities/by-external-id/:externalId y PATCH /entities/by-tax-id/:taxId ignoran type en el cuerpo.
La operación:
- Actualiza solo
type. - Conserva el nombre, el documento fiscal, los socios, los enrichments y el resto de la ficha.
- No vuelve a ejecutar la matriz de riesgo. La próxima evaluación usa el tipo nuevo. Si el tipo cambió, la respuesta incluye
riskMatrixExecuted: false.
changed: false). Los tipos distintos de person y company no se pueden cambiar (409 ENTITY_TYPE_NOT_CHANGEABLE).
reason es opcional. Si lo enviás, la auditoría unificada lo guarda como typeChangeReason, junto con previousType, newType y source: change_entity_type_endpoint. Se dispara el webhook entity.updated con changes.type.
Endpoint
POST https://api.gu1.ai/entities/change-type
Autenticación
Authorization: Bearer YOUR_API_KEY
Cuerpo
Mandá exactamente un campo de búsqueda y el tipo destino.reason es opcional.
Solo búsqueda: documento fiscal de una entidad que ya tiene un valor no vacío. La comparación ignora la puntuación. Si matchea más de una, la API responde
409 AMBIGUOUS_TAX_ID_LOOKUP.Motivo de auditoría opcional, máximo 4000 caracteres (después del trim). Si no se envía, no se guarda.
Respuesta
Errores
| HTTP | Código | Significado |
|---|---|---|
| 400 | VALIDATION_ERROR, INVALID_LOOKUP | Cero o más de un campo de búsqueda, o type inválido |
| 403 | ENTITY_ARCHIVED | La entidad está archivada |
| 404 | NOT_FOUND | Ninguna entidad coincide con la búsqueda |
| 409 | AMBIGUOUS_TAX_ID_LOOKUP | Varias entidades comparten el documento fiscal normalizado |
| 409 | ENTITY_TYPE_NOT_CHANGEABLE | El tipo actual no es person ni company |
Ejemplo
curl -X POST "https://api.gu1.ai/entities/change-type" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entityId": "550e8400-e29b-41d4-a716-446655440000",
"type": "person",
"reason": "La ficha de empresa es una persona física en el registro"
}'
{
"externalId": "crm_account_102",
"type": "person",
"reason": "Quedó mal clasificada en el import; el documento es de una persona"
}
{
"taxId": "30-71234567-8",
"type": "company",
"reason": "El CUIT es de una empresa; la ficha se creó como persona"
}
Was this page helpful?