> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gu1.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Change person type

> Reclassify a person as a company, or a company as a person. An optional reason is stored in the audit when you send it. The risk matrix is not re-run.

## Overview

Use this endpoint to change an entity between **person** and **company**. `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: false` when the type changed.

Sending the type the entity already has is a no-op (`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

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

The key needs permission to update entities.

## Request Body

Provide **exactly one** lookup field, plus the target type. `reason` is optional.

**entityId** `string (uuid)`

Internal gu1 entity ID.

**externalId** `string`

**Lookup only**: the entity's current external ID.

**taxId** `string`

**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`.

**type** `string` *required*

Target type: `person` or `company`.

**reason** `string`

Optional audit reason, max 4000 characters (after trim). Omitted values are not stored.

## Response

**success** `boolean`

`true` when the request completed successfully.

**changed** `boolean`

`false` if `type` already matches; `true` if the entity was updated.

**entity** `object`

Entity snapshot after the operation.

**riskMatrixExecuted** `boolean`

Present when `changed` is `true`. Always `false`: this call does not re-evaluate rules.

## 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

```bash theme={null}
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": "company",
    "reason": "Onboarding loaded a sole trader as a person"
  }'
```

Lookup by external ID:

```json theme={null}
{
  "externalId": "crm_customer_8842",
  "type": "person",
  "reason": "Registry shows a natural person, not a company"
}
```

Lookup by tax ID:

```json theme={null}
{
  "taxId": "20-12345678-9",
  "type": "person",
  "reason": "CUIT belongs to a person; the record was created as a company"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.