Skip to main content

User Defined Fields API

The User Defined Fields API provides full programmatic access to UDF definitions, field configurations, field values, and the mobile rendering schema. All endpoints are scoped to the authenticated user's department.

Base URL: /api/v4/UserDefinedFields

Authentication

All User Defined Fields API endpoints require a valid JWT token. See API Authentication for details.

Entity Types

The entityType parameter is an integer enum used across all endpoints:

ValueEntity
0Call
1Personnel
2Unit
3Contact

Field Data Types

The fieldDataType value on field objects is an integer enum:

ValueTypeDescription
0TextSingle-line text
1NumberInteger
2DecimalFloating-point number
3BooleanTrue/false checkbox
4DateDate only (ISO 8601: YYYY-MM-DD)
5DateTimeDate and time (ISO 8601: YYYY-MM-DDTHH:MM:SS)
6DropdownSingle-select; requires options in validation rules
7MultiSelectMulti-select; requires options in validation rules
8EmailEmail address
9PhonePhone number
10URLURL

Definitions

Get Active Definition

Returns the currently active UDF definition and its fields for the specified entity type.

GET /api/v4/UserDefinedFields/{entityType}
ParameterTypeLocationDescription
entityTypeintPathEntity type enum value

Response: UdfDefinitionResult

{
"udfDefinitionId": "def_abc123",
"departmentId": 42,
"entityType": 0,
"version": 3,
"isActive": true,
"createdOn": "2026-03-01T10:00:00Z",
"createdBy": "user_xyz",
"updatedOn": "2026-03-05T14:30:00Z",
"updatedBy": "user_xyz",
"fields": [
{
"udfFieldId": "fld_001",
"udfDefinitionId": "def_abc123",
"name": "chemical_class",
"label": "Chemical Class",
"description": "Select the UN hazard class for the primary chemical involved.",
"placeholder": "Select a class...",
"fieldDataType": 6,
"isRequired": true,
"isReadOnly": false,
"defaultValue": null,
"validationRules": {
"options": [
{ "key": "class1", "label": "Class 1 – Explosives" },
{ "key": "class2", "label": "Class 2 – Gases" },
{ "key": "class3", "label": "Class 3 – Flammable Liquids" }
],
"customErrorMessage": null
},
"sortOrder": 1,
"groupName": "Hazmat Details",
"isVisibleOnMobile": true,
"isVisibleOnReports": true,
"isEnabled": true
}
]
}

Returns 404 Not Found if no active definition exists for the entity type.


Create or Update Definition

Creates a new definition (or a new version of an existing definition) for the specified entity type. The previous active version is automatically marked inactive.

POST /api/v4/UserDefinedFields

Authorization: Department Admin

Request Body: UdfDefinitionInput

{
"entityType": 0,
"fields": [
{
"name": "chemical_class",
"label": "Chemical Class",
"description": "Select the UN hazard class for the primary chemical involved.",
"placeholder": "Select a class...",
"fieldDataType": 6,
"isRequired": true,
"isReadOnly": false,
"defaultValue": null,
"validationRules": {
"options": [
{ "key": "class1", "label": "Class 1 – Explosives" },
{ "key": "class2", "label": "Class 2 – Gases" }
]
},
"sortOrder": 1,
"groupName": "Hazmat Details",
"isVisibleOnMobile": true,
"isVisibleOnReports": true,
"isEnabled": true
}
]
}
FieldTypeRequiredDescription
entityTypeintYesEntity type enum value
fieldsarrayYesArray of field definitions (see Field Input)

Response: UdfDefinitionResult — the newly created definition with the incremented version number.

Audit: Creates a UdfDefinitionCreated or UdfDefinitionUpdated audit log entry.


Delete Field from Active Definition

Removes a single field from the active definition by creating a new definition version without that field.

DELETE /api/v4/UserDefinedFields/Fields/{fieldId}

Authorization: Department Admin

ParameterTypeLocationDescription
fieldIdstringPathThe udfFieldId of the field to remove

Response: UdfDefinitionResult — the new definition version without the removed field.

Audit: Creates a UdfFieldRemoved audit log entry.

Historical Preservation

Removing a field creates a new definition version. Existing UdfFieldValue records for the removed field in prior entity records are preserved in the database and remain accessible via historical queries.


Field Values

Get Values for an Entity

Returns all UDF field values saved for a specific entity record, keyed to the definition version active at the time the values were saved.

GET /api/v4/UserDefinedFields/Values/{entityType}/{entityId}
ParameterTypeLocationDescription
entityTypeintPathEntity type enum value
entityIdstringPathThe ID of the entity record (e.g., call ID, user ID, unit ID, contact ID)

Response: UdfFieldValuesResult

{
"entityId": "call_789",
"entityType": 0,
"udfDefinitionId": "def_abc123",
"definitionVersion": 3,
"values": [
{
"udfFieldValueId": "val_001",
"udfFieldId": "fld_001",
"udfDefinitionId": "def_abc123",
"entityId": "call_789",
"entityType": 0,
"value": "class3",
"createdOn": "2026-03-06T09:15:00Z",
"createdBy": "user_xyz",
"updatedOn": "2026-03-06T09:15:00Z",
"updatedBy": "user_xyz"
}
]
}

Returns 404 Not Found if the entity has no saved UDF values.


Save Values for an Entity

Saves (creates or updates) UDF field values for a specific entity record. Server-side validation is applied against the field's validationRules before saving.

POST /api/v4/UserDefinedFields/Values

Request Body: UdfFieldValuesInput

{
"entityType": 0,
"entityId": "call_789",
"values": [
{
"udfFieldId": "fld_001",
"value": "class3"
},
{
"udfFieldId": "fld_002",
"value": "150"
}
]
}
FieldTypeRequiredDescription
entityTypeintYesEntity type enum value
entityIdstringYesThe ID of the entity record
valuesarrayYesArray of field value pairs
values[].udfFieldIdstringYesThe field's udfFieldId
values[].valuestringYesThe value as a string (see type-specific formatting below)

Value Formatting by Data Type

Data TypeExpected Format
Text, Email, Phone, URLPlain string
NumberInteger string (e.g., "42")
DecimalDecimal string (e.g., "3.14")
Boolean"true" or "false"
DateISO 8601 date string ("2026-03-01")
DateTimeISO 8601 datetime string ("2026-03-01T14:30:00")
DropdownThe option key string
MultiSelectComma-separated option key strings (e.g., "key1,key2")

Response: UdfFieldValuesResult — the saved values.

Validation Errors: Returns 400 Bad Request with a validation error object if any field values fail server-side validation:

{
"errors": {
"fld_001": ["Chemical Class is required."],
"fld_002": ["Quantity must be between 0 and 10000."]
}
}

Audit: Creates a UdfFieldValueSaved audit log entry capturing the entity type, entity ID, and changed field values (old → new).


Mobile Schema

The schema endpoints return a structured JSON representation of the UDF definition and fields that mobile applications (React Native) use to dynamically render form controls with native validation.

Get Schema (Empty Form)

Returns the field schema for an entity type without any pre-populated values. Use this when rendering a new record form on mobile.

GET /api/v4/UserDefinedFields/Schema/{entityType}
ParameterTypeLocationDescription
entityTypeintPathEntity type enum value

Response: UdfSchemaResult

{
"definitionId": "def_abc123",
"entityType": 0,
"version": 3,
"groups": [
{
"groupName": "Hazmat Details",
"fields": [
{
"fieldId": "fld_001",
"name": "chemical_class",
"label": "Chemical Class",
"description": "Select the UN hazard class for the primary chemical involved.",
"placeholder": "Select a class...",
"fieldDataType": 6,
"isRequired": true,
"isReadOnly": false,
"isVisibleOnMobile": true,
"currentValue": null,
"defaultValue": null,
"validationRules": {
"options": [
{ "key": "class1", "label": "Class 1 – Explosives" },
{ "key": "class2", "label": "Class 2 – Gases" },
{ "key": "class3", "label": "Class 3 – Flammable Liquids" }
]
}
}
]
}
]
}

Returns 404 Not Found if no active definition exists for the entity type.


Get Schema (Pre-Populated)

Returns the field schema pre-populated with an existing entity record's saved values. Use this when rendering an edit record form on mobile.

GET /api/v4/UserDefinedFields/Schema/{entityType}/{entityId}
ParameterTypeLocationDescription
entityTypeintPathEntity type enum value
entityIdstringPathThe ID of the entity record

Response: UdfSchemaResult — same structure as the empty schema, but all currentValue fields are populated with the entity's saved values.


Validation Rules Object

The validationRules property is a JSON object on each field. Not all properties apply to every field data type.

{
"minLength": 2,
"maxLength": 100,
"regex": "^[A-Z]{2,5}$",
"regexErrorMessage": "Must be 2–5 uppercase letters.",
"minValue": 0,
"maxValue": 10000,
"options": [
{ "key": "opt1", "label": "Option One" },
{ "key": "opt2", "label": "Option Two" }
],
"customErrorMessage": "This field is required for hazmat incidents."
}
PropertyApplies ToDescription
minLengthText, Email, Phone, URLMinimum character count
maxLengthText, Email, Phone, URLMaximum character count
regexTextRegex pattern the value must match
regexErrorMessageTextError message for regex mismatch
minValueNumber, DecimalMinimum numeric value
maxValueNumber, DecimalMaximum numeric value
optionsDropdown, MultiSelectArray of { key, label } pairs representing valid choices
customErrorMessageAllOverrides the default validation error message

Integration with Entity Endpoints

UDF field values are also accessible via the standard entity API endpoints. The response models for Calls, Personnel, Units, and Contacts include a udfValues array when UDF values exist for that record.

Call Responses

CallResult objects include a udfValues field:

{
"callId": "call_789",
"name": "Structure Fire",
...
"udfValues": [
{ "udfFieldId": "fld_001", "name": "chemical_class", "label": "Chemical Class", "value": "class3" }
]
}

Submitting UDF Values via Entity Endpoints

When creating or updating a Call, Personnel record, Unit, or Contact via their respective API endpoints, include a udfValues array in the request body:

{
"name": "Structure Fire",
"nature": "Working fire",
...
"udfValues": [
{ "udfFieldId": "fld_001", "value": "class3" },
{ "udfFieldId": "fld_002", "value": "150" }
]
}

Values are validated server-side and saved atomically with the parent record. Validation errors for UDF fields are included in the 400 Bad Request response alongside standard field errors.