Skip to content

Custom Fields API

All endpoints require authentication and custom-fields tool permissions.

Custom fields can be defined for: deal, company, contact, person, project, task, recruitment_job, recruitment_candidate.

text, textarea, number, date, select, multi_select, toggle, url, email, user, reference.

GET /api/custom-fields/definitions

Permission: custom-fields / view

Query parameters:

ParamTypeDescription
entity_typestringFilter by entity type. Matches both legacy entity_type column and entity_types JSON array

Response: { definitions }

Ordered by entity_type, position, name.

POST /api/custom-fields/definitions

Permission: custom-fields / manage

Request body:

FieldTypeDescription
entity_typestringPrimary entity type (required)
entity_typesstring[]Multiple entity types this field applies to
namestringField name (required)
field_typestringOne of the supported field types (required)
requiredbooleanWhether the field is required
descriptionstringField description
positionnumberSort order (default: 0)
select_optionsarrayOptions for select/multi_select fields

Response: { definition } (201)

PUT /api/custom-fields/definitions/reorder

Permission: custom-fields / manage

Bulk-reorders definitions by setting their position based on array index.

Request body:

FieldTypeDescription
idsstring[]Ordered array of definition IDs

Response: { ok: true }

PUT /api/custom-fields/definitions/:id

Permission: custom-fields / manage

System fields cannot be edited.

Path parameters:

ParamTypeDescription
idstringDefinition ID

Request body:

FieldTypeDescription
namestringField name
descriptionstringField description
requiredbooleanWhether the field is required
positionnumberSort order
select_optionsarrayOptions for select fields
entity_typesstring[]Entity types this field applies to

Response: { definition }

DELETE /api/custom-fields/definitions/:id

Permission: custom-fields / manage

System fields cannot be deleted.

Path parameters:

ParamTypeDescription
idstringDefinition ID

Response: { ok: true }

GET /api/custom-fields/values/:entityType/:entityId

Permission: custom-fields / view

Returns all custom field values for a specific entity, joined with the field definition name and type.

Path parameters:

ParamTypeDescription
entityTypestringEntity type
entityIdstringEntity ID

Response: { values }

Each value includes field_id, entity_type, entity_id, value (JSON-serialised), name, and field_type.

PUT /api/custom-fields/values/:entityType/:entityId

Permission: custom-fields / update

Batch upserts custom field values for an entity. Uses ON CONFLICT to update existing values.

Path parameters:

ParamTypeDescription
entityTypestringEntity type
entityIdstringEntity ID

Request body:

FieldTypeDescription
valuesarrayArray of { field_id, value } objects. Values are JSON-serialised before storage

Response: { ok: true }