Create or update user
const url = 'https://safe-api.safetyradar.com/v2/users';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"email":"hello@example.com","fullName":"example","phoneNumber":"example","role":"admin","externalId":"example","supervisorId":"example","departmentId":"example","locationId":"example","teamId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","permissionGroupId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
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/users \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "email": "hello@example.com", "fullName": "example", "phoneNumber": "example", "role": "admin", "externalId": "example", "supervisorId": "example", "departmentId": "example", "locationId": "example", "teamId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "permissionGroupId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Create a new user, or update the existing user with the same email and add them to this organization if needed. Returns 201 if the organization membership was created, 200 if it already existed. A user is one global record shared by every organization they belong to: fullName and phoneNumber are updated only when the user has no other active organization membership and is not a SafetyRadar super admin, and a verified phone number is never changed. The response carries the stored values.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”User updated (existing user found by email; already a member of this organization)
object
object
object
object
object
Example
{ "data": { "role": "admin" }}User created
object
object
object
object
object
Example
{ "data": { "role": "admin" }}Bad request - validation error or invalid reference
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"}
