Change company type
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
}API Reference
Change company type
Reclassify a company as a person, or a person as a company. An optional reason is stored in the audit when you send it. The risk matrix is not re-run.
POST
/
entities
/
change-type
Change company type
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
}Overview
Use this endpoint to change an entity between company and person.PATCH /entities/:id, PATCH /entities/by-external-id/:externalId, and PATCH /entities/by-tax-id/:taxId ignore type in the body.
The operation:
- Updates only
type. - Keeps the name, tax ID, shareholders, enrichments, and the rest of the record.
- Does not re-run the risk matrix. The next evaluation uses the new type. The response includes
riskMatrixExecuted: falsewhen the type changed.
changed: false). Types other than person and company cannot be changed (409 ENTITY_TYPE_NOT_CHANGEABLE).
reason is optional. When you send it, the unified audit stores it as typeChangeReason, together with previousType, newType, and source: change_entity_type_endpoint. A webhook entity.updated is sent with changes.type.
Endpoint
POST https://api.gu1.ai/entities/change-type
Authentication
Authorization: Bearer YOUR_API_KEY
Request Body
Provide exactly one lookup field, plus the target type.reason is optional.
Lookup only: tax ID of an entity that already has a non-empty tax ID stored. Matching ignores punctuation. If more than one entity matches, the API returns
409 AMBIGUOUS_TAX_ID_LOOKUP.Response
Errors
| HTTP | Code / shape | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR, INVALID_LOOKUP | Zero or more than one lookup field, or invalid type |
| 403 | ENTITY_ARCHIVED | The entity is archived |
| 404 | NOT_FOUND | No entity matches the lookup |
| 409 | AMBIGUOUS_TAX_ID_LOOKUP | Several entities share the normalized tax ID |
| 409 | ENTITY_TYPE_NOT_CHANGEABLE | The current type is not person or company |
Example
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": "The company record is a natural person in the registry"
}'
{
"externalId": "crm_account_102",
"type": "person",
"reason": "Misclassified at import; tax ID belongs to a person"
}
{
"taxId": "30-71234567-8",
"type": "company",
"reason": "CUIT belongs to a company; the record was created as a person"
}
Was this page helpful?