Set entity fields by JSON Pointer

POST /Platform/entities/{entity_type}/patch

Set entity fields by JSON Pointer. The DEFAULT writer for whole-value edits.

Use it to change a setting or a fact on an entity: an agent's opening hours, a workflow's answer, a document's title.

Sets a scalar or nested field to a new value by JSON Pointer (/a/b). No text matching, so it's immune to YAML line-folding and never ambiguous. Prefer over edit unless you're changing text inside a string.

Ops — each is {"op", "path", "value"?, "match"?}:

replace / add: set path to value (add on a list index inserts; /arr/- appends).

remove: delete what path points at — a dict key, or a list element by index (e.g. /arr/2).

test: assert path equals value, changing nothing; a mismatch aborts the WHOLE patch (even in bulk). Pair test + remove on an index for a safe "remove only if it's the value I expect".

remove by value: on an ARRAY path, remove WITH a value deletes every element equal to it, e.g. {"op":"remove","path":"/arr","value":"foo"} (with NO value it deletes the whole array).

replace by match: on an ARRAY path, replace WITH a match rewrites every element equal to match to value (with only value it overwrites the whole array). By-value ops raise if nothing matches.

remove/replace by where: on an ARRAY path, where is a dict of top-level field values and matches every dict element whose fields are a SUPERSET of it (shallow subset match). The index-free way to delete list items by identity — no index counting, no shifting: {"op":"remove","path":"/fields","where":{"group":"group_a"}} or {"op":"remove","path":"/fields","where":{"id":"item_1"}}. replace + where + value sets each matching element to value. Raises if nothing matches.

Bulk (multiple ids): the same ops apply to all, validated all-or-nothing before any write.

A string-array field that renders as a single | block scalar is still indexed as its logical line array (/<field>/2, /<field>/-); indexing is stable regardless of the rendered form.

Path checking: the FIRST segment must be a real field on the entity type (or a key already present in its YAML). A misspelled or non-existent field is rejected up front with the available field list, rather than being silently dropped — entity models ignore unknown keys, so such an op would otherwise store nothing. Deeper segments are not pre-checked (sub-model fields, list indices, /arr/- and arbitrary keys inside Dict[str, Any] fields are all legitimate), but after validation each directly-addressed replace/add op is verified against the stored result: an op whose effect was stripped (e.g. an unknown member on a nested sub-model) fails the whole patch instead of landing as a silent no-op.

Check changed on the response, not just success: an op that survives path checking but still resolves to no actual change writes nothing and returns changed: false with commit_id: null.

Entity references are JSON/YAML objects, never bare IDs: {"entity_type": "Agent", "id": "..."}. Use the concrete type required by the field; a bare string resolves without type information and cannot satisfy fields such as Agent-or-SimpleAgent.

Path parameters

Body parameters

Returns

EntityEditResponse

Example request

curl -X POST "https://api.hilus.ai/Platform/entities/{entity_type}/patch" \
  -H "Authorization: Bearer $HILUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'