Get Hedhog updates in your inbox
New releases, fresh recipes, and breaking changes — no spam.
CRM Submodule
document-types
Catalog of person document type codes (e.g. CPF, CNPJ, passport) with country association and uniqueness rules, used to classify document entries on person records.
Source path: libraries/crm/src/document-type
Module file: document-type.module.ts
Introduction
The Document Types submodule manages the reference catalog for identity and registration documents attached to persons (document_type_id on each person document entry). Each entry carries a stable code, a country_code indicating which jurisdiction the document applies to (e.g. "BR" for CPF/CNPJ, "US" for an SSN/EIN), an is_unique flag that controls whether the document's value must be unique across all persons, and locale-translated display names.
The country_code association lets a single deployment serve multiple countries' document conventions side by side — a Brazilian CRM instance can register both CPF (individual) and CNPJ (company) document types, each with its own uniqueness rule, without hardcoding country-specific validation logic into the Persons submodule itself. Like Contact Types, this catalog is fully mutable through standard CRUD endpoints.
HTTP Endpoints
5 endpoints
Paginated list of person document types.
- Query
- page, pageSize, search
Get a single document type by ID.
- Params
- id (int)
Create a new document type.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
| code | string | yes | — |
| country_code | string | yes | ISO country code, e.g. "BR" |
| is_unique | boolean | yes | Whether this document must be unique per person |
| locale | Record<string, { name: string }> | yes | e.g. { "en": { "name": "..." } } |
Update a document type (same fields as create, all optional).
- Params
- id (int)
Delete one or more document types.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
| ids | number[] | yes | IDs to delete |
MCP Tools
Named tools callable by AI models via the Model Context Protocol (MCP).
crm.document-types.listLists person document types (e.g. CPF, CNPJ, Passport) with pagination
crm.document-types.getReturns a single document type by ID
crm.document-types.createCreates a new document type with multi-locale name
crm.document-types.updateUpdates an existing document type by ID
crm.document-types.deleteDeletes one or more document types by their IDs