Bulk create or update events
const url = 'https://safe-api.safetyradar.com/v2/events/bulk';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"events":[{"externalId":"example","type":"example","title":"example","eventDate":"example","reportDate":"example","address1":"example","address2":"example","city":"example","state":"example","zip":"example","latitude":1,"longitude":1,"description":"example","ownerId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","assignedToUserId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","reportedBy":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","locationId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","assetId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","statusId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","actionTaken":"example","metadata":{"additionalProperty":"example"},"media":["example"],"metricData":{"additionalProperty":"example"},"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","locationExternalId":"example","ownerExternalId":"example","reportedByExternalId":"example","statusExternalId":"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/events/bulk \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "events": [ { "externalId": "example", "type": "example", "title": "example", "eventDate": "example", "reportDate": "example", "address1": "example", "address2": "example", "city": "example", "state": "example", "zip": "example", "latitude": 1, "longitude": 1, "description": "example", "ownerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assignedToUserId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "reportedBy": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "locationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assetId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "statusId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "actionTaken": "example", "metadata": { "additionalProperty": "example" }, "media": [ "example" ], "metricData": { "additionalProperty": "example" }, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "locationExternalId": "example", "ownerExternalId": "example", "reportedByExternalId": "example", "statusExternalId": "example" } ] }'Create or update multiple events in a single request. Each item without id is upserted by externalId; items with id look up the event by UUID and may rename its externalId (per-item 409 in error/conflictingEventId if the new externalId is taken). Maximum 1000 events per request.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Deprecated: use assignedToUserId. Before SAFE-1903 this field set the assignee, and a value sent here is still written as the assignee. The event’s owner (who filed it) is now the API caller and cannot be set.
object
object
External id of the user to ASSIGN the event to (written to assignedToUserId).
Examplegenerated
{ "events": [ { "externalId": "example", "type": "example", "title": "example", "eventDate": "example", "reportDate": "example", "address1": "example", "address2": "example", "city": "example", "state": "example", "zip": "example", "latitude": 1, "longitude": 1, "description": "example", "ownerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assignedToUserId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "reportedBy": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "locationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assetId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "statusId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "actionTaken": "example", "metadata": { "additionalProperty": "example" }, "media": [ "example" ], "metricData": { "additionalProperty": "example" }, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "locationExternalId": "example", "ownerExternalId": "example", "reportedByExternalId": "example", "statusExternalId": "example" } ]}Responses
Section titled “Responses”Bulk operation completed
object
object
object
object
Examplegenerated
{ "data": { "results": [ { "externalId": "example", "success": true, "created": true, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "error": "example", "conflictingEventId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ], "summary": { "total": 1, "created": 1, "updated": 1, "failed": 1 } }}Invalid request: a parameter or the body failed validation (validation_error), or the body is not valid JSON (invalid_json)
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"}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"}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"}
