Skip to content

Create or update asset

POST
/assets
curl --request POST \
--url https://safe-api.safetyradar.com/v2/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "description": "example", "address1": "example", "address2": "example", "city": "example", "state": "example", "zip": "example", "latitude": 1, "longitude": 1, "status": "active", "type": "equipment", "parentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "externalId": "example", "metadata": { "additionalProperty": "example" }, "createdAt": "example", "updatedAt": "example", "deletedAt": "example", "equipmentTypeId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "tagIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "externalParentId": "example", "tags": [ "Region North" ], "cascadeDeactivate": true }'

Create a new asset or update an existing one if externalId matches (upsert behavior). Supports both location and equipment types. Equipment assets require equipmentTypeId. Changing an existing active asset to status: "inactive" returns 409 while it still has active child assets: deactivate or move the children first, or send cascadeDeactivate: true to deactivate the whole subtree. Tags: send tags with tag names (for example ["Region North"], matched case-insensitively) or tagIds, not both. Omitted = tags unchanged, [] = clear, a list = replace. An unknown tag returns 400; tags are not created by the API. Responses include tagNames (the asset’s tag names) next to tags ({ id, name } objects).

Media typeapplication/json
object
id
string format: uuid
name
required
string
description
string
nullable
address1
string
nullable
address2
string
nullable
city
string
nullable
state
string
nullable
zip
string
nullable
latitude
number
nullable >= -140737488355328 <= 140737488355327
longitude
number
nullable >= -140737488355328 <= 140737488355327
status
string
Allowed values: active inactive
type
string
default: location
Allowed values: equipment location
parentId
string format: uuid
nullable
externalId

External identifier for upsert behavior

string
metadata
Any of:
string
createdAt
string
updatedAt
string
deletedAt
string
nullable
equipmentTypeId
string format: uuid
nullable
tagIds

Resource tag ids, with the same semantics as tags. Send tags or tagIds, not both.

Array<string>
externalParentId

External ID of the parent asset. If provided, resolves to parentId. Takes precedence over parentId if both are specified. null moves the asset to the root (top level). On this single upsert, parentId: null also moves it to the root (bulk differs: there parentId: null leaves the parent unchanged). A parentId must be an asset of your organization, and the asset cannot move under itself or one of its descendants (400).

string
nullable
tags

Resource tag NAMES, matched trimmed and case-insensitively against the organization’s tags (for example ["Region North"]). Omitted = the asset’s tags are not changed; [] = remove all tags; a list = replace the tags with exactly this set. Tags are not created by the API: an unknown name is an error. Send tags or tagIds, not both.

Array<string>
Example
[
"Region North"
]
cascadeDeactivate

With status: "inactive" on an existing asset, also deactivate every asset under it, in the same write. Without it, deactivating an active asset returns 409 while active child assets remain. Ignored when the asset is created.

boolean

Asset updated (existing asset found by externalId)

Media typeapplication/json
object
data
required
object
id
required
string format: uuid
organizationId
required
string format: uuid
name
required
string
description
required
string
nullable
slug
required
string
address1
required
string
nullable
address2
required
string
nullable
city
required
string
nullable
state
required
string
nullable
zip
required
string
nullable
latitude
required
number
nullable >= -140737488355328 <= 140737488355327
longitude
required
number
nullable >= -140737488355328 <= 140737488355327
status
required
string
Allowed values: active inactive
type
required
string
Allowed values: equipment location
parentId
required
string format: uuid
nullable
externalId
required
string
nullable
metadata
required
Any of:
string
createdById
required
string format: uuid
nullable
lastEditedById
required
string format: uuid
nullable
searchText
nullable
createdAt
required
string
updatedAt
required
string
deletedAt
required
string
nullable
externalParentId

External ID of the parent asset (computed from parentId lookup)

string
nullable
tagNames
required

Names of the resource tags on the asset, sorted. Single-asset responses (GET by id, POST) also carry tags as { id, name } objects; tagNames is the same set as plain names.

Array<string>
Example
{
"data": {
"status": "active",
"type": "equipment",
"tagNames": [
"Region North"
]
}
}

Asset created

Media typeapplication/json
object
data
required
object
id
required
string format: uuid
organizationId
required
string format: uuid
name
required
string
description
required
string
nullable
slug
required
string
address1
required
string
nullable
address2
required
string
nullable
city
required
string
nullable
state
required
string
nullable
zip
required
string
nullable
latitude
required
number
nullable >= -140737488355328 <= 140737488355327
longitude
required
number
nullable >= -140737488355328 <= 140737488355327
status
required
string
Allowed values: active inactive
type
required
string
Allowed values: equipment location
parentId
required
string format: uuid
nullable
externalId
required
string
nullable
metadata
required
Any of:
string
createdById
required
string format: uuid
nullable
lastEditedById
required
string format: uuid
nullable
searchText
nullable
createdAt
required
string
updatedAt
required
string
deletedAt
required
string
nullable
externalParentId

External ID of the parent asset (computed from parentId lookup)

string
nullable
tagNames
required

Names of the resource tags on the asset, sorted. Single-asset responses (GET by id, POST) also carry tags as { id, name } objects; tagNames is the same set as plain names.

Array<string>
Example
{
"data": {
"status": "active",
"type": "equipment",
"tagNames": [
"Region North"
]
}
}

Bad request - equipment assets require equipmentTypeId, an unknown tag, or both tags and tagIds sent

Media typeapplication/json
object
code
required

Machine-readable error code

string
message
required

Human-readable error message

string
details

Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).

object
key
additional properties
nullable
Example
{
"code": "validation_error",
"message": "Request validation failed"
}

Unauthorized

Media typeapplication/json
object
code
required

Machine-readable error code

string
message
required

Human-readable error message

string
details

Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).

object
key
additional properties
nullable
Example
{
"code": "validation_error",
"message": "Request validation failed"
}

Conflict - the asset cannot be deactivated while it has active child assets (send cascadeDeactivate: true to deactivate them too)

Media typeapplication/json
object
code
required

Machine-readable error code

string
message
required

Human-readable error message

string
details

Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).

object
key
additional properties
nullable
Example
{
"code": "validation_error",
"message": "Request validation failed"
}

Rate limit exceeded (rate_limit_exceeded)

Media typeapplication/json
object
code
required

Machine-readable error code

string
message
required

Human-readable error message

string
details

Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).

object
key
additional properties
nullable
Example
{
"code": "validation_error",
"message": "Request validation failed"
}

Unexpected server error (internal_error)

Media typeapplication/json
object
code
required

Machine-readable error code

string
message
required

Human-readable error message

string
details

Additional error details. For validation_error: issues, a list of { location, path, message } (location is query, param, header or json).

object
key
additional properties
nullable
Example
{
"code": "validation_error",
"message": "Request validation failed"
}

Version bd999fd · Released November 23, 2026