HZN-API-002 — REST API Guide
The developer-facing guide to the Horizon REST API. How to authenticate, discover a tenant's data model, read and write records, import data in bulk, transfer files, subscribe to events, and keep an offline client in step.
Language. This document is written in English because HZN-STD-001 §10 requires it for API contracts and public interface documentation. Every other Horizon document remains German.
Audience. Integration developers at customer sites, implementation partners, and anyone building a client against Horizon. It assumes HTTP and JSON, and nothing about Horizon.
0. Status of this document — read this first
Horizon is under construction. Marketable V1.0 is due 2027-06-30. This guide describes the target contract, not a shipped product. Every section carries one of three markers:
| Marker | Meaning |
|---|---|
SPEC |
Normative. Fixed in HZN-API-001 or an ADR. It will not change without a decision record. |
DRAFT |
Proposed by this document to close an open point. Defensible and internally consistent, but not yet ratified — an ADR must confirm it before anyone builds against it. |
OPEN |
Not decided. Named here so the gap is visible rather than silently filled. |
Nothing in this guide is available at a /v1 path today. The current build
serves a different, internal surface under /api. See
Appendix C — Implementation status for
what exists, what is designed only, and where the two differ. Do not write
integration code against this document until the epic E-005 closes.
The authoritative machine-readable contract, once it exists, is the generated OpenAPI document (§15) — not this prose. Where the two disagree, the OpenAPI document wins.
1. What this API is
Horizon is a metadata-driven CAFM/IWMS platform. Three properties shape every part of the API, and none of them is optional:
1. The API is the product. HZN-CONST-001 §4.3: there may be no function in the user interface that is not reachable through the public API. The Horizon web client is an API consumer with no private channel. If you can do it on screen, you can do it over HTTP — including configuration and customizing, which is what makes automated deployment of tenant configuration possible at all (HZN-ARC-004).
2. The object types are not known in advance. Customers create their own object types and fields (HZN-ARC-001). There is no hand-written endpoint per object type and there never will be. Instead there is one generic resource path with the object type as a path segment, and a metadata endpoint that tells you what object types and fields this tenant has. A client that hardcodes field names is a client that breaks — read §4 before §5.
3. The cost of every request must be boundable. With ten thousand tenants on quota-bearing editions, a query language whose cost the caller chooses freely is an operational hazard. So the query syntax is deliberately limited (§5.2). There are no free-form queries, no subqueries, no joins beyond one level, and no aggregates outside the reporting area. This is a decision, not a gap — HZN-ADR-0009 §D.
A fourth property follows from §2.2 of the constitution and is worth stating as a promise: a third party must be able to build a fully offline-capable client from the published API alone. Section 12 is where that promise is kept.
2. Core concepts
2.1 Tenant SPEC
Every piece of data — business data and metadata — carries a tenant id, and
isolation is enforced at the data access layer, not by WHERE tenantId = ? in
application code (HZN-ADR-0002).
For you this means one thing: there is no request without a tenant context, and you never set it yourself. It is bound to your credential. A request that somehow arrives without one is rejected — fail-closed, no default, no fallback.
Tenants run in one of two operating modes, Pool (shared database) or Silo (dedicated database, for enterprise, regulated and sovereignty cases). This is invisible to the API. Same paths, same payloads, same behaviour. A tenant can move from Pool to Silo without any change to your integration.
2.2 Client — the second tenant level SPEC
Above ordinary record permissions sits the client dimension (Auftraggeber, HZN-ADR-0067): a facility manager operating on behalf of several principals must not leak one principal's data to another. It is derived from the portfolio tree, materialised, and applied before any customer-defined rule. No configuration can override it (HZN-CONST-001 §7.2).
Consequence for integrations: a credential scoped to one client sees a strictly smaller world, and you cannot widen it from the outside.
2.3 Object type and record
An object type is a named entity in a tenant's model — workOrder,
building, asset, or something the customer invented last Tuesday. Its
technical name is what appears in the path:
/v1/data/workOrder
Core object types and customer object types are indistinguishable in the path. That is intentional. Your code should not care.
A record is one instance. Every record — core or custom — carries these system fields (HZN-ARC-006 §3):
| Field | Meaning | Writable |
|---|---|---|
id |
technical identifier, time-ordered and client-generatable | on create only |
number |
readable business number, assigned per object type | no (server) |
version |
optimistic locking; basis of conflict detection | no (server) |
state |
business state from the state model | via actions only |
createdAt / createdBy |
creation | no |
modifiedAt / modifiedBy |
last change | no |
origin |
how it came to be: ui · api · import · workflow · integration · ai |
no |
tenantId |
tenant membership | no |
On id. It is time-ordered (UUID v7 style) and you may assign it
yourself. This is not a convenience — it is what makes offline creation and
safe retries possible (§6.1). The readable number is separate and always
assigned by the server; a record created offline receives its number when it
first reaches the server.
2.4 Permissions — six layers, all of them restricting SPEC
Authorisation is evaluated in a fixed order, deny-by-default, and no layer can loosen an earlier one (HZN-ADR-0008):
1 · Tenant → data access layer
2 · Licence class → hard ceiling
3 · Object rights → read · create · update · delete
4 · Field rights → visible · editable
5 · Record rules → translated into a query predicate
6 · Token scope → this API only (§3.2)
Rights are purely additive: there is no customer-configurable "deny". A user is restricted by not being granted a right. Token scopes (layer 6, §3.2) can only narrow what the underlying service account already has — they can never grant anything (HZN-ADR-0084 §D).
Two consequences you will meet in practice:
404where you expected403. Where the mere existence of a record is itself confidential, the API answers404and not403(HZN-SEC-001 §7, no. 11). Absence of a record is not proof it does not exist.fieldsOmitted. A list or record response names the fields that were dropped for field-rights reasons, so you can tell "empty" from "not visible to you" — without learning the content (§5.4).
2.5 Metadata-driven: read the model, don't assume it
The single most common integration mistake against a platform like this is to hardcode field names taken from one tenant's screen. Field names are per-tenant configuration. Object types are per-tenant configuration. Picklist values are per-tenant configuration, and they get renamed.
Do this instead, once at startup and after every metadata change event:
GET /v1/meta/object-types → what exists here
GET /v1/meta/object-types/{name} → fields, types, filterable, sortable, relationships
Then map your system's concepts onto what you found. §4 covers this in detail. It is also the reason the tenant-specific OpenAPI contract exists (§15) — you can generate a typed client for one tenant's actual model.
3. Getting started
3.1 Base URL and versioning SPEC
https://api.horizon.mavorest.com/v1
The host name is a placeholder — the public domain is not fixed yet (Appendix D, A-6). The
/v1prefix is fixed.
| Rule | |
|---|---|
| Major version in the path | /v1/, /v2/ |
| Additive changes are not breaking | a new optional field, a new endpoint, a new enum value on an output field may appear at any time — your client must tolerate them |
| Breaking changes | new major version; the previous one runs in parallel for at least 12 months |
| A tenant's metadata change is not a version event | when a customer adds a field, their contract changes — the platform version does not |
| Deprecation | announced via response header with an end date, and in the contract |
That last-but-one row is the heart of the versioning strategy. With ten thousand tenants creating fields daily, any other rule would put the platform in permanent version discussion.
3.2 Authentication SPEC
Decided in HZN-ADR-0084 on 2026-08-18, closing open point A-4 of HZN-API-001. This section is the elaboration; where the two differ, the ADR wins.
Two flows, depending on who is acting.
Service-to-service (the normal integration case) — OAuth 2.0 client credentials.
curl -X POST https://api.horizon.mavorest.com/v1/oauth/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials' \
-d 'client_id=hzn_c_7f3a…' \
-d 'client_secret=…' \
-d 'scope=data.read data.write meta.read'
{
"access_token": "eyJhbGciOi…",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "data.read data.write meta.read"
}
Then on every call:
Authorization: Bearer eyJhbGciOi…
On behalf of a person — OAuth 2.0 authorization code with PKCE, against the tenant's own identity provider (OIDC or SAML; local accounts for self-service sign-up). Horizon does not store customer passwords and does not want to.
The point that matters more than the flow: every credential is bound to a service account, and a service account is an ordinary user with ordinary roles. All five permission layers apply to it unchanged. There is no "integration bypass", no system user with implicit full access, no second code path. If your integration cannot see a record, the fix is a role assignment, not an API flag.
Scopes are coarse and only ever restrict the service account further:
| Scope | Grants (at most) |
|---|---|
meta.read |
read the model |
meta.write |
change the model — object types, fields, forms |
data.read |
read records, search, sync |
data.write |
create, update, actions |
files |
upload and download attachments |
reports |
run and fetch reports |
admin |
tenant administration, users, quotas, audit trail |
Rotate secrets. A leaked client secret is a leaked tenant.
3.3 Request headers
| Header | When | Purpose |
|---|---|---|
Authorization: Bearer … |
always | §3.2 |
Accept: application/json |
always | |
Content-Type: application/json |
on write | |
Accept-Language: de-DE |
optional | localises message texts and metadata labels; field labels come from metadata, never from the payload |
Idempotency-Key: <opaque> |
every unsafe call | §6.5 — retained ≥ 24 h |
If-Match: "<version>" |
on PATCH |
optimistic locking, §6.2 |
3.4 Response headers
| Header | Purpose |
|---|---|
RateLimit-Limit / RateLimit-Remaining / RateLimit-Reset |
quota state for the bucket you hit (§14) |
Sunset |
set on deprecated endpoints, with the end date |
Horizon-Trace-Id |
matches error.traceId; quote it in support requests |
3.5 Your first three calls
# 1 — what does this tenant have?
curl -H "Authorization: Bearer $TOKEN" \
https://api.horizon.mavorest.com/v1/meta/object-types
# 2 — what does a work order look like here?
curl -H "Authorization: Bearer $TOKEN" \
https://api.horizon.mavorest.com/v1/meta/object-types/workOrder
# 3 — read fifty of them
curl -H "Authorization: Bearer $TOKEN" \
'https://api.horizon.mavorest.com/v1/data/workOrder?limit=50'
4. Discovering the data model SPEC (paths DRAFT in detail)
The /v1/meta area is a first-class part of the API, not an afterthought —
HZN-CONST-001 §4.3 requires metadata and
customizing to be reachable over the API, otherwise application lifecycle
management could not exist.
This is the one area still marked
DRAFT. Reading the model is settled in substance; what is not decided is how much of writing it belongs here rather than in change packages (HZN-ARC-004) — open point A-7. Treat the read paths below as stable in shape and the write surface as unsettled.
4.1 Object types
GET /v1/meta/object-types
{
"data": [
{ "name": "workOrder", "label": "Auftrag", "namespace": "core", "recordCount": 128443 },
{ "name": "building", "label": "Gebäude", "namespace": "core", "recordCount": 412 },
{ "name": "cleaningRound", "label": "Reinigungsrundgang", "namespace": "customer", "recordCount": 2210 }
]
}
namespace tells you whether a type came from the platform (core), a package,
or the customer (customer). It is informational only — never branch on it
to decide how to call something. The paths are identical.
4.2 Fields of an object type
GET /v1/meta/object-types/workOrder
{
"name": "workOrder",
"label": "Auftrag",
"fields": [
{
"name": "number",
"label": "Nummer",
"type": "AutoNumber",
"system": true,
"readOnly": true,
"filterable": true,
"sortable": true
},
{
"name": "dueDate",
"label": "Fällig am",
"type": "Date",
"required": false,
"filterable": true,
"sortable": true
},
{
"name": "priority",
"label": "Priorität",
"type": "Picklist",
"picklist": "workOrderPriority",
"filterable": true,
"sortable": false
},
{
"name": "estimatedCost",
"label": "Geschätzte Kosten",
"type": "Currency",
"defaultCurrency": "EUR",
"filterable": true
},
{
"name": "asset",
"label": "Anlage",
"type": "Reference",
"relationship": { "target": "asset", "expandable": true },
"filterable": true
}
]
}
Three flags decide what you may do with a field in a query, and ignoring them
produces a 400, not a slow query:
| Flag | Meaning |
|---|---|
filterable |
may appear in filter |
sortable |
may appear in sort |
relationship.expandable |
may appear in expand |
This is the mechanism behind bounded query cost (§1, property 3). A field is filterable because someone declared it so and an index exists — not because it happens to hold text.
The complete list of field types is in Appendix A.
4.3 Picklist values, state model, available actions
GET /v1/meta/picklists/workOrderPriority
GET /v1/meta/object-types/workOrder/state-model
The state model tells you which states exist and which transitions are declared. You usually do not need it: the detail response of a record carries the actions that are permissible for this record and this caller right now (§6.4). Reading that list is more robust than reimplementing the state machine, because it already accounts for permissions, licence class and workflow conditions.
5. Reading data SPEC
5.1 List
GET /v1/data/workOrder
?filter=state in (open,inProgress) and building.id eq {id}
&sort=-dueDate
&fields=number,title,state,dueDate,assignee
&expand=asset
&limit=50
&cursor=<opaque>
| Parameter | Rule |
|---|---|
filter |
only over fields marked filterable; fixed operator set (§5.2) |
sort |
only over sortable fields; - reverses; at most three fields |
fields |
field selection; the default is a defined core set, not everything |
expand |
only declared relationships, at most one level, at most three relationships |
limit |
default 50, maximum 500 |
cursor |
opaque, taken from the previous response |
count |
count=exact requests a total (§5.5) |
5.2 Operator set
eq · ne · lt · le · gt · ge · in · notIn · contains (only on
text fields marked for it) · startsWith · isNull · between (dates and
numbers).
Combine with and / or, parentheses allowed, nesting at most three levels.
Not available, by decision: free-form expressions, subqueries, joins deeper than one level, aggregates. Aggregation belongs to the reporting area (§10).
5.3 Paging is always cursor-based
There is no offset. Jumping to page 500 of two million records cannot be kept
inside a cost budget with offsets, and the same cursor mechanism is what makes
delta sync work (§12). Follow page.nextCursor until hasMore is false, and
treat the cursor as opaque — its internal structure is not part of the contract
and will change.
5.4 Response shape
{
"data": [
{
"id": "018f2c1a-…",
"number": "AU-2026-004711",
"title": "Lüftungsanlage prüfen",
"state": "inProgress",
"dueDate": "2026-09-01",
"estimatedCost": { "amount": "1250.0000", "currency": "EUR" },
"asset": { "id": "018f2b…", "number": "AN-0042", "label": "RLT-3" }
}
],
"page": { "nextCursor": "eyJ0IjoiMjAy…", "hasMore": true },
"meta": { "objectType": "workOrder", "fieldsOmitted": ["actualCost"] }
}
fieldsOmitted names fields dropped because of field rights — so a client can
distinguish empty from not visible, without learning the value.
5.5 Total counts
No total is returned by default. Request it with count=exact. It is subject
to an upper bound, and it never counts records the caller may not see
(HZN-SEC-001 §7, no. 2) — a count is an information
channel like any other.
5.6 Single record
GET /v1/data/workOrder/{id}
The detail response additionally carries the permissible actions (§6.4) and the
current version for use in If-Match.
6. Writing data SPEC
6.1 Create — PUT with a client-generated id
curl -X PUT https://api.horizon.mavorest.com/v1/data/workOrder/018f2c1a-7b3e-7c9d-9f10-2a4b6c8d0e12 \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: erp-sync-2026-08-17-000431' \
-d '{
"title": "Lüftungsanlage prüfen",
"asset": { "id": "018f2b…" },
"dueDate": "2026-09-01",
"priority": "high"
}'
PUT with a client-assigned id is idempotent by construction. A retry after
a dropped connection does not create a second object — it re-addresses the same
one. This is what makes an unreliable network survivable, and it is why the id is
yours to choose (§2.3). Use a time-ordered UUID (v7); random v4 ids destroy index
locality at eight-figure record counts.
POST /v1/data/{objectType} without an id is not offered. There is one way
to create a record, and it is the one that is safe to retry.
6.2 Update — PATCH with If-Match
curl -X PATCH https://api.horizon.mavorest.com/v1/data/workOrder/018f2c1a-… \
-H "Authorization: Bearer $TOKEN" \
-H 'If-Match: "7"' \
-H 'Content-Type: application/json' \
-d '{ "dueDate": "2026-09-15" }'
Send only the fields you are changing. Concurrent modification is detected via
version. On conflict you get 409 together with the server-side state, so
you can merge field by field rather than guess:
{
"error": {
"code": "VERSION_CONFLICT",
"message": "Der Datensatz wurde zwischenzeitlich geändert.",
"traceId": "…"
},
"current": { "id": "018f2c1a-…", "version": 9, "dueDate": "2026-09-08", "…": "…" },
"conflicts": [ { "field": "dueDate", "yours": "2026-09-15", "theirs": "2026-09-08" } ]
}
Omitting If-Match is a 428 Precondition Required, not a silent
last-write-wins.
6.3 Delete
DELETE /v1/data/workOrder/{id}
Whether this is a logical or physical deletion is governed by the tenant's
retention rules (HZN-ADR-0025). Either
way the record is reported as remove on the sync channel (§12).
6.4 State changes are actions, never field writes
POST /v1/data/{objectType}/{id}/actions/{action}
curl -X POST https://api.horizon.mavorest.com/v1/data/workOrder/018f2c1a-…/actions/complete \
-H "Authorization: Bearer $TOKEN" \
-H 'Idempotency-Key: …' \
-d '{ "completionNote": "Filter getauscht", "actualHours": 2.5 }'
A PATCH on a state field is rejected with 422. Transitions are checked
against the state model, run the workflow, and write the audit trail. Bypassing
them would bypass all three.
You do not need to know the state model. The record detail response lists what is allowed right now:
{
"id": "018f2c1a-…",
"state": "inProgress",
"actions": [
{ "name": "complete", "label": "Abschließen", "input": [ { "name": "completionNote", "type": "LongText", "required": true } ] },
{ "name": "cancel", "label": "Stornieren", "input": [ { "name": "reason", "type": "Picklist", "picklist": "cancelReason", "required": true } ] }
]
}
The input schema uses the platform's own field type catalogue
(HZN-ADR-0051 §B) — the same types as in §4.2 and
Appendix A. There is no second schema language to
learn.
6.5 Idempotency
Every unsafe operation accepts Idempotency-Key. The key is retained for at
least 24 hours; a repeat returns the original response, not a second
effect. Generate one key per logical operation, not per HTTP attempt — that is
the whole point.
Built since 2026-10-25 (HZN-ADR-0012 §AZ): every unsafe call accepts the
header; the key is scoped to the signed-in person, kept for 48 hours, and
stored in the same transaction as the effect. A repeat carries
Idempotency-Replayed: true. The same key with a different method, path or
body is 422; an invalid key (not 1–255 printable ASCII characters) is 400;
a body over 1 MB with a key is 413. A request that was refused and rolled
back is not stored — repeating it runs it again.
7. Importing and synchronising data
This is the section most integrations need, and the one where the platform's existing decisions do most of the work. It has three levels; pick the smallest one that fits.
7.1 The primitive that makes imports repeatable: external keys SPEC
HZN-ADR-0024 §E: a separate ExternalReference entity
links one Horizon record to several source systems — object, system id,
external key, last reconciliation. It is not a field on the record, and that
matters: the same building can be BLD-4711 in SAP and L2.033 in the CAD
system without either name entering the business model.
Fremde Datenmodelle dringen nicht in den Kern — a foreign field name appears nowhere in Horizon's model. The mapping between your system and Horizon is metadata (§7.5), not code.
Address a record by its external key instead of its Horizon id (HZN-ADR-0085 §C):
PUT /v1/data/building/byExternalKey/sap/BLD-4711
This is an upsert: it creates the record and the ExternalReference on first
call, and updates the same record on every later call. Run your import a hundred
times and you get one building. That property is what makes
HZN-ADR-0022 possible at all — migration is repeatable
delta transfer during parallel operation, not a big-bang cutover.
What if there is no source system? A spreadsheet has no system id and no stable per-row identifier — and that is exactly the case a customer hits in their first session after signing up. Sending such rows without an external key fails silently: the second run creates everything a second time and reports success.
So Horizon requires one to be invented, visibly. An import plan — a named, versioned record you create like any other — declares a key rule: the column or columns that identify a record at each target level. The plan itself becomes the source system:
PUT /v1/data/room/byExternalKey/import:bestand-2026/GEB-NORD~3~3.14
import:<planKey> is a source system like sap is, so everything above holds
unchanged. A plan without a key rule cannot be started — not a warning and
not a default, a rejection. The tempting substitute, the row number, is refused
for one reason: it fails without a sound. The customer sorts the spreadsheet,
and on the next run every record carries another record's data.
Deciding the mapping and the key rule is where the platform's AI assists — it fills in a form that works just as well without it, and the run itself never sees a model (HZN-ADR-0089).
7.2 Level 1 — ordinary writes
For up to a few thousand records: just loop over §6.1 and §6.2. Each PUT with
a client-side id and an Idempotency-Key is safe to retry, so the loop needs no
transaction and no cleanup. This is not a lesser path — it is the same path the
offline client uses (§12.1).
7.3 Level 2 — the batch endpoint SPEC
Decided in HZN-ADR-0085 §A, §B on 2026-08-18, closing open point A-2 of HZN-API-001 ("bulk operations: dedicated endpoint or collective call?").
For a few hundred operations in one round trip:
POST /v1/data/building/batch
Idempotency-Key: erp-sync-2026-08-17-batch-12
{
"sourceSystem": "sap",
"operations": [
{ "op": "upsert", "externalKey": "BLD-4711", "data": { "name": "Verwaltung Nord", "grossFloorArea": 4210 } },
{ "op": "upsert", "externalKey": "BLD-4712", "data": { "name": "Lager Süd", "grossFloorArea": 980 } },
{ "op": "patch", "id": "018f2b…", "version": 4, "data": { "costCentre": "K-2210" } }
]
}
Response — HTTP 200 with per-item results, partial success is normal:
{
"results": [
{ "index": 0, "status": 200, "id": "018f2b…", "created": false },
{ "index": 1, "status": 201, "id": "018f2c…", "created": true },
{ "index": 2, "status": 409, "error": { "code": "VERSION_CONFLICT", "…": "…" } }
],
"summary": { "total": 3, "succeeded": 2, "failed": 1 }
}
| Rule | |
|---|---|
| Maximum | 500 operations per call (same ceiling as limit) |
| Atomicity | none across items. Each item is evaluated on its own — permissions, licence class, state model, validation rules, workflow. One rejected row does not roll back the others |
| Ordering | items are applied in array order |
| Idempotency | the batch key covers the whole call; a retry returns the original result array |
| Quota | counts as one request against the write bucket per item, not per call |
The deliberate absence of cross-item atomicity is the same reasoning as everywhere else in this platform: a 500-row all-or-nothing transaction against a rule engine either fails as a whole for one bad row, or requires the caller to pre-validate what only the server can validate. Per-item results plus repeatable upserts is the mechanism that actually converges.
7.4 Level 3 — the import job SPEC
Decided in HZN-ADR-0085 §D, §E, §G on 2026-08-18, closing open point A-3 ("long-running operations — import, report, export: return pattern"). §G makes the job pattern the general form for long-running work, not an import speciality.
For file-sized volumes and anything that outlives an HTTP request:
POST /v1/import/jobs
{
"objectType": "asset",
"sourceSystem": "axxerion",
"mapping": "axxerion.asset.v3",
"fileId": "018f30…",
"mode": "upsert",
"dryRun": false
}
{ "id": "018f31…", "status": "queued", "createdAt": "2026-08-17T09:12:44Z" }
Then poll, or subscribe to the import.job.finished event (§11):
GET /v1/import/jobs/018f31…
{
"id": "018f31…",
"status": "finished",
"counts": { "read": 18422, "created": 1204, "updated": 17108, "unchanged": 0, "failed": 110 },
"errorReport": { "fileId": "018f32…", "format": "csv" },
"startedAt": "2026-08-17T09:12:51Z",
"finishedAt": "2026-08-17T09:19:03Z"
}
| Feature | Why it is not optional |
|---|---|
dryRun |
validates everything and writes nothing. During a migration you will run this far more often than the real thing |
| Error report as a downloadable file | 110 failures do not belong in a JSON response; they belong in a file the customer's data owner can open, fix and re-feed |
| Repeatable | driven by external keys (§7.1), so re-running after fixing the report converges instead of duplicating |
origin: import |
every record written this way is marked, and the marking is not writable |
| Forward references | a reference field may be given as {"externalKey": "BLD-4711"} instead of an id; the job resolves it in a second pass, so you need not sort your file by hierarchy depth |
Status values: queued → running → finished | failed | cancelled.
DELETE /v1/import/jobs/{id} cancels a running job; already-written records
stay written, which is safe precisely because the job is repeatable.
7.5 Mapping is metadata, not code SPEC
Per integration there is a mapping: field assignment, picklist value translation, transformation via declarative expressions, key assignment. It is a metadata document (HZN-ADR-0016) — versionable, deployable, visible in the dependency graph. Customers and partners adjust mappings without anyone changing code.
The mapping field in §7.4 names one. You can also send already-mapped payloads
and omit it.
7.6 Two-way synchronisation requires a declared leading system SPEC
HZN-ADR-0024 §C:
| Pattern | Allowed |
|---|---|
| One-way, leading system outside (Horizon reads) | ✔ |
| One-way, Horizon leading (Horizon writes outward) | ✔ |
| Two-way, leading system declared per field | ✔ |
| Two-way without declared leadership | ✘ |
The last row is not a policy preference. Two-way sync without clear leadership is the single most common cause of loops, data loss and unreconstructable state. The model refuses to express it.
Also from ADR-0024: no direct database access, ever. It would bypass all five permission layers, and the schema is not a contract.
7.7 A worked example — nightly asset sync from an ERP
1. POST /v1/oauth/token → bearer token
2. GET /v1/meta/object-types/asset → confirm the field set hasn't drifted
3. For each page of your ERP delta:
POST /v1/data/asset/batch → 500 upserts keyed by externalKey
inspect results[]; collect failures
4. Failures → your own retry queue, not a rerun of the whole night
5. Once a month, or after a schema change:
POST /v1/import/jobs with dryRun=true → full reconciliation, no writes
Step 2 is the one people skip and then regret. A customer adding a required field is a normal Tuesday, and your integration should notice it on the metadata call rather than in 18,000 validation errors.
8. Files and attachments SPEC
Attachments are transferred separately from the record, resumably, and never embedded. Base64 payloads inside a record write are rejected. The reason is concrete: photos from the field are the main use case, and pushing them through a record operation over a bad mobile network makes that operation unreliable.
1. POST /v1/files → register the transfer, receive target + id
2. … → chunked upload, resumable
3. POST /v1/files/{id}/complete → finalise; virus scan starts
4. PATCH /v1/data/{objectType}/{id} → link the file via the record's file field
The scan has three verdicts, not two (HZN-ADR-0064):
clean, infected, and unknown. A file is delivered only in state available.
Between complete and available there is a window in which a download returns
409 FILE_NOT_RELEASED — that is the quarantine working, not an error in your
code. An infected file has its bytes deleted immediately and moves to rejected.
GET /v1/files/{id} → metadata and state
GET /v1/files/{id}/content → the bytes, only in state `available`
9. Search SPEC
GET /v1/search?q=Lüftung&objectTypes=workOrder,asset&limit=20
Cross-object-type search, cursor-paged like everything else, and filtered by the caller's rights at query time — the index is not pre-filtered per user (HZN-ADR-0008, no. 5). Search has its own quota bucket (§14).
For anything structured, use §5.1. Search is for humans typing words.
10. Reports SPEC
POST /v1/reports/{name}/runs → start a run
GET /v1/reports/runs/{id} → status and result location
Aggregation lives here and nowhere else — this is the counterpart to the deliberately aggregate-free query syntax (§5.2). Long-running runs follow the same job pattern as §7.4.
11. Events and webhooks SPEC
Described by AsyncAPI 3.0 in asyncapi.json, next to this
guide. That file is generated from the code that sends the events
(OutboundEventContract); a test fails the build when the two drift apart
(HZN-ADR-0090 §F). Built in
HZN-ADR-0269; subscriptions are managed under
Access → Outbound events, not yet over /v1.
| Rule | |
|---|---|
| Event types | record.created · record.changed · record.stateChanged · record.commented · record.deactivated · record.approvalDecided |
| Delivery | POST to your https URL, at least once — deduplicate on id |
| Order | events for the same record never overtake each other |
| Signature | Horizon-Signature: t=<seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>">; reject events older than five minutes |
| Payload | what happened, never the values: type, object type, record id and number, state codes before and after, names of changed fields, and href to fetch the record with your API key — so it is filtered by your rights (HZN-SEC-001 §7, no. 10) |
| Retry | after 1, 5, 15 and 60 minutes, then hourly; given up after three days. 410 Gone stops retries for that delivery |
| Replay | missed events are re-readable over a defined window (length: OPEN, A-5) |
{
"id": "evt-…",
"type": "record.stateChanged",
"occurredAt": "2026-11-01T08:59:00Z",
"objectType": "Ticket",
"record": { "id": 48213, "number": "T-2026-00042" },
"state": { "from": "neu", "to": "zugewiesen" },
"changedFields": ["status", "assignee"],
"href": "https://…/api/record?type=Ticket&id=48213"
}
Events are the outbound half of an integration; §7 is the inbound half (HZN-ADR-0024 §D).
12. Offline synchronisation SPEC
This is the endpoint that decides whether the promise in §1 holds.
GET /v1/sync/task?since=<cursor>&limit=500
{
"changes": [
{ "op": "upsert", "id": "018f…", "data": { "…": "…" } },
{ "op": "remove", "id": "018f…", "reason": "deleted" },
{ "op": "remove", "id": "018f…", "reason": "outOfScope" }
],
"page": { "nextCursor": "…", "hasMore": true }
}
| # | Guarantee |
|---|---|
| 1 | Stable ordering. A cursor denotes an unambiguous point; concurrent changes cannot open a gap |
| 2 | Tombstones. Deleted records are reported as remove, never merely omitted |
| 3 | Loss of visibility. If a rights change moves a record out of your view, you get remove with reason: outOfScope — without content |
| 4 | Resumable. An abort mid-run loses nothing; re-use the last cursor |
| 5 | Constant cost per page |
| 6 | Attachments are not included — references only; transfer via §8 |
| 7 | The sync endpoint is read-only |
12.1 The way back — there is no upload endpoint
HZN-ADR-0011. The client keeps an ordered queue of
ordinary write calls — PUT with a client id, PATCH with If-Match,
POST …/actions/{action}, each with an Idempotency-Key — and replays it in
creation order when connectivity returns.
Because writing is already idempotent, action-based and client-keyed (§6), the regular API is the offline protocol. A third party has nothing extra to learn.
- Rejections are re-evaluated as if fresh — permissions, licence class, state model, validation rules, workflow — and return the standard error schema with a stable, localisable reason. Put them in a conflict basket and show them to the user.
- Partial success on
PATCH: the server merges field by field. Fields untouched on the server are applied; fields changed on both sides are reported individually as conflicts. A work order does not fail because someone in the office corrected a different field. - Ordering: if an operation fails, dependent operations are held back; independent ones keep replaying.
13. Errors SPEC
One schema for the whole platform:
{
"error": {
"code": "FIELD_VALIDATION_FAILED",
"message": "Wartungsintervall überschreitet den zulässigen Wert.",
"target": "maintenanceIntervalDays",
"traceId": "018f33a1-…",
"details": [
{ "code": "VALUE_TOO_LARGE", "target": "maintenanceIntervalDays", "message": "…" }
]
}
}
| Field | Rule |
|---|---|
code |
stable, machine-readable, versioned with the API. Branch on this. |
message |
for humans, localised via Accept-Language. Never parse it. |
target |
the field or parameter at fault |
traceId |
ties to the server-side log; quote it in support requests |
details |
per-field breakdown where one call fails for several reasons |
| Status | When |
|---|---|
400 |
malformed request, unknown filter field, operator not permitted on that field |
401 |
missing or expired token |
403 |
authenticated, not permitted — and existence is not confidential |
404 |
not found, or existence is confidential (HZN-SEC-001 §7, no. 11) |
409 |
version conflict (§6.2), or file not yet released (§8) |
422 |
request understood but not permissible here — e.g. PATCH on a state field |
428 |
If-Match missing on a PATCH |
429 |
quota exhausted; includes the reset time (§14) |
5xx |
our fault; retry with backoff, keep the Idempotency-Key |
A reached tenant limit produces a comprehensible error, never a silent truncation.
Common codes are listed in Appendix B; the authoritative catalogue ships with the OpenAPI document.
14. Quotas and rate limits SPEC
Per tenant and per edition, exposed in response headers: remaining requests, reset time, current limit.
Separate buckets for read, write, search, reports, AI and file transfer — otherwise a nightly report run starves interactive use. Design your integration to run against the write bucket at night and to leave the read bucket alone during business hours.
On 429, back off until the announced reset. Do not retry tighter; the limit is
per tenant, and your retry storm hurts the customer's own users.
15. Machine-readable contracts SPEC
| Document | Path |
|---|---|
| Core contract | GET /v1/openapi.json — endpoints, patterns, error schema, paging, sync; without tenant-specific types |
| Tenant contract | GET /v1/openapi.json?tenant=current — the same, extended with this tenant's object types and fields, generated from metadata |
| Event contract | asyncapi.json, generated; later also at GET /v1/asyncapi.json |
The contract is generated, not written (HZN-ADR-0009 §B). The tenant contract is what an integration partner actually works with: real field names, real types, real picklists — without anyone at mavorest writing a line per customer. Generate your client from it, and regenerate when you receive a metadata-change event.
The tenant contract is cached and invalidated on metadata change. A customer adding a field changes their contract, not our API version (§3.1).
16. Conventions that hold everywhere SPEC
- Contract before implementation. No endpoint without a reviewed contract.
- No internal back door. What our own UI uses, everyone uses.
- Everything is paged. No endpoint returns without a bound.
- Everything is tenant-scoped. No endpoint without tenant context.
- Everything is auditable. Writes to protected data are logged.
- Times in UTC, ISO-8601 formatted; time zone transmitted separately.
- Amounts and quantities always carry their unit or currency. A
Currencyvalue is{ "amount": "…", "currency": "EUR" }— an ISO 4217 code. The server does not format and does not round to the currency's decimals; it stores atnumeric(18,4)and hands the raw value out. Rounding happens at display time, in your client (HZN-ADR-0079). - Language via header. Field labels come from metadata, not from the payload.
Appendix A — Field types
The platform's field type catalogue, as implemented in
MetadataCatalog.DataType. Action input schemas use the same catalogue
(HZN-ADR-0051 §B).
| Type | JSON representation | Notes |
|---|---|---|
Text |
string | |
LongText |
string | multi-line |
RichText |
string | Markdown, never HTML |
Email |
string | validated |
Phone |
string | validated |
URL |
string | |
Barcode |
string | |
Number |
number | displayed rounded to two decimals |
Decimal |
number | displayed as stored |
Percent |
number | 12.5 means 12.5 % — no hard bounds; utilisation and overrun legitimately exceed 100 % |
Currency |
{ "amount": string, "currency": string } |
ISO 4217; see §16.7 |
AutoNumber |
string | server-assigned, read-only |
Boolean |
boolean | |
Date |
string YYYY-MM-DD |
|
DateTime |
string, ISO-8601 UTC | |
Time |
string HH:MM:SS |
|
Duration |
number | |
Picklist |
string | the value key, not the label — resolve labels via §4.3 |
MultiPicklist |
array of string | |
Reference |
{ "id": …, "number": …, "label": … } |
on write, { "id": … } or { "externalKey": … } |
MultiReference |
array of reference | |
File / Image |
{ "fileId": … } |
transfer via §8 |
GeoPoint |
{ "lat": …, "lon": … } |
|
JSON |
object | opaque to the platform |
Formula |
depends on result type | read-only |
On Picklist. Always send and read the value key. Labels are localised and
customer-editable; keys are not.
Appendix B — Error codes
Indicative, not exhaustive. The authoritative list ships with the OpenAPI document (§15).
| Code | Status | Meaning |
|---|---|---|
UNAUTHENTICATED |
401 | token missing, malformed or expired |
INSUFFICIENT_SCOPE |
403 | the token's scope excludes this operation |
PERMISSION_DENIED |
403 | the service account lacks the right |
NOT_FOUND |
404 | absent — or existence is confidential |
UNKNOWN_OBJECT_TYPE |
404 | no such object type in this tenant |
UNKNOWN_FIELD |
400 | no such field on this object type |
FIELD_NOT_FILTERABLE |
400 | field is not marked filterable |
FIELD_NOT_SORTABLE |
400 | field is not marked sortable |
RELATIONSHIP_NOT_EXPANDABLE |
400 | relationship not declared expandable |
QUERY_TOO_COMPLEX |
400 | nesting or expand limits exceeded |
FIELD_VALIDATION_FAILED |
422 | a validation rule rejected the value |
STATE_FIELD_NOT_WRITABLE |
422 | PATCH on a state field — use an action |
TRANSITION_NOT_ALLOWED |
422 | the action is not permissible in this state |
VERSION_CONFLICT |
409 | If-Match did not match; server state included |
PRECONDITION_REQUIRED |
428 | If-Match missing |
FILE_NOT_RELEASED |
409 | still in quarantine (§8) |
FILE_REJECTED |
422 | virus scan verdict infected |
EXTERNAL_KEY_AMBIGUOUS |
409 | the external key maps to more than one record |
LEADING_SYSTEM_VIOLATION |
422 | write to a field led by another system (§7.6) |
QUOTA_EXCEEDED |
429 | bucket exhausted; reset time in the headers |
TENANT_LIMIT_REACHED |
422 | an edition limit was reached |
Appendix C — Implementation status
As read from the source on 2026-08-17, not copied from a plan.
The running server registers 35 routes, of which 28 sit under /api
(HorizonServer.java). They serve the Horizon web client. GET, POST, PATCH
and DELETE all occur; PUT does not appear at all.
| This document | Today's build |
|---|---|
/v1/data/{objectType} |
/api/list, /api/record |
/v1/meta/object-types |
/api/object-types, /api/model, /api/fields |
/v1/meta/picklists/{name} |
/api/picklist-values |
/v1/meta/…/state-model |
/api/state-model, /api/state |
/v1/data/{t}/batch |
/api/bulk-update (different semantics) |
/v1/search |
/api/search, /api/suggestions, /api/duplicates |
/v1/files |
/api/files |
| — (activity timeline) | /api/activity, /api/activity/comment (since 2026-10-02, HZN-ADR-0205 §H) |
/v1/admin/users |
/api/users, /api/permissions, /api/invitations |
/v1/oauth/token |
— (/login, /auth/callback, browser session) |
/v1/sync/{objectType} |
— |
/v1/import/jobs |
— |
/v1/reports |
— |
/v1/openapi.json |
— |
The string /v1 occurs nowhere in the source. That is not a defect: the
roadmap (HZN-RM-002) lists E-005 API as partially complete
— "23 HTTP paths, lists, records, bulk update, search, activities" delivered,
with "query syntax, delta sync, idempotency, generated tenant contract"
outstanding. This document describes the far side of that gap.
What already matches the target, and is worth knowing:
Access tokens write only with the capability
api.write(since 2026-10-02,HZN-ADR-0205§H). Without it, a token may useGET,HEAD,OPTIONSand the readingPOSTroutes/mcpand/api/list; every other call is refused with 403. Checked in one place for every route (HorizonServer.tokenMayProceed), so a new route is closed until it is listed. Browser sessions are not affected.The operator set in
Expression.Operatoris exactly the twelve operators of §5.2 —eq,ne,lt,le,gt,ge,in,notIn,contains,startsWith,isNull,between.The field type catalogue in Appendix A is the shipped
DataTypeenum, not an aspiration.ApiContractTestalready holds the Java payload keys and the client'sweb/src/api.tsinterfaces to the same names — a name check, not a schema check. Its own class comment says the real contract begins with the generated OpenAPI document.
Appendix D — Open points
Inherited from HZN-API-001 §11 and extended here.
| ID | Point | Status |
|---|---|---|
| A-1 | Cursor construction and behaviour under concurrent change | open — with ADR-0011 |
| A-2 | Bulk operations: dedicated endpoint or collective call? | closed — HZN-ADR-0085 §A, §B · §7.3 |
| A-3 | Long-running operations (import, report, export): return pattern | closed — HZN-ADR-0085 §G · §7.4 |
| A-4 | Access method for integrations: keys, client credentials, lifetime | closed — HZN-ADR-0084 · §3.2 |
| A-5 | Replay window for events | open — with ADR-0010 |
| A-6 | Public API host name and certificate strategy | open — new here |
| A-7 | /v1/meta write surface: which parts of customizing are API-writable in V1.0, and which only via change packages (ALM) |
open — new here |
| A-8 | Whether the batch endpoint (§7.3) and the import job (§7.4) should share one representation rather than two | closed — HZN-ADR-0085 §F: one operation representation, two ways to hand it over |
| A-9 | Does a service account count against an edition's licensed users? | open — Product Owner, ADR-0084 §E |
| A-10 | Import without a source system: where does the external key come from? | closed — HZN-ADR-0089 §C: the plan is the source system, import:<planKey> · §7.1 |
Related documents
- HZN-API-001 — the binding conventions this guide explains
- HZN-API-003 — task-shaped recipes built on this reference
- HZN-ADR-0084 — §3.2 · HZN-ADR-0085 — §7
- HZN-ADR-0089 — §7.1, der Fall ohne Quellsystem
- HZN-ADR-0009 · HZN-ADR-0024 · HZN-ADR-0022
- HZN-ADR-0002 · HZN-ADR-0008 · HZN-SEC-001 §7
- HZN-ARC-006 §3, §11 · HZN-ARC-001
- HZN-CONST-001 §2.2, §4.3, §4.5, §9.3
- HZN-RM-002 — what is actually built, epic
E-005
Project Horizon · mavorest GmbH