Skip to main content
Version: Next

REST API Reference

All endpoints are prefixed with /api/v1/. Every response body is JSON unless a route says otherwise; every request body must be JSON where applicable.

Commits and version numbers

Every write stores an immutable snapshot of the entity with its own id. In this documentation such a saved snapshot is called a commit. A version number (for example v1.0.3 or A) is something else: a named number issued for an aggregate by a versioning scheme. API names keep their historical spelling: by-id addresses a commit, @history lists commits, metadata.previous points at the previous commit, while metadata.version_numbers, @bump and @version deal with version numbers.

Authentication​

When the server is configured with an OIDC provider, every request (except GET /version and OPTIONS) must carry a valid JWT:

Authorization: Bearer <token>

Every authentication failure returns 401 Unauthorized: a missing token, an invalid, expired or badly signed token, or a valid token for which the server cannot establish a session (for example, its sub claim is not a UUID). Without auth configuration the server runs in admin mode and accepts all requests without a token.

Content-Type and CORS​

Responses carry Content-Type: application/json (exceptions: the event stream, the GraphQL schema and UI). CORS headers are set on every response:

Access-Control-Allow-Origin: <configured origin, default *>
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization

Addressing Entities​

Any single entity can be addressed in four equivalent ways:

PatternResolves by
/api/v1/by-id/<uuid>Exact commit UUID (id) -- pins one immutable snapshot
/api/v1/by-root/<uuid>Root UUID -- resolves to the latest commit
/api/v1/by-key/<type_name>/<key>Type-scoped key -- resolves to the latest commit
/api/v1/by-type/<type_name>/<key>Alias for by-key

All four prefixes accept the same sub-paths described in Entity Operations.

See The Meta Model for the conceptual explanation of entity addressing.

Selecting a Branch​

by-key, by-type/<type>/<key> and by-root accept a trailing :branch on the key or UUID segment to read or write a specific branch:

GET /api/v1/by-key/vegetable/potato:dev
PUT /api/v1/by-type/vegetable/potato:dev
GET /api/v1/by-root/<uuid>:dev
  • Without :branch, the main branch is used.
  • Keys and branch names both match [A-Za-z0-9_-]+ (no colons), so a trailing :name is never ambiguous.
  • by-id/<uuid> addresses one snapshot, which may belong to several branches -- a :branch suffix there is rejected with 400.
  • A write through a snapshot address (by-id/<uuid> or by-type/<type>/<uuid>) writes main. The addressed commit must be the head of main; otherwise the write is refused with 409, naming the branch whose head it is. To write a branch, address it (key:dev).
  • The response field @branch names the branch the read was resolved on (main if the requested branch has no own state for this entity and the read fell back).
  • Creation is main-only: POST /by-type/<type> and the batch uploads always create on main. Create the entity first, branch it, then update key:branch.
  • Collection reads are main-only: GET /by-type/<type> and GET /by-trait/<trait> do not accept a branch.

The same suffix also accepts the name of a version number, e.g. by-key/widget/acme:1-0-3.

Reading as of an Instant​

GET (and HEAD) on a by-key, by-type/<type>/<key> or by-root address accepts ?as_of=<instant> and answers exactly what the same read answered at that instant: the head the branch had then, its @branch, its lifecycle @status and its version number.

GET /api/v1/by-key/vegetable/potato:dev?as_of=2026-09-27T12:00:00Z
→ 200 { "id": "<the commit dev pointed at then>", "@branch": "dev", "@as_of": "2026-09-27T12:00:00.000000Z", … }
  • The instant is an absolute RFC 3339 timestamp with a zone (…Z or …±HH:MM; encode + as %2B in a query string). Relative forms, times without a zone and future instants are 400.
  • The key is resolved now; the response shows that entity as it stood at the instant, and @key is the key it had then. A key renamed since still resolves.
  • An entity created after the instant, or a branch forked after it or deleted before it, reads 404. A deleted entity whose tombstone was the head at the instant reads 410.
  • The response carries @as_of (the instant shown). Present-time responses omit it.
  • Accepted on: the entity itself (GET /, any depth), GET /@status, GET /@branches, GET /@incoming, GET /@outgoing and GET /@referenced-by.
  • Refused with 400: every write, a by-id address, and every other sub-route (@history, /properties/…, /relationships/…, /lists/…, /components/…).
  • @search, GraphQL (asOf) and @candidates take the same anchor in their request body.

Depth Parameter​

Every GET that returns entity data accepts ?depth=<n> (integer, default 1).

  • depth=1 -- relationships are returned as arrays of UUID strings.
  • depth>=2 -- each relationship is expanded to a full entity object (recursively up to the requested depth).
warning

Use depth deliberately. Large depth values on entities with many relationships can return very large response payloads.


Entity Wire Format​

Response Shape​

{
"id": "<uuid -- this commit>",
"type_id": "<uuid -- entity type>",
"root_id": "<uuid -- stable identity>",
"@status": { "name": "new", "number": 0 },
"@key": "potato",
"@self": "vegetable/potato",
"@branch": "main",
"@label": "Potato",
"source": "<uuid>",
"target": "<uuid>",
"metadata": {
"previous": "<uuid>",
"merge_parents": ["<uuid>"],
"created_by": "user-name",
"created_on": "2024-01-01T00:00:00Z",
"package_name": "my.package"
},
"properties": { "weight": 5, "name": { "en_us": "Potato" } },
"relationships": { "has_tag": ["<rel-uuid>", "..."] },
"lists": { "items": ["..."] },
"components": { "delivery_address": { "type_id": "<uuid>", "properties": { "street": "Main", "zip": "1010" } }, "invoice_address": null },
"traits": {
"is_semantically_tagged": {
"type_id": "<uuid>",
"properties": { "semantic_tag": "http://schema.org/Potato" },
"relationships": {}
}
}
}

Notes:

  • @status is absent if the entity has no lifecycle map assigned.
  • @branch is the branch the read was resolved on.
  • metadata.previous is the previous commit. metadata.merge_parents is present only on a merge commit: the head of the merged-in branch. A merge commit's parents are previous followed by merge_parents.
  • metadata.version_numbers is present only for entities governed by a versioning scheme -- see Version Numbers.
  • @deleted: true marks a deleted entity (tombstone) where such entities are included; @variant: true marks a variation point. A variation point may also carry match (its match document).
  • source / target are only present for relationship entities. source is the root_id of the owning entity, not a commit id.
  • relationships values are UUID strings at depth=1; full entity objects at depth>=2.
  • components holds one owned sub-entity per declared component; an unset optional component is null.
  • Null/missing optional fields are omitted from the output.

Trait Object Shape​

Trait instances, components and list items are embedded in this compact shape:

{
"type_id": "<uuid>",
"properties": { "<name>": "<value>" },
"relationships": { "<rel_name>": ["<uuid>"] },
"lists": { "<list_name>": [ { "type_id": "<uuid>", "properties": {} } ] },
"components": { "<slot_name>": { "type_id": "<uuid>", "properties": {} } }
}

Traits can declare lists and components like any entity type. There is no trait sub-route, so this embedded shape is the only place their contents are returned.

Create / Update Input Format​

Used as the request body for entity creation (POST /by-type/<type>) and update (PUT on any entity address):

{
"key": "potato",
"label": "Potato",
"package_name": "my.package",
"lc_status": 0,
"properties": {
"weight": 5,
"flag": true,
"name": { "en_us": "Potato", "de_de": "Kartoffel" },
"content": { "html": "<p>...</p>" }
},
"relationships": {
"has_tag": [
{ "target": "tag/organic", "properties": { "relevance": 0.9 } }
]
},
"traits": {
"is_semantically_tagged": {
"properties": { "semantic_tag": "http://schema.org/Potato" }
}
},
"lists": {
"ingredients": [
{ "key": "line-1", "properties": { "amount": 200, "unit": "g" } }
]
},
"components": {
"delivery_address": { "properties": { "street": "Main", "zip": "1010" } }
}
}
  • key is optional. Resolution order: explicit key → the type's key_script → the stringified id. Keys must be unique within their key space; this is enforced on write. See Key Resolution.
  • On update, all fields are optional: a new commit is created that carries over every field not supplied. The body must change at least one field (see PUT /).
  • Relationship target values are a type_name/key string (e.g. "tag/organic"), a UUID string, or an in-line object (see below).
  • List-specific fields remove_lists and replace_lists and the component field remove_components are described under List Routes and Component Routes.
  • "variant": true creates a variation point (requires an explicit key; only on an entity or an owned list item; cannot be changed after creation). "match": { …filter… } attaches a match document to a variation point (a filter in the search grammar; on update: absent = keep, object = replace, null = clear).

Property value types -- the JSON shape selects the stored form; the declared property type must match it, otherwise the write fails with 400 naming the property:

JSON valueStored as
numberint or float
"string"plain string
true / falsebool
{ "en_us": "...", ... }multi-language string
{ "blob_id": "<uuid>", "store_id": "..." }BLOB descriptor
"<uuid>"BLOB reference
{ "value": …, "upper_range": …, … }range float
"<value>" on an enum propertyenum value (see Enum Properties)
"type_name/key"entity reference (e.g. a file_ref property)
any other object or arrayrich text, stored verbatim

Rich text also accepts { "content": … }, the shape a read returns, so a value from a GET can be written back unchanged. Because locale maps and BLOB/range descriptors are matched first, a rich-text document whose top level looks like one of them (e.g. { "en_us": … }) must be wrapped in { "content": … }.

Nested (In-line) Sub-Entities​

A create body is a tree: wherever a sub-entity belongs, you can write the whole object in place. The entire tree is validated and written in one transaction -- if any node fails, nothing is written.

ContainerShapeIn-line sub-entity
components{ "<slot>": { … } }Yes (the only way to set one); nests further
lists{ "<list>": [ { … } ] }Yes; an item with a root_id updates an existing item
traits{ "<trait>": { … } }Yes; nests further
relationships[*].target"type/key", "<uuid>" or { … }Yes -- an object creates the target entity and points the new edge at it
relationships[*]{ "target", "properties", "lists", "components", "traits", "relationships" }Yes -- an edge is an entity and carries what its relationship type declares
propertiesscalar / mapNo -- an entity-valued property is always a reference string

A component or list item takes its type from the has_component / has_list declaration, so a component payload carries no key, type_name or root_id (400 if present). An in-line relationship target may set its own type_name (e.g. a subtype).

Example -- an order with a two-level component chain and two list items in one request:

POST /api/v1/by-type/purchase_order

{
"key": "PO-1001",
"properties": { "customer": "ACME" },
"components": {
"ship_to": {
"properties": { "street": "Main 5", "zip": "1010" },
"components": {
"geo": { "properties": { "lat": "48.2082", "lon": "16.3738" } }
}
}
},
"lists": {
"lines": [
{ "key": "line-1", "properties": { "sku": "A-1", "qty": 2 } },
{ "key": "line-2", "properties": { "sku": "B-7", "qty": 1 } }
]
}
}

The response is the created order with the whole tree rendered inline. The nested component is then addressable as GET /api/v1/by-key/purchase_order/PO-1001/components/ship_to/components/geo.

Example -- an in-line relationship target creates an independent entity (vegetable/aubergine) in the same transaction:

POST /api/v1/by-type/recipe

{
"key": "ratatouille",
"properties": { "name": "Ratatouille" },
"relationships": {
"has_ingredient": [
{
"properties": { "count": 2 },
"target": {
"type_name": "entity_type/vegetable",
"key": "aubergine",
"properties": { "name": { "en_us": "Aubergine" }, "color": "purple" }
}
}
]
}
}

Limits: on a newly added relationship only target and the edge properties are used; other sub-entities nested on the edge object are ignored without an error (updating an existing relationship with a root_id does recurse). Nesting depth is limited to 64 (400: Nested sub-entity depth exceeds the limit of 64 …).


System / Meta Routes​

GET /version​

Returns the server build SHA. Does not require authentication.

Response 200:

{ "version": "abc1234..." }

OPTIONS *​

Returns 204 No Content for all CORS preflight requests.


Collection Routes​

GET /api/v1/by-type/<type_name>​

Returns all entities of the given type as a JSON array (always from main).

Query params: ?depth=<n>, ?include_deleted=true (include deleted entities, each with @deleted: true), ?include_variants=true (include variation points, each with @variant: true)

Response 200: Array of entity objects.

Response 404: { "error": "EntityType not found" }


POST /api/v1/by-type/<type_name>​

Creates one or more entities of the given type.

Request body: Either a single input object, or a JSON array of objects for bulk creation.

When an array is supplied, all entities are created atomically -- any validation failure rolls the entire batch back.

Response 200 (single): The created entity object.

Response 200 (array): A JSON array of the created entity objects, in request order.

Response 400 (single): { "error": "<validation message>" }

Response 400 (array): { "error": "<validation message>", "index": N } -- zero-based index of the failing element. The entire batch is rolled back.

Response 404: { "error": "EntityType not found" }


GET /api/v1/by-trait/<trait_name>​

Returns all entities that have the named trait attached (always from main).

Query params: ?depth=<n>, ?include_deleted=true, ?include_variants=true (as above)

Response 200: Array of entity objects.


POST /api/v1/@search​

Structured search over one entity type: filter by property values and by relationship, trait, list or component contents, sort, and paginate.

Query params: ?format=json|yaml (output format).

Request body:

{
"type": "vegetable", // required: entity type name
"filter": { /* filter node */ }, // optional; absent = all entities of the type
"sort": [ { "path": "weight", "dir": "desc", "as": "numeric" } ],
"limit": 50, // default 100, clamped to 1..1000
"offset": 0, // default 0
"after": "<cursor>", // keyset cursor from page.next_cursor
"depth": 1, // relationship expansion, clamped to 0..10
"branch": "main", // read branch (default main, falls back to main per entity)
"as_of": "2026-01-01T00:00:00Z", // optional point-in-time read
"with_total": true, // false skips the total count
"include_variants": false // include variation points (default false)
}

Pagination: offset skips N results (simple, but slower for deep pages and may drift under concurrent writes). after takes the previous response's page.next_cursor and returns the next page -- constant cost and stable; it takes precedence over offset. The cursor is opaque: pass it back unchanged. next_cursor is absent on the last page.

With include_variants: false, variation points are excluded from results and are also ignored when evaluating traversals (any/all/none).

Filter Nodes​

A filter node has exactly one key (a node with none or several keys is a 400):

NodeMeaning
{ "and": [ <node>, ... ] }All children match
{ "or": [ <node>, ... ] }Any child matches
{ "not": <node> }Negation
{ "cmp": { "path": …, "op": …, "value": <typed value> } }Property comparison
{ "any": { "via": …, "kind": …, "where": <node>, "edge": <node> } }At least one related item matches
{ "all": { "via": …, "kind": …, "where": <node> } }Every related item matches
{ "none": { "via": …, "kind": …, "where": <node> } }No related item matches

cmp: path is a property name, with optional sub_key for a language code or a range bound ({"path": "title", "sub_key": "en_us"}). op is one of =, !=, <, >, <=, >=, in, contains, like, is_null (is_null takes no value). A missing property counts as not-equal for != and as null for is_null.

Typed value: exactly one tag -- {"bool": true}, {"int": 5}, {"float": 5.0}, {"string": "x"}, {"uuid": "…"}, {"datetime": "2026-…"}, {"entity": "vegetable/potato"}, or for in a list: {"in": [{"string": "a"}, {"string": "b"}]}.

Reserved paths:

  • @status -- filter by lifecycle status name ({"cmp": {"path": "@status", "op": "=", "value": {"string": "released"}}}); op =, != or in. Entities that never changed status match the initial status. Top level only; the type must have a lifecycle.
  • @id -- filter by identity (matches id or root_id); value {"entity": "type/key"}, {"uuid": …} or {"string": "type/key"}; op =, != or in. Allowed in any scope, including inside traversals.

Traversals: kind is relationship (default), trait, list or component. via names the relationship type, trait, has_list name or has_component name. where filters the target entity (relationship), the trait instance, the list item or the component. edge filters the relationship instance's own properties (relationships only).

Examples:

// Orange vegetables heavier than 1
{ "type": "vegetable", "filter": { "and": [
{ "cmp": { "path": "color", "op": "=", "value": { "string": "orange" } } },
{ "cmp": { "path": "weight", "op": ">", "value": { "int": 1 } } } ] } }

// Recipes that use exactly 4 potatoes (edge property + target property)
{ "type": "recipe", "filter": {
"any": { "via": "has_ingredient", "kind": "relationship",
"edge": { "cmp": { "path": "count", "op": "=", "value": { "int": 4 } } },
"where": { "cmp": { "path": "name", "sub_key": "en_us",
"op": "=", "value": { "string": "potato" } } } } } }

// Shopping carts whose "items" list contains a vegetable named Potato
{ "type": "shopping_cart", "filter": {
"any": { "via": "items", "kind": "list",
"where": { "cmp": { "path": "name", "sub_key": "en_us",
"op": "=", "value": { "string": "Potato" } } } } } }

Response 200:

{
"results": [ <entity object>, ... ],
"page": { "total": 1234, "limit": 50, "offset": 0, "returned": 50, "next_cursor": "<opaque>" }
}

total is omitted when with_total is false. Entity objects use the standard wire format and honor depth.

Errors:

StatusCause
400Malformed JSON, missing type, unknown operator, value/operator mismatch, unknown via, unknown enum value, invalid or future as_of
404Unknown entity type

Current limitations: no full-text search; POST only; lifecycle status cannot be used for sorting; list items cannot be filtered or sorted by their position; enum values are resolved at the top level only (not inside a traversal's where/edge). Virtual properties are filterable and sortable, with the value from the last write of their entity.


GraphQL​

A GraphQL frontend over the same search engine as @search: filter, sort, pagination, branch and time-travel behave identically, and the @search limitations apply.

RouteAuthDescription
POST /api/v1/graphqlrequiredExecute a query
GET /graphqlpublicGraphiQL UI (it sends queries to the protected endpoint with a stored token, if any)
GET /graphql/schemapublicThe generated schema (SDL, text/plain)

POST /api/v1/graphql​

Standard GraphQL-over-HTTP envelope:

{ "query": "{ vegetables { items { key } } }", "operationName": "..." }

Results, including field errors, are returned with 200 in the { "data": …, "errors": [...] } envelope. 400 only for a malformed request body (invalid JSON, missing or empty query).

Generated Schema​

The schema is generated from the meta model: one object type per concrete entity type; abstract types become interfaces; all implement Node.

  • Root fields: one plural collection field per concrete type (vegetables, recipes, …) returning items and page { totalCount hasNextPage endCursor }.
  • Arguments: filter: FilterInput, orderBy: [Order], first: Int, after: String (the same cursor as @search), plus branch: String, asOf: DateTime, includeVariants: Boolean. The filter inputs mirror the @search filter nodes; op is an enum (EQ, NE, LT, GT, LE, GE, IN, CONTAINS, LIKE, IS_NULL).
  • Entity fields: id, key, label, branch, status (with a lifecycle); one field per property (enums become GraphQL enums; multi-language strings and rich text are JSON); lists as arrays; each relationship as a connection (edges { node cursor <edge properties> }, pageInfo, totalCount) with filter / orderBy / first / after on edge properties.
  • Introspection, fragments, aliases and @skip / @include are supported.
{
vegetables(filter: { cmp: { path: "weight", op: GT, value: { int: 1 } } },
orderBy: [{ path: "weight", dir: DESC }], first: 10) {
items { key label weight }
page { totalCount hasNextPage endCursor }
}
}

Current limitations: queries only (no mutations or subscriptions); variables are accepted but not substituted -- use literal arguments; virtual properties resolve to null; connection filters apply to edge properties only and the per-edge cursor is null (use pageInfo.endCursor); a document with several operations needs operationName.


Change Notifications (Events)​

A durable change feed of every commit, for services that must stay in sync (for example a search indexer). Events are written together with each commit, so a consumer that resumes from its last position never misses a change.

Each event is a reference, not the entity: re-fetch it via by-root/<root_id> or by-id/<id>. Delivery is at-least-once; process events idempotently by root_id. Changes to relationships, traits and list items are emitted too, and the owning entity's new commit emits its own event.

FieldDescription
seqMonotonic sequence number in commit order; the resume cursor
opcreate, update, delete, revive, merge, purge, status (lifecycle transition), instantiate (see @instantiate)
root_idStable identity of the changed entity
idThe new commit's id
type_id / type_nameThe entity's type
branchBranch the change was committed on

The feed covers all branches. Issuing a version number writes no commit and therefore produces no update event.

GET /api/v1/@events​

A Server-Sent Events stream (Content-Type: text/event-stream).

id: 12345
event: update
data: {"seq":12345,"op":"update","root_id":"<uuid>","id":"<commit-uuid>","type_id":"<uuid>","type_name":"vegetable","branch":"main"}

Query params: ?since=<seq> -- start after this sequence (omitted or 0 = from the beginning). Without ?since=, the Last-Event-ID header is used, so a browser EventSource resumes automatically on reconnect.

An idle stream sends a periodic event: heartbeat. Authentication is the same as for every /api/v1 route.

GET /api/v1/@events/ws​

The same feed over a WebSocket, plus the whole API as RPC on the same socket -- a client can react to an event and fetch the entity without a second connection.

  • Server push: { "event": "update", "seq": 12345, "op": "update", "root_id": "<uuid>", "id": "<commit-uuid>", "type_id": "<uuid>", "type_name": "vegetable", "branch": "main" } -- has event, no status.
  • RPC request: { "id": 7, "method": "GET", "path": "/api/v1/by-id/<id>", "headers": [...], "body": {…} } → reply { "id": 7, "status": 200, "headers": [...], "body": {…} } -- has id and status, no event. Each RPC call is authenticated by the token in its own headers.

Resume with ?since=<seq>. The connection is authenticated by the Authorization header or ?token=<jwt> (browsers cannot set headers on a WebSocket handshake). An idle socket receives {"event":"heartbeat"}.

Notes: replies are matched by id. Routes that return files or streams cannot be called over the socket (502 reply). A slow consumer may miss live pushes under backpressure -- catch up with ?since=; RPC replies are always delivered.


Entity Operations​

The following sub-paths apply to any entity addressed by one of the four lookup prefixes (e.g. /api/v1/by-key/vegetable/potato/@history).

GET /​

Returns the entity.

Query params: ?depth=<n>, ?as_of=<instant>

Response 200: Entity object.

Response 404: { "error": "Entity not found" }


PUT /​

Updates the entity and creates a new commit; earlier commits remain in the history.

Request body: Create/Update input format -- only supply fields to change. The body must change at least one field; {}, {"properties": {}} or {"key": null} are rejected. (To issue a version number without changing content, use POST /@bump.)

Writable addresses: a branch (default main). A version-number address (key:1-0-2) is writable only when it is the current version number of a line that has no branch -- see @bump. Frozen version numbers, tags, and the current version number of a line with a branch are refused with 400.

Response 200: Updated entity object.

Response 400: { "error": "Update failed: <reason>" } -- including Update contains no changes; supply at least one field to change. and a non-writable address.

Response 409: The addressed commit is not the head of main (see Selecting a Branch).


DELETE /?purge=true​

Permanently deletes the entity with all its commits (everything sharing the same root_id). The ?purge=true query param is required.

Response 200: Empty body.

Response 409: Entity could not be purged.


GET /@status​

Returns the current lifecycle status entity for this entity.

Query params: ?depth=<n>, ?as_of=<instant>

Response 200: Full entity object for the lc_status entity.

Response 404: { "error": "No LifeCycle available for entity!" }


PUT /@status / POST /@status​

Transitions the entity to a new lifecycle status. The status is stored on the branch, not in the entity: no new commit is created and @history is unchanged.

Request body: Status name string or status number:

"review"

or

100

Response 200: Updated entity object.

Response 400: { "error": "<reason>" } -- malformed body, invalid status, illegal transition, or a veto by a pre-hook.

Response 500: A declared hook could not be evaluated.


PUT /@status/<status> / POST /@status/<status>​

The same transition with the target status in the path; no body needed (any body is ignored):

PUT /api/v1/by-key/vegetable/potato/@status/review
PUT /api/v1/by-key/vegetable/potato/@status/100

An all-digit segment is read as a status number, anything else as a status name. Responses as for the body form.

Hooks: if the type declares hooks (see Lifecycle Hooks), a pre hook can veto a transition, create, update or merge (400); a post hook runs after the commit. A hook that cannot be evaluated (broken script, unreachable endpoint, endpoint answering 5xx) rejects the write with 500. event.kind tells the hook what changed, using the change-feed op names.

Default lifecycle (lc_map/EP_Default):

StatusNumberReleasedRead-only
new0nono
review100noyes
released200yesyes
obsolete300noyes

Valid transitions: new → review → released → obsolete, and review → new.


GET /@incoming​

Returns all relationship entities whose target points to this entity and that still belong to the current commit of their source entity (relationships of older source commits are excluded).

On a branch address, each source is resolved on that branch, falling back to main.

Query params: ?as_of=<instant> -- evaluate each source as it stood at that instant.

Response 200: Array of relationship entity objects.


GET /@outgoing​

Returns a map of all outgoing relationships keyed by relationship type UUID.

Query params: ?depth=<n>, ?as_of=<instant>

Response 200:

{
"<rel-type-uuid>": ["<rel-uuid>", "..."]
}

GET /@referenced-by​

Returns the entities that reference this entity through an entity-reference property (e.g. file_ref, entity_type_ref, enum_ref). Only current, non-deleted entities are included.

Relationships are not included -- use GET /@incoming for those. An entity referenced only by relationships returns {}.

Query params: ?as_of=<instant>

Response 200: Referring entity UUIDs grouped by referring type name and property name:

{
"<referring-type-name>": {
"<property-name>": ["<entity-uuid>", "..."]
}
}

GET /@history​

Returns the commits of this entity, newest first, following metadata.previous. After a merge this is the target branch's line only; commits of the merged-in branch are not included. To follow the second line, take the id from a merge commit's metadata.merge_parents and call GET /by-id/<that-id>/@history.

Response 200: Array of entity objects.


GET /@type[/...]​

Returns the EntityType entity that describes this entity's type. All entity sub-paths can be appended, allowing recursive traversal:

GET /api/v1/by-id/<uuid>/@type
GET /api/v1/by-id/<uuid>/@type/properties/name

GET /@previous[/...]​

Navigates to the preceding commit. All entity sub-paths can be appended.

Response 404: No previous commit exists.


GET /@source[/...]​

For relationship entities: navigates to the source entity. Sub-paths can be appended.


GET /@target[/...]​

For relationship entities: navigates to the target entity. Sub-paths can be appended.


POST /@action/<action_name>​

Executes a named action declared on the entity's type via has_action.

Response 200:

{ "result": "<action output string>" }

Response 409: Action execution failed; nothing was written.

An action script may change entities -- the addressed one, entities it loads or reaches through relationships. Each change is written as a new commit through the same checks as a PUT (lifecycle, branch, ownership), and fires hooks and change-feed events. One call can therefore create commits on several entities, and the addressed entity may have a newer commit afterwards. A script run is atomic: all its changes are written together, or none.


Branching & Merging​

Git-like branches for one aggregate (an entity plus the relationships, list items, components and traits it owns). These routes are entity sub-paths and always act on the aggregate root -- addressed at a sub-entity, they act on its owning entity. Except for POST /@branch, they ignore a :branch suffix on the address. See Branching & Version Numbers for the concepts.

GET /@branches​

Lists the refs of this aggregate.

Query params: ?include=versions (or all) -- also list version-number refs (hidden by default). ?as_of=<instant> -- the refs that existed then.

Response 200:

{
"root_id": "<uuid>",
"branches": [
{ "name": "main", "head": "<uuid>", "kind": "branch", "lc_status": "new", "line": "main" },
{ "name": "dev", "head": "<uuid>", "kind": "branch", "lc_status": "new", "line": "main" },
{ "name": "maint", "head": "<uuid>", "kind": "branch", "lc_status": "review", "line": "maint" },
{ "name": "1-0-1", "head": "<uuid>", "kind": "version", "lc_status": "released", "line": "main" }
]
}
  • kind: branch or version (a version number).
  • lc_status: present if the type has a lifecycle map (and the stored status still resolves). The current version number of a line with a branch reports that branch's status; a frozen version number reports the status it was pinned with.
  • line: the ref that owns this ref's numbering line. A ref with line == name owns its line and may issue version numbers (@bump). Absent if the owning branch was deleted.

POST /@branch​

Creates a branch (no data is copied).

  • With by-root / by-key: forks from the current head of the addressed branch (by-root/<uuid>:dev/@branch forks from dev; without suffix from main).
  • With by-id: forks at exactly that (possibly old) commit; from in the response is empty. (by-type/<type>/<uuid> is not treated as a pinned commit -- it forks from the branch head.)
  • At a version number (…:1-0-1/@branch): the new branch starts its own numbering line; its first @bump continues from that number (e.g. 1-0-1 → 1-0-2) while the mainline stays unchanged.

Request body:

{ "name": "dev" }

Branch names must match [A-Za-z0-9_-]+. Add "as_of": "<instant>" to fork from the head the source branch had at that instant (404 if the branch did not exist then; 400 with a by-id address or an invalid instant).

The new branch copies the lifecycle status of its source; a branch created at a frozen version number starts at the initial status instead.

Response 201: { "name": "dev", "from": "main", "head": "<uuid>" } (plus as_of if given).

Response 400: Invalid branch name.

Response 409: Branch already exists, source branch does not exist, or the lifecycle's initial status cannot be resolved.


DELETE /@branch/<name>​

Removes a branch. Only the pointer is removed; commits made on the branch remain reachable by id until the entity is purged.

Response 204: Deleted.

Response 400: main cannot be deleted.

Response 404: Branch not found.


GET /@reflog​

Lists every period a ref was in force (head and lifecycle status), oldest first. A new commit, fast-forward, status transition, pin or rename ends one period and starts the next.

Query params: ?ref=<name> -- the ref to list (default: the ref the address resolved on; deleted refs can be named here); ?ref=* -- all refs. ?as_of is refused.

Response 200:

{
"root_id": "<uuid>",
"periods": [
{ "ref": "dev", "kind": "branch", "head": "<uuid>", "lc_status": "new",
"from": "2026-09-29T14:02:11.412088Z", "to": "2026-09-29T14:05:40.007315Z", "ended_by": "update" },
{ "ref": "dev", "kind": "branch", "head": "<uuid>", "lc_status": "review",
"from": "2026-09-29T14:05:40.007315Z" }
]
}

to and ended_by are absent for the current period. ended_by is update (superseded) or delete (ref removed). A period's from can be used as ?as_of= to read that state.

Response 400: Invalid ref, or as_of given. Response 404: No ref of that name, now or ever.


POST /@merge​

Three-way merge of one branch of this aggregate into another.

Request body:

{
"source": "dev",
"target": "main",
"resolutions": [
{ "kind": "property", "field": "color", "value": "blue" },
{ "kind": "relationship", "container": "has_ingredient", "field": "<rel-root-id>", "choice": "theirs" }
]
}

target defaults to main. resolutions is optional -- send it to complete a merge that reported conflicts. Each resolution matches one conflict by kind, container and field. Property conflicts take a value or choice: ours|theirs; all other kinds take choice; list conflicts accept only choice: ours. A resolution that matches no conflict is 400.

Response 200:

{
"kind": "three_way",
"conflicts": [],
"merge_commit_id": "<uuid>",
"base": "<uuid>",
"ours_head": "<uuid>",
"theirs_head": "<uuid>"
}

kind is up_to_date, fast_forward, three_way or unrelated. merge_commit_id is set only when a merge commit was written; for a fast-forward the new head is theirs_head. The merge commit has ours_head as metadata.previous and theirs_head in metadata.merge_parents.

Response 409 -- conflicts (nothing committed) or unrelated:

{
"kind": "three_way",
"conflicts": [
{
"kind": "property", "strain_root_id": "<uuid>", "container": "",
"field": "color", "base": "brown", "ours": "red", "theirs": "green"
}
]
}

Conflict kind: property (field = property name), relationship (container = relationship type, field = instance root_id), trait / component / list (name), type_id and existence (both empty), match (field = "match"). base, ours and theirs are always filled.

A 409 with error set and retryable: true means the target changed during the merge -- retry.

Response 400: source == target, unknown branch, target branch in a read-only status, unmatched resolution, invalid input or a hook veto -- with error and retryable: false.

Limitations: property, relationship and trait changes merge automatically; list changes always surface as conflicts; an aggregate's key cannot be renamed on a branch other than main. Lifecycle status is per branch and not merged.


Variation Points​

A variation point (API name: variant) is a typed placeholder whose content describes which real entity may take its place. @instantiate replaces the places where a variation point is used (relationship targets, owned list items) with real entities ("fillers"). Variation points are created with "variant": true and an explicit key (input format), read with @variant: true, and hidden from listings and search unless include_variants is set. See Variation Points for the concepts.

GET /@variants​

Lists the variation points used in the addressed aggregate -- the input for an @instantiate request. Honors :branch.

Response 200:

[ { "variant": "part/tbd_motor_400w", "root_id": "<uuid>",
"sites": [ { "kind": "relationship", "via": "has_part", "rel_root_id": "<uuid>" } ] } ]

kind is relationship or list; via names the relationship type or list.

Response 404: Unknown aggregate. 400: The aggregate could not be walked (e.g. nesting limit).


POST /@candidates​

On a variation point: returns the real entities that could fill it. The body is an @search body without type ({} for defaults); a caller filter is combined with the variation point's own criteria.

{ "filter": { "cmp": { "path": "@status", "op": "=", "value": { "string": "released" } } },
"sort": [ { "path": "weight", "dir": "desc" } ], "limit": 50, "branch": "dev",
"as_of": "2026-08-01T00:00:00Z", "with_total": true, "explain": false }

Variation points and deleted entities are never offered. explain: true adds the compiled criteria ({ "kind", "path", "detail" } per condition).

Response 200: { "results": [ … ], "page": { "returned": N, "total": M, "next_cursor": "…" }, "explain": [ … ] } -- total is an upper bound.

Response 400: Addressed entity is not a variation point, malformed body, filter or cursor, or the variation point's criteria cannot be compiled.


POST /@instantiate​

Replaces the variation points of an aggregate with the bound fillers, atomically, on the addressed branch (branches only -- a version number or tag is 409; a variation point itself is 400).

{
"mode": "in_place", // only "in_place"
"bindings": {
"part/tbd_motor_400w": "part/m400_syn", // string: existing entity
"part/tbd_controller": { "key": "plc_9000", // object: create a new entity
"properties": { "power": 24 } } // (type defaults to the variation point's)
},
"strict": true, // default: every variation point must be bound
"dry_run": false // validate and report only
}

Binding keys name a variation point by type_name/key, root UUID, or a bare key if unique. One binding fills all places of that variation point, and every binding must be used. A create object must not carry a root_id (a pasted entity response is rejected). A reference to an existing entity is refused for a list place; a create object is refused for a variation point used both as relationship target and list item.

Response 200: The resulting aggregate head. With dry_run: true: { "ok": true, "resolved": [ { "variant", "filler", "sites": N } ] }.

Response 400 -- nothing committed:

{ "error": "instantiation failed",
"unbound": [ "part/tbd_bearing" ],
"unused_bindings": [ "part/tbd_gearwheel" ],
"violations": [ { "variant": "part/tbd_motor_400w", "filler": "part/m300_syn",
"checks": [ { "kind": "property", "path": "power", "detail": "power = 400" } ],
"message": "" } ] }

Response 409: Concurrent change (retry), or the address is not a branch. 404: Unknown aggregate.

The root commit appears in the change feed as op: "instantiate"; hooks see event.kind == "instantiate".


Version Numbers​

An aggregate governed by a versioning scheme (via a has_versioning_scheme relationship on the entity or on its entity type) carries a configurable version number in addition to its commits:

CommitVersion number
Whatone immutable snapshot per writea named number for the aggregate (e.g. v1.0.3)
Created byevery writePOST /@bump, or a lifecycle transition configured to issue one
Addressed byby-id/<uuid>:<name> on a key or root address, e.g. by-key/widget/acme:1-0-3

Issuing a version number writes no commit. The current version number follows its line's branch head, so later commits still belong to it; when the next number is issued, the outgoing one is pinned (frozen) at the head it ended on. An aggregate can have several numbering lines (e.g. a v1.0.x maintenance line next to a v2.x mainline); which line answers a read is decided by the address. See Branching & Version Numbers for the concepts.

A governed aggregate holds the scheme's first number from the moment it is governed (at creation, or when the scheme is bound later); otherwise its first @bump sets it.

In entity responses, metadata.version_numbers is a list:

"metadata": {
"version_numbers": [
{ "scheme": "versioning_scheme/semver",
"segments": { "major": "1", "minor": "0", "patch": "3" },
"label": "v1.0.3", "name": "1-0-3" }
]
}
  • Index 0 is the number in force for the address that was read; further entries are other version numbers pinned at exactly this commit, most recent first. The field is omitted for ungoverned aggregates and for commits no version number names (a commit in the middle of a frozen range reports none).
  • segments: level name → value as string (digits only, without prefix, postfix or padding). Can be sent back to PUT /@version.
  • label: the formatted number as a person reads it; omitted if the scheme no longer exists or no longer fits.
  • name: the identifier used in addresses and in @branches; does not change when the scheme's formatting changes.
  • scheme: type_name/key of the scheme, or root/<uuid> if the scheme was purged.

POST /@bump​

Issues the next version number: pins the current one and opens the next at the same head. No commit is written; content and lifecycle status are unchanged. Works in read-only statuses (e.g. released).

Which line: the line of the addressed ref. POST …/beet/@bump advances the mainline; POST …/beet:maint/@bump the line owned by maint. Only the ref that owns a line may issue on it (a branch like dev created from main is refused with 400).

Addressing a frozen version number starts a new line from it, leaving the mainline unchanged:

POST /api/v1/by-key/vegetable/beet:1-0-1/@bump {} -> 1-0-2, on a line of its own
PUT /api/v1/by-key/vegetable/beet:1-0-2 {…the fix…} -> 200
POST /api/v1/by-key/vegetable/beet:1-0-2/@bump {} -> 1-0-3

GET /api/v1/by-key/vegetable/beet -> v2.x, no fix (mainline, untouched)
GET /api/v1/by-key/vegetable/beet:1-0-1 -> v1.0.1, no fix (frozen)

Such a line has no branch; its current version number is its write target (and its address changes with every issue). Use POST …:1-0-1/@branch instead if the line needs a stable name or must be a merge target.

Request body (optional; empty = increase the least significant level):

{ "level": "minor" }

or { "level_index": 0 } (0 = most significant). level takes precedence.

Response 200: The aggregate head with the new number at index 0 of metadata.version_numbers.

Response 400: Not governed by a scheme, unknown level, malformed body, a sub-entity address, or an address that neither owns its line nor is a frozen version number.

Response 404: Entity not found.

Response 409: Level exhausted (no auto_bump), stored number no longer matches the scheme, invalid scheme, resulting number already exists on this aggregate (e.g. …:1-0-1/@bump when 1-0-2 exists on the mainline), or entity deleted.

PUT /@version​

Re-numbers the current version number of the addressed line (import or correction). Nothing is issued or pinned; the ref is renamed to the new number. Frozen version numbers are not accepted -- address the ref that owns the line.

Request body -- segments in one of three forms:

{ "segments": { "major": "1", "minor": "2", "patch": "3" } }
{ "segments": ["1", "2", "3"] }
{ "scheme": "versioning_scheme/semver", "segments": [[1], [2], [3]] }

The object form is what a read returns. scheme is optional and must match the current scheme.

Response 200: The aggregate head with the corrected number.

Response 400: Wrong segment count, unknown, missing or duplicate level, unparseable value, malformed body, ungoverned aggregate, sub-entity address, or an address that does not own its line (including a frozen version number).

Response 404: Entity not found.

Response 409: A different scheme, or the number already exists on this aggregate.


Enum Properties​

An enum property is always the plain value string on the wire, in both directions. See Enums for the model.

Defining an enum -- definition and entries in one request (entries are a list; keys are derived from name / value):

POST /api/v1/by-type/enums

{
"properties": { "name": "fruit_color", "label": { "en_us": "Fruit Color" } },
"lists": {
"entries": [
{ "properties": { "value": "red", "label": { "en_us": "Red" }, "int_value": 0 } },
{ "properties": { "value": "green", "label": { "en_us": "Green" }, "int_value": 1 } },
{ "properties": { "value": "yellow", "label": { "en_us": "Yellow" }, "int_value": 2 } }
]
}
}

The optional integer mapping is int_value (int_mapping is rejected; only the built-in enums use int_mapping). Then, in this order, create the property type and declare it on an entity type:

POST /api/v1/by-type/enum_property_type

{ "properties": { "name": "fruit_color", "label": { "en_us": "Fruit Color" }, "enum_ref": "enums/fruit_color" } }

POST /api/v1/by-type/entity_type

{
"properties": { "name": "fruit", "label": { "en_us": "Fruit" } },
"relationships": {
"has_prop": [
{ "properties": { "name": "color", "label": { "en_us": "Color" }, "required": false },
"target": "enum_property_type/fruit_color" }
]
}
}

Reading and writing:

RequestBody / Result
POST /api/v1/by-type/fruit{ "key": "apple", "properties": { "color": "red" } }
GET /api/v1/by-key/fruit/apple/properties/color"red"
PUT /api/v1/by-key/fruit/apple{ "properties": { "color": "green" } } -- a new commit

Omitting the property on update keeps its value. null clears an optional enum property. A value whose entry was removed reads back as null.

Errors (all 400, the whole write fails):

BodyCause
Enum value 'purple' not found in enum for property 'color'No such entry
Wrong type for property 'color' of entity type 'fruit'Value is not a string
Missing value for required property: colorRequired enum not supplied on create
Missing value for enum property 'color'Required enum supplied as null

Changing the values -- entries are list items of the enums entity, so the List Routes apply (e.g. POST /api/v1/by-key/enums/fruit_color/lists/entries, PUT …/lists/entries/@order, DELETE …/lists/entries/<item_root_id>). Before removing an entry, check dependent property types with GET /api/v1/by-key/enums/fruit_color/@referenced-by. Do not rename an entry's value once it is used.

Filtering: @search compares an enum against its value string, e.g. { "cmp": { "path": "color", "op": "=", "value": { "string": "red" } } }; an unknown value is 400.


Property Routes​

GET /properties​

Returns all properties of the entity as a flat map.

Response 200:

{
"weight": 5,
"name": { "en_us": "Potato" }
}

GET /properties/<prop_name>​

Returns the value of a single property.

Response 200: Property value (bare JSON -- string, number, object, etc.)

Response 404: Property does not exist.


GET /properties/<prop_name>/@download​

For BLOB-type properties: redirects the client to a presigned S3 download URL (valid for 5 minutes).

Response 302: Location header contains the presigned URL. The client should follow the redirect to fetch the binary data directly from the blob store.

Response 404: Property does not exist or the BLOB reference is empty.

Response 400: Property is not a BLOB type.


PUT /properties/<prop_name>/@upload​

For BLOB-type properties: generates a presigned S3 upload URL for a new blob object. The blob is not yet associated with the entity -- the caller must complete the three-step workflow.

Response 200:

{
"blob_id": "<uuid>",
"upload_url": "<presigned S3 PUT URL>"
}

The presigned URL is valid for 5 minutes.

Response 400: Property is not a BLOB type.

Full BLOB upload workflow:

  1. PUT /properties/<prop>/@upload -- obtain a fresh blob_id and upload_url.
  2. PUT <upload_url> (directly to S3) -- send the file bytes. This request goes to the blob store, not to EP.Core.
  3. PUT / (update entity) -- set the property value to the blob_id UUID string received in step 1.

In entity responses a BLOB property reads as { "blob_id": "<uuid>", "store_id": "default" }. In the response to a create that supplied a BLOB property, it additionally carries @upload_url (same as step 1), so the explicit @upload call can be skipped.

See BLOB Properties for the full conceptual documentation.


Relationship Routes​

Relationship instances are themselves full entities (with their own UUID, properties, and metadata).

GET /relationships​

Returns all relationships on this entity grouped by relationship type name.

Response 200:

{
"has_tag": ["<rel entity object>", "..."],
"has_version": ["<rel entity object>", "..."]
}

GET /relationships/<rel_name>​

Returns all relationship instances of the given type.

Response 200: Array of relationship entity objects; [] if the type is declared but the entity has none.

Response 404: { "error": "RelationshipType '<rel_name>' not found in EntityType '<type>'!" } -- not declared on this entity type.


POST /relationships​

Creates one or more relationships in bulk. The body is a map of relationship type names to arrays of targets.

Request body:

{
"has_tag": [
{ "target": "tag/organic", "properties": { "relevance": 0.9 } }
],
"has_version": [
{ "target": "version/1.0" }
]
}

Response 200: Updated entity object (with new relationships included).

Response 400: { "error": "<reason>" }


POST /relationships/<rel_name>​

Creates one or more relationship instances of a specific type. Body may be a single object or an array.

Request body (single):

{
"target": "tag/organic",
"properties": { "relevance": 0.9 }
}

Request body (multiple):

[
{ "target": "tag/organic" },
{ "target": "tag/seasonal" }
]

Response 200: Updated entity object.

Response 400: { "error": "<reason>" }

Response 404: Relationship type not declared on this entity type.


GET /relationships/<rel_name>/<rel_root_id>[/...]​

Returns a single relationship instance identified by its root UUID. All entity sub-paths can be appended, allowing traversal through the relationship entity:

GET /relationships/has_tag/<rel-root-uuid>
GET /relationships/has_tag/<rel-root-uuid>/@target
GET /relationships/has_tag/<rel-root-uuid>/@target/properties/name

Response 404: Relationship not found.


PUT /relationships/<rel_name>/<rel_root_id>​

Updates a single relationship instance (POST works the same way).

Request body: Create/Update input format.

Response 200: Updated entity object.


DELETE /relationships/<rel_name>/<rel_root_id>​

Removes the named relationship instance.

Response 200: Updated entity object (without the removed relationship).

Response 400: Invalid relationship UUID or invalid request.

Response 404: Relationship not found.

Response 409: The removal conflicts with the entity's lifecycle status or a concurrent change.


List Routes​

List items are owned sub-entities (see Lists), addressed by their <item_root_id>. The routes are entity sub-paths and honor :branch. Every write returns the updated parent and is refused if the parent is in a read-only status.

The lists field of a create/update body does the same edits:

  • Merge (default): items with a root_id are updated, items without are appended, unmentioned items are kept. "remove_lists": { "<list>": ["<item-root-id>"] } removes items.
  • Replace: for each list named in replace_lists, the payload's items and order replace the list.
MethodPathBodySuccess
GET/lists--200 -- { "<list>": [ <items> ] } (honors depth)
GET/lists/<name>--200 -- array of items
POST/lists/<name>item or array (with root_id = update)200 -- parent
GET/lists/<name>/<item_root_id>[/...]--200 -- item (sub-paths recurse into it)
PUT / POST/lists/<name>/<item_root_id>input format200 -- parent
DELETE/lists/<name>/<item_root_id>--200 -- parent
PUT/lists/<name>/@order{ "order": ["<item-root-id>", …] } (all current items, each once)200 -- parent

Errors: 400 (validation, bad UUID, @order that is not exactly the current items); 404 (list not declared, or item not in the list); 409 (read-only status or concurrent change).


Component Routes​

Components are owned sub-entities, one per declared name (has_component). The routes are entity sub-paths, honor :branch, and address a component by its name. Every write returns the updated parent and is refused if the parent is in a read-only status.

In a create/update body, a components object is merged into the existing component (unmentioned fields are kept); null or a name in remove_components clears an optional component. A component payload carries no key, type_name or root_id (400).

MethodPathBodySuccess
GET/components--200 -- { "<name>": <object> or null } (honors depth)
GET/components/<name>--200 -- component; 204 if optional and unset
PUT/components/<name>component object200 -- parent (fields are merged, not replaced)
POST/components/<name>component object200 -- parent (merges; creates if absent)
DELETE/components/<name>--200 -- parent (409 if the component is required)
GET / PUT / POST/components/<name>/…-- / input format200 -- into the component (e.g. /components/delivery_address/properties/zip); a write into an unset optional component is 404

Errors: 400 (validation, or key/type_name/root_id in the payload); 404 (component not declared); 409 (clearing a required component, read-only status or concurrent change).


Batch Upload​

POST /api/v1/@upload​

Creates multiple entities and relationships in a single atomic operation. All items are committed together or none at all -- if any entity or relationship fails validation, the entire batch is rolled back. Entities are always created on main.

Processing is two-phased:

  1. Entities are created first (in array order).
  2. Relationships are created after all entities, so relationship sources and targets may freely reference entities created in the same batch.

Request body:

{
"entities": [
{
"type_name": "entity_type/recipe",
"key": "lasagna",
"properties": { "name": "Lasagna" }
},
{
"type_name": "entity_type/vegetable",
"key": "pea",
"properties": { "name": { "en_us": "Pea" }, "weight": 1 }
}
],
"relationships": [
{
"type_name": "has_ingredient",
"source": "recipe/lasagna",
"target": "vegetable/pea",
"properties": { "count": 2 }
}
]
}

Request fields:

FieldTypeDescription
entitiesarrayOrdered list of entity objects (input format plus type_name)
entities[].type_namestringRequired for a create. The entity type in entity_type/<name> format
entities[].root_idstringOptional. Updates an existing entity instead (no type_name). Also works for an owned relationship, list item or component; its response slot then holds that sub-entity
entities[].keystringOptional. Entity key
entities[].propertiesobjectOptional. Property values
entities[].relationshipsobjectOptional. Relationships declared on the entity type
entities[].traitsobjectOptional. Trait instances
relationshipsarrayOrdered list of relationship creation objects
relationships[].type_namestringRequired. Relationship type name (e.g. "has_ingredient")
relationships[].sourcestringRequired. Source entity in type_name/key format (may reference a batch entity)
relationships[].targetstringRequired. Target entity in type_name/key format (may reference a batch entity)
relationships[].propertiesobjectOptional. Edge property values

Response 200: one entity object per request item, in request order:

{
"entities": ["<entity object>", "..."],
"relationships": ["<entity object>", "..."]
}

Response 400:

{
"error": "<validation message>",
"phase": "entities",
"index": 1
}

phase is either "entities" or "relationships"; index is the zero-based position of the failing item within that array.

Response 405: Any method other than POST.


POST /api/v1/@upload/stream​

The same atomic import for very large payloads: the body is read as a stream at constant memory. One batch, all or nothing.

The Content-Type selects the input format:

Content-TypeShapeStreamed
application/x-ndjson, application/jsonlOne JSON object per line with "kind": "entity" or "kind": "relationship"yes
application/json (default)The @upload bodyyes
application/yaml, application/ymlThe @upload body in YAMLno (max. 64 MiB)
  • Items may come in any order; relationships may precede their source or target, and a target may already exist in the database.
  • One batch writes at most one commit per entity -- an entity and all relationships sourced from it are written together. The same entity twice in one payload is rejected.
  • Virtual properties that aggregate over relationships are computed once at the end of the batch.
  • To be referenced by other items, an entity needs an explicit key (or must be nested in the referencing item).
  • Prefer NDJSON for large imports: it can be generated, split and resumed line by line.
POST /api/v1/@upload/stream
Content-Type: application/x-ndjson

{"kind":"entity","type_name":"entity_type/recipe","key":"lasagna","properties":{"name":"Lasagna"}}
{"kind":"relationship","type_name":"has_ingredient","source":"recipe/lasagna","target":"vegetable/pea","properties":{"count":2}}
{"kind":"entity","type_name":"entity_type/vegetable","key":"pea","properties":{"name":{"en_us":"Pea"}}}

Response 200 -- counts instead of entity objects:

{ "entities": 1560175, "relationships": 3090860, "items": 4651035, "groups": 1560175, "bytes": 1457567808, "chunks": 22242 }
FieldDescription
entitiesEntities created or updated
relationshipsRelationships written
itemsItems read from the body
groupsDistinct entities touched
bytes, chunksTransport statistics

Errors (the whole batch is rolled back):

{ "error": "'lca_exchange/X2': Missing value for required property: exchange_direction", "line": 5, "kind": "entity" }
StatusCause
400An item is unusable (bad JSON, missing kind or source)
409A write or validation failed
503Server at write capacity -- retry shortly; nothing was written
500The batch could not be started or committed; nothing was written
405Any method other than POST

line is the line number (NDJSON) or the item position (JSON/YAML) of the offending item.

Limits: request body max. 256 MiB by default (server-configurable); entities are created on main only; an entity type cannot be defined and used in the same request; per-entity post-commit hooks do not fire (the change feed is written as usual).


POST /api/v1/@upload/async​

The streaming import as a background job: the body is stored, the server answers 202 with a job id immediately, and the import runs afterwards. Same formats and guarantees as @upload/stream (hooks do not fire). The job writes on the addressed branch (:branch, else main).

POST /api/v1/@upload/async
Content-Type: application/x-ndjson
Transfer-Encoding: chunked

Response 202:

{ "job_id": 42, "state": "queued", "bytes": 183456, "chunks": 12 }

Response 413: Body larger than the server limit (256 MiB by default).

Response 500: could not open an ingest job, could not store the queued payload or the job could not be queued.

GET /api/v1/@upload/job/<job_id>​

Returns the job state.

{ "job_id": 42, "state": "running", "bytes": 183456, "chunks": 12 }
{ "job_id": 42, "state": "done", "bytes": 183456, "chunks": 12,
"result": { "entities": 1200, "relationships": 300, "items": 1500, "groups": 1200, "bytes": 183456, "chunks": 12 } }
{ "job_id": 43, "state": "failed", "bytes": 91, "chunks": 1,
"error": "Type 'entity_type/no_such_type' not found", "line": 2 }

state: uploading → queued → running → done | failed. A job is put back to queued if the server is at capacity; a server shutdown fails it ("please re-submit"). result is the @upload/stream summary; error and line describe the failing item.

Response 404: { "error": "no such ingest job" }


Blob Store Routes​

Direct read access to a named blob store by store_id and blob_id, without going through an entity property. The only currently registered store is "default".

GET /api/v1/blob_store/<store_id>/<blob_id>​

Returns a presigned download URL for the given blob object.

Response 200:

{ "url": "<presigned S3 GET URL>" }

Response 404: Store not found.

Response 405: Any method other than GET. There is no upload on this route; upload through PUT /properties/<prop_name>/@upload, which always issues a new blob id.


Error Responses​

Error responses use this shape (some routes add fields, e.g. index, phase, line, retryable or a conflict list):

{ "error": "<human-readable message>" }

The body is always valid JSON; special characters in the message are escaped.

StatusMeaning
400 Bad RequestInvalid input, validation failure, illegal transition, hook veto, address that cannot be written
401 UnauthorizedMissing or invalid token
404 Not FoundEntity, type, property, relationship, branch or job not found
405 Method Not AllowedHTTP verb not supported on this route
409 ConflictOperation could not be completed (e.g. purge blocked, action failed, branch exists, merge conflicts, concurrent change, version number exists)
410 Goneas_of read of an entity that was deleted at that instant
413 Payload Too LargeUpload body exceeds the server limit
500 Internal Server ErrorUnexpected server-side failure, or a hook could not be evaluated
503 Service UnavailableServer at write capacity (streamed upload) -- retry