Create or update an action item
const url = 'https://safe-api.safetyradar.com/v2/action-items';const options = { method: 'POST', headers: { 'x-team': 'my-team-slug', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"title":"example","description":"example","assignedToUserId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","assignedToUserExternalId":"example","assignedToDepartmentId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","assignedToRoleSlug":"example","dueDate":"2026-04-15T12:00:00Z","priority":"low","status":"open","completedAt":"2026-04-15T12:00:00Z","completedByExternalId":"example","externalId":"example","eventExternalId":"example","locationExternalId":"example","statusExternalId":"example","fields":{"crew":"A-shift","corrective_cost":1250,"supervisor":{"id":"5c8d32f1-bf63-432e-a087-9ceeaf86a3b6","name":"Jordan Lee","externalId":"EMP-0123"}},"metadata":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://safe-api.safetyradar.com/v2/action-items \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-team: my-team-slug' \ --data '{ "title": "example", "description": "example", "assignedToUserId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assignedToUserExternalId": "example", "assignedToDepartmentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assignedToRoleSlug": "example", "dueDate": "2026-04-15T12:00:00Z", "priority": "low", "status": "open", "completedAt": "2026-04-15T12:00:00Z", "completedByExternalId": "example", "externalId": "example", "eventExternalId": "example", "locationExternalId": "example", "statusExternalId": "example", "fields": { "crew": "A-shift", "corrective_cost": 1250, "supervisor": { "id": "5c8d32f1-bf63-432e-a087-9ceeaf86a3b6", "name": "Jordan Lee", "externalId": "EMP-0123" } }, "metadata": { "additionalProperty": "example" } }'Create an action item, or update an existing one. externalId is the action item’s own correlation ID (unique per organization) and acts as an upsert key: if an action item already carries it, that record is updated with the supplied fields and the response is 200 — otherwise a new item is created and the response is 201. Use eventExternalId to link the item to an event (by the event’s external ID, verified against your org); omit it for a floating action item. locationExternalId sets the location/equipment and statusExternalId sets the status from your organization’s Action Item flow — both are ignored if unrecognised, so check assetExternalId / statusExternalId on the response to confirm what was mapped. Every response echoes the external IDs of the related records — assignedToUserExternalId, completedByExternalId, createdByExternalId, statusExternalId and assetExternalId — so you can map an action item back to your own users, statuses and assets without further lookups; every user / asset custom field in fields is read back the same way, as { id, name, externalId } in place of its uuid. statusExternalId takes precedence over status. On the update path the event linkage and the completion fields are ignored. The team is taken from the X-Team header.
Send your organization’s custom fields in fields, keyed by definition key (GET /v2/modules/action_item/fields lists them). They are validated against the organization’s definitions in the same transaction as the record: a refused envelope is a 400 with a per-key list and the item is not created. On the upsert path fields is a partial patch — an omitted key keeps its stored value.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Deprecated — accepted but ignored; the v2 API is org-scoped.
Example
my-team-slugDeprecated — accepted but ignored; the v2 API is org-scoped.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The organization’s admin-defined custom fields, keyed by definition key. Validated against the organization’s own definitions: an unknown key, a bad enum value or a missing required field is a 400 carrying a per-key list. A user or asset field takes the record’s uuid, or the { id, name, externalId } object a GET returns it as (only id is read). Does not merge with metadata — the two are stored separately and neither overwrites the other. Discover the contract at GET /v2/modules/action_item/fields.
object
Example
{ "crew": "A-shift", "corrective_cost": 1250, "supervisor": { "id": "5c8d32f1-bf63-432e-a087-9ceeaf86a3b6", "name": "Jordan Lee", "externalId": "EMP-0123" }}Verbatim, unvalidated. Use fields — typed, admin-defined, validated. See GET /v2/modules/action_item/fields.
object
Responses
Section titled “Responses”Existing action item updated (matched on externalId)
object
object
object
The organization’s custom module fields, keyed by definition key. Always present; {} when the organization has configured none, and a defined key this item holds no value for is absent rather than null. A user (person) or asset (location / equipment) field is read back as an ActionItemFieldReference — { id, name, externalId } — in place of its uuid, so you can map it to your own records without a lookup; every other type is its plain value. Discover the keys, types and filter operators at GET /v2/modules/action_item/fields.
object
Verbatim, unvalidated. Use fields — typed, admin-defined, validated. See GET /v2/modules/action_item/fields.
object
Example
{ "data": { "priority": "low", "statusGroup": "new", "status": "open", "fields": { "crew": "A-shift", "corrective_cost": 1250, "supervisor": { "id": "5c8d32f1-bf63-432e-a087-9ceeaf86a3b6", "name": "Jordan Lee", "externalId": "EMP-0123" } } }}Action item created
object
object
object
The organization’s custom module fields, keyed by definition key. Always present; {} when the organization has configured none, and a defined key this item holds no value for is absent rather than null. A user (person) or asset (location / equipment) field is read back as an ActionItemFieldReference — { id, name, externalId } — in place of its uuid, so you can map it to your own records without a lookup; every other type is its plain value. Discover the keys, types and filter operators at GET /v2/modules/action_item/fields.
object
Verbatim, unvalidated. Use fields — typed, admin-defined, validated. See GET /v2/modules/action_item/fields.
object
Example
{ "data": { "priority": "low", "statusGroup": "new", "status": "open", "fields": { "crew": "A-shift", "corrective_cost": 1250, "supervisor": { "id": "5c8d32f1-bf63-432e-a087-9ceeaf86a3b6", "name": "Jordan Lee", "externalId": "EMP-0123" } } }}Validation error, malformed JSON, or a fields envelope the organization’s definitions refuse (code: invalid_fields, with the per-key list under details.fields)
object
object
object
object
Machine-readable error code
Human-readable error message
Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).
object
Example
{ "code": "invalid_fields"}Unauthorized
object
Machine-readable error code
Human-readable error message
Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).
object
Example
{ "code": "validation_error", "message": "Request validation failed"}Referenced event or assignee not found
object
Machine-readable error code
Human-readable error message
Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).
object
Example
{ "code": "validation_error", "message": "Request validation failed"}ExternalId is already in use by another action item
object
Machine-readable error code
Human-readable error message
Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).
object
Example
{ "code": "validation_error", "message": "Request validation failed"}Rate limit exceeded (rate_limit_exceeded)
object
Machine-readable error code
Human-readable error message
Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).
object
Example
{ "code": "validation_error", "message": "Request validation failed"}Unexpected server error (internal_error)
object
Machine-readable error code
Human-readable error message
Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).
object
Example
{ "code": "validation_error", "message": "Request validation failed"}
