Logotipo Hedhog

Get Hedhog updates in your inbox

New releases, fresh recipes, and breaking changes — no spam.

Back to CRM modulesCRM Submodule

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

FieldTypeRequiredNotes
codestringyes
country_codestringyesISO country code, e.g. "BR"
is_uniquebooleanyesWhether this document must be unique per person
localeRecord<string, { name: string }>yese.g. { "en": { "name": "..." } }

Update a document type (same fields as create, all optional).

Params
id (int)

Delete one or more document types.

Body

FieldTypeRequiredNotes
idsnumber[]yesIDs to delete

MCP Tools

Named tools callable by AI models via the Model Context Protocol (MCP).

  • crm.document-types.list

    Lists person document types (e.g. CPF, CNPJ, Passport) with pagination

  • crm.document-types.get

    Returns a single document type by ID

  • crm.document-types.create

    Creates a new document type with multi-locale name

  • crm.document-types.update

    Updates an existing document type by ID

  • crm.document-types.delete

    Deletes one or more document types by their IDs