Skip to content

List a module's custom field definitions

GET
/modules/{slug}/fields
curl --request GET \
--url https://safe-api.safetyradar.com/v2/modules/action_item/fields \
--header 'Authorization: Bearer <token>' \
--header 'x-team: my-team-slug'

Get your organization’s active custom-field definitions for a module — the contract behind the fields envelope on that module’s records. action_item is the module behind /action-items.

Retired definitions are omitted, as are archived options: both stay valid on records that already hold them, so a value you read back from a record may not appear in this list. Each field’s ops are the filter operators it accepts in fieldFilters on the record listing, and its logic is the conditional behaviour the server enforces on write.

slug
required

The module’s slug. Core modules are seeded; action_item is the module behind /action-items. Note the underscore.

string
>= 1 characters
Example
action_item

The module’s slug. Core modules are seeded; action_item is the module behind /action-items. Note the underscore.

x-team

Deprecated — accepted but ignored; the v2 API is org-scoped.

string
Example
my-team-slug

Deprecated — accepted but ignored; the v2 API is org-scoped.

The organization’s active field definitions for this module

Media typeapplication/json
object
data
required
Array<object>
object
key
required

The key this field takes in the fields envelope. Immutable once any record holds a value.

string
label
required
string
description
required
string
nullable
type
required

date is YYYY-MM-DD, datetime is ISO 8601, user and asset are UUIDs of a user / asset in your organization, and multi_enum takes an array of option values.

string
Allowed values: string text number integer boolean date datetime enum multi_enum user asset
required
required

Enforced on create. On a partial update it is enforced only for keys you actually send.

boolean
options
required

Selectable options for enum / multi_enum, null for every other type. Archived options are omitted: they are no longer offered, but records that already hold one stay valid, so a value you read back may not appear here.

Array<object>
nullable
object
value
required
string
label
required
string
constraints
required

Type-appropriate limits, null when the field has none.

object
minLength
number
maxLength
number
min
number
max
number
minDate
Any of:
string
maxDate
Any of:
string
logic
required

Conditional behaviour, null when the field has none. visibility shows the field only while its condition holds; requiredWhen requires it while its condition holds, on top of required. A hidden field is never required, so a condition can never make a record unsaveable through a control you cannot see.

object
visibility

Show the field only while this condition holds.

object
op
required
string
Allowed values: always eq neq in notIn gt gte lt lte answered and or not
fieldId

The key of another field on this same module, evaluated against the record’s fields envelope. Absent for always, and, or and not.

string
value
Any of:
string
values

The operand list for in and notIn.

Array
args

Nested conditions of this same shape, for and and or.

Array
arg

The nested condition of this same shape, for not.

nullable
requiredWhen
object
op
required
string
Allowed values: always eq neq in notIn gt gte lt lte answered and or not
fieldId

The key of another field on this same module, evaluated against the record’s fields envelope. Absent for always, and, or and not.

string
value
Any of:
string
values

The operand list for in and notIn.

Array
args

Nested conditions of this same shape, for and and or.

Array
arg

The nested condition of this same shape, for not.

nullable
defaultValue
required
Any of:
string
ordinal
required

Display order within the module.

number
groupLabel
required

Section heading this field is grouped under, null when ungrouped.

string
nullable
ops
required

The filter operators this field accepts in fieldFilters on the record listing. isNull / isNotNull take no value; in takes an array.

Array<string>
Allowed values: eq neq contains gt gte lt lte in isNull isNotNull
Example
{
"data": [
{
"key": "crew",
"label": "Crew",
"type": "string",
"constraints": {
"minDate": {
"kind": "field",
"token": "today",
"from": {
"kind": "field",
"key": "due_date",
"token": "today"
},
"days": 14
},
"maxDate": {
"kind": "field",
"token": "today",
"from": {
"kind": "field",
"key": "due_date",
"token": "today"
},
"days": 14
}
},
"logic": {
"visibility": {
"op": "always",
"fieldId": "severity",
"value": {
"kind": "field",
"token": "today",
"from": {
"kind": "field",
"key": "due_date",
"token": "today"
},
"days": 14
}
},
"requiredWhen": {
"op": "always",
"fieldId": "severity",
"value": {
"kind": "field",
"token": "today",
"from": {
"kind": "field",
"key": "due_date",
"token": "today"
},
"days": 14
}
}
},
"ops": [
"eq",
"neq",
"in",
"isNull",
"isNotNull"
]
}
]
}

Unauthorized

Media typeapplication/json
object
code
required
string
message
required
string
details
object
key
additional properties
nullable
Examplegenerated
{
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
}
}

No module with this slug is available to your organization

Media typeapplication/json
object
code
required
string
message
required
string
details
object
key
additional properties
nullable
Examplegenerated
{
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
}
}