Before you begin
You need:- An access token. See the quickstart.
- The
buildingIdof the building, from List buildings. - The ids of the devices, points, and spaces you want to work with. List building devices and List building points return them.
- A service account whose role allows creating, updating, and deleting devices and points in the building.
Link devices to each other
A device reference links one device to another, for example an air handler to the VAV boxes it feeds. You add the link from one device, and KODE OS stores the reverse link on the other device.1
Find the connection to use
Call List connections for a canonical type with the canonical type of the device you link from. Each row has the
key, multi, and type you send as relationship, and canonicalTypes lists the types of devices it can link to.Both devices need an ontology applied. A device without one is refused with 400.2
Add the link
The device in the path is the one you link from. Send the ids of the devices to link to.Add device references returns
204 with an empty body. It refuses, with 400, a link where a device references itself, a device is already linked, or the link would create a loop or reverse an existing link.3
Read the links back
Call List device references on either device. Each item has the linked
device, the key, the type, and the ontology of the linked device. The two devices show opposite type values, OUTPUT on the device that feeds and INPUT on the device that is fed.Check the list after you add links. The response of the add request does not list what was stored.4
Remove a link
Send the linked device ids to Remove device references.The link is removed from both devices. Neither device is deleted.
Link a device to spaces
A space reference links a device to a space it serves or measures. You send the space ids. KODE OS decides whether each link isserves or measures.
1
Add the links
204 with an empty body. The device needs an ontology applied. Repeating an id does not add a second link.2
List the links
List device space references returns the
space and the key of each link. Use category to narrow the list to Level, SpaceUnit, or Zone spaces.3
Remove links
Send the space ids to Remove device space references. The device and the spaces are not deleted.
Copy points to other devices
A point copy puts a point on another device without a second ingest. The copy mirrors its source: it has its ownid and sits on the device you chose, and Get a point shows the live value of the source.
1
Send the copy request
Send the points and the devices. KODE OS creates one copy for each pair, up to 50 pairs in a request.These rules apply to the request. If one is broken, the request is refused with
400 and nothing is written:- The points must be origin points on one device. A copy cannot be copied.
- The target devices must be origin or virtual devices, and not the device or base device of a source point.
2
Check each pair
Copy points to devices returns one item per pair, in request order.
status is CREATED, COPY_EXISTS when the copy was already there, or LIMIT_REACHED when the source has 200 copies. You can repeat a request safely: existing copies are not created again.3
Keep the copy ids
Each
CREATED item in the response carries the _id of the new copy. To find copies later, call List point copies with sourcePointId and deviceId. Each item has the copy _id, its device, and its source.Group points on a virtual device
A virtual device holds points that come from other devices, for example the supply and return temperatures of one air handler shown together. You have two ways to put points on it.1
Create the virtual device
Send a Create a virtual device returns
name. typeId and locatedInSpaceId are optional.201 with the new device. The device id is id, and pointsCount is 0. Sending the same name again creates a second device.2
Add points
To show points of a real device without moving them, use the copy request above with the virtual device in
deviceIds.To move points that sit on a pseudo device, call Attach points to a virtual device with up to 200 pointIds. The points keep their id and trend data, and their modeling is reset, so apply modeling after you attach.3
Take points off
Detach points from a virtual device returns origin points to their base device and lists them in
detached. Copies cannot go back, so they are deleted and listed in deletedCopies. The request is all or nothing: every point must be on the device.Update many devices or points
Use a batch update when many devices or points need different changes. Both endpoints take up to 1,000items. Each item has the id and the fields to change, and fields you leave out keep their value.
1
Send the batch
id once. The response is a job with the status PROCESSING.2
Poll the job
Call Get a job with the job
_id every few seconds until status is COMPLETED, FAILED, or CANCELED.3
Read the result
The job checks that every id exists in the building. If any id is unknown or belongs to another building, the job ends with
FAILED and nothing is changed. On COMPLETED, read the devices or points to confirm the new values.Delete devices and points
The single deletes return
204 with an empty body. The batch deletes return a job. Poll it as described in the previous section.
What a delete removes
KODE OS removes the dependents with the object, so nothing points at an object that no longer exists.
If a device came from a connector discovery, a later discovery offers the device and its deleted points again as new.
Other KODE OS features can use a device or point, for example schedules or graphics. This guide lists what the API exposes. Check those features after a delete.

