Skip to content
OAOpenAppPhysical Security as a Service
Login

Entities

Entities are logical resources (apartments, doors, switches, cameras, …) attached to devices and driven by integrations. Most routes require X-Org and often output_options / pagination exactly as in OpenAPI — see Organization context & pagination. Shapes follow EntityResponse, CreateEntityRequest, UpdateEntityRequest, PatchEntityRequest, and PaginatedResponse — see the API reference.

Related: Devices (hardware rows), Zones (optional zone_id filter on GET /entities). Listing entities under an integration uses GET /integrations/{id}/entities — that route is tagged Integrations (documented when the Integrations chapter lands).

ConcernHTTPoperationIdNotes
List (org scope)GET /entitieslist_entitiesX-Org; required output_options + pagination query objects; optional zone_id.
CreatePOST /entitiescreate_entityBody CreateEntityRequest.
Get / replace / patch / soft-delete/entities/{id}get_entity, update_entity, patch_entity, delete_entityPatchEntityRequest shallow-merges entity_metadata.
Purge / restoreDELETE /entities/{id}/purge, POST /entities/{id}/restorehard_delete_entity, restore_entity
Execute actionPOST /entities/{id}/actions/{action_id}execute_entity_actionJSON body per integration (often {}). 501 if the provider does not implement the action.
Metadata schema (entity)GET /entities/{id}/metadata-definitionget_entity_metadata_definitionProvider JSON Forms schema for editing entity_metadata.
List for deviceGET /devices/{device_id}/entitieslist_device_entitiesX-Org + required pagination (+ filters per bundle).
Metadata schema (device)GET /devices/{device_id}/entities/metadata-definitionget_device_entity_metadata_definitionOptional entity_type query (Python helper).
Apartment floorsGET /devices/{device_id}/apartment-floorslist_device_apartment_floorsDistinct floor list for apartment UIs.

Multipart POST /entities/{id}/image may exist in some deployments; the Python SDK exposes upload_image / upload_image_from_url when wired — see Python — Resources.

CapabilityPythonRust (openapp_sdk)GoTypeScript (AsyncClient)
CRUD, patch, purge, restore, actions, metadata helpers, device listingsclient.entities — includes by_id() fluent handle (open, close, on, off, action(...))client.entities() — thin JSON methods matching paths aboveEntitiesAPIService (generated)Not on façade

GET /entities: Python list(...) forwards query keys from kwargs; Rust list() issues a bare GET /entities without required output_options / pagination — use transport() + RequestSpec for OpenAPI parity (same pattern as Devices). Go ListEntities enforces XOrg, OutputOptions, Pagination.

401 / 403 for org or capability.404 for unknown entity or device.400 / 422 on validation.501 on execute_entity_action when unsupported. See Errors & retries.

await client.entities.by_id(entity_id).open()

Equivalent: await client.entities.actions(entity_id, "open").

list_device_entities (GET /devices/{device_id}/entities) requires X-Org and pagination on the wire. Go’s builder enforces both; the Python and Rust facade helpers issue a bare GET without them, so for OpenAPI parity drop to _request / transport when your gateway rejects the unadorned path.

rows = await client.entities.by_device(device_id)

For full wire parity with X-Org + pagination (or to filter by entity_type if the bundle accepts it):

page = await client._request(
"GET",
f"/devices/{device_id}/entities",
headers={"X-Org": org_id},
query={"limit": 50, "offset": 0, "entity_type": "door"},
)

Body CreateEntityRequestdevice_id and entity_type are required; optional name, zone_id, channel_index, external_id, and metadata (provider-specific). X-Org is required.

created = await client.entities.create(
device_id=device_id,
entity_type="door",
name="Lobby gate",
)

Get / replace / patch (GET|PUT|PATCH /entities/{id})

Section titled “Get / replace / patch (GET|PUT|PATCH /entities/{id})”

update_entity replaces the row with UpdateEntityRequest; patch_entity shallow-merges keys into entity_metadata via PatchEntityRequest (null clears a key). Both require X-Org.

row = await client.entities.get(entity_id)
replaced = await client.entities.update(entity_id, name="Lobby gate v2")
patched = await client.entities.patch(entity_id, metadata={"floor_number": 3})

Soft delete, restore, hard delete (DELETE/POST lifecycle)

Section titled “Soft delete, restore, hard delete (DELETE/POST lifecycle)”

delete_entity is reversible (soft delete); restore_entity undoes it; hard_delete_entity purges the row irrecoverably. All require X-Org.

await client.entities.delete(entity_id)
restored = await client.entities.restore(entity_id)
await client.entities.purge(entity_id)

get_entity_metadata_definition returns the JsonForms-style schema dashboards use to edit entity_metadata. get_device_entity_metadata_definition is the device-scoped variant (optional entity_type filter). list_device_apartment_floors is a small helper for apartment UIs that need a distinct floor list.

schema = await client.entities.metadata_definition(entity_id)
device_schema = await client.entities.device_entities_metadata_definition(
device_id, entity_type="apartment"
)
floors = await client.entities.apartment_floors(device_id)