Backend Quickstart
Section titled “Backend Quickstart”In the next fifteen minutes you will make your first authenticated call against a OSOS tenant and leave with the four habits every client needs: sending a credential, unwrapping the response envelope, branching on a real error, and paging a listing safely. Everything runs with plain curl; every response body shown is the enveloped shape the wire actually carries.
Six steps: get a token → make one authenticated read → parse the envelope → handle one error → paginate → create an entry.
What you need
Section titled “What you need”- A tenant you can reach, for example
https://acme.example.com. The host itself names the tenant — the gateway resolves the space from the request’sHostheader — so no tenant parameter appears anywhere below. - An application user and its API token, which a tenant administrator creates for you (step 1).
- An entity with a few entries the token may read (and, for step 6, create in). The examples use
employees; substitute the id or the normalized name of any entity in your space — the path accepts either. curl, and optionallyjq.
Set two variables and the rest of the page is copy-paste:
export BASE="https://acme.example.com"export TOKEN="<your API token>"Step 1 — Get a token
Section titled “Step 1 — Get a token”An API token belongs to an application user — a user of type Application. A tenant administrator creates one in Administration › Organization › Users (see Adding an application user), and the platform emails the new token to the administrator who created it. It is stored only in hashed form: it is never shown on screen and cannot be read back, so if it is lost, a system administrator regenerates it (Regenerate Token). Rotation and revocation are covered in Token lifecycle.
What you just created is not a free-floating secret. The token is bound to a dedicated application user, and every request made with it runs as that user — its reach is exactly that user’s roles and space membership, because the token itself carries no scopes. Before continuing, make sure the application user may list your chosen entity’s entries, which this quickstart reads straight from the entity. That needs Edit on the entity or its module: View shows the entity’s design, not its records, and the list then comes back empty. Edit also covers creating entries, for step 6. An administrator grants that like any other access: see Give a group access to a module or data entity. For a real integration that only reads, prefer a view shared with the application user and read through it (/api/v1/v/{viewId}/…, see Calling the HTTP API): that needs access to the view only, not Edit on the entity. If an app token’s fixed identity is the wrong shape for your integration — say, you act on behalf of interactive users — see Choosing a credential.
Step 2 — Make an authenticated read
Section titled “Step 2 — Make an authenticated read”List two entries. The token travels in the x-app-token header; the filter travels as a JSON object in the filterCriteria query parameter, which is why -G --data-urlencode is used:
curl -sG "$BASE/api/v2/entities/employees/entries" \ -H "x-app-token: $TOKEN" \ --data-urlencode 'filterCriteria={"limit":2}'This is the v2 entries listing. A 200 comes back with the entries under result:
{ "success": true, "result": [ { "id": "665f1c0d2e9a4b3a9c1d0e2f", "dataEntity": "664ade91b2f7a2418c0c11aa", "specificationVersion": 1, "entityVersion": 4, "state": 1, "value": { "full_name": "Layla Hassan", "department": "HR" }, "creationInfo": { "doneAt": "2026-05-02T09:14:33.201Z", "doneBy": { "dataEntity": "…", "dataEntry": "…" } } // … further entry metadata trimmed }, { /* second entry */ } ]}Each element is a data entry: your business fields sit under value, keyed by each field’s normalized name, and the platform’s metadata (entity reference, versions, state, audit info) sits around it.
One behaviour to know now, because it looks like success: if result is [], either the entity has no entries or the token’s application user is not allowed to list them — for a plain (non-view-scoped) read the server returns an empty list rather than an error when list permission is missing, and listing needs Edit — View is not enough. An empty first read is a prompt to check the application user’s access, not proof the data is absent.
Step 3 — Parse the envelope
Section titled “Step 3 — Parse the envelope”Every JSON response from the API is wrapped in the same envelope — {"success": …, "result": …} — with no version condition, with one exception Since 1.10: a GET on a /v3/ route is raw again (details). This quickstart reads through v2, so the payload is always under result, and result is null when an operation has nothing to return. The only responses that arrive unwrapped are the ones that are not JSON API results at all: file downloads and streams, which write to the response themselves, and the OpenAPI document. The full contract lives in Calling the HTTP API.
So a client unwraps once, at the transport layer, and everything above it works with plain payloads:
curl -sG "$BASE/api/v2/entities/employees/entries" \ -H "x-app-token: $TOKEN" \ --data-urlencode 'filterCriteria={"limit":2}' \| jq -r '.result[].value.full_name'Layla HassanOmar HaddadIf you generate a typed client from the OpenAPI documents, the same rule applies — the per-operation schemas describe the result payload, and Generating a client shows where the unwrapping belongs.
Step 4 — Handle one error
Section titled “Step 4 — Handle one error”Ask for an entity that does not exist (-i prints the status line):
curl -siG "$BASE/api/v2/entities/no-such-entity/entries" \ -H "x-app-token: $TOKEN"The status is 404, and the body is the platform’s single error shape:
{ "success": false, "result": { // remnants of the server-side exception — do not build on this field "errorCode": "ENTITY_NOT_EXIST", "errorMessage": "The data entity 'no-such-entity' does not exist", "service": "data-service", "retryable": false, "requestCode": 404 }, "error": { "code": "ENTITY_NOT_EXIST", "message": { "en": "The entity does not exist", "ar": "الكيان غير موجود" }, "traceId": "8c2f5e0d-…" }}Four rules, in the order they matter:
- Branch on
error.code. It is a stable machine string, raised here by a typed not-found exception.error.messageis localized display text and may change; never match on it. - Trust the HTTP status for coarse handling. The platform’s typed exceptions carry their status with them — validation
400, unauthorized401, forbidden403, not-found404, conflict409. The full code catalogue, with retryability per code, is in Errors and retries. - Log
error.traceId. It is the request’s correlation id; quoting it lets a problem be traced end to end through the platform’s logs. - Ignore
resulton failure. It is notnull— the response factory currently leaves remnants of the internal exception object there. Treat"success": falsepluserroras the failure signal and read nothing else.
Step 5 — Paginate
Section titled “Step 5 — Paginate”Count first — count is its own operation, separate from list:
curl -sG "$BASE/api/v2/entities/employees/entries/count" \ -H "x-app-token: $TOKEN"{ "success": true, "result": { "count": 137 } }Then page with limit and skip inside the same filterCriteria object, always with an explicit order:
total=$(curl -sG "$BASE/api/v2/entities/employees/entries/count" \ -H "x-app-token: $TOKEN" | jq '.result.count')
for ((skip = 0; skip < total; skip += 50)); do curl -sG "$BASE/api/v2/entities/employees/entries" \ -H "x-app-token: $TOKEN" \ --data-urlencode "filterCriteria={\"limit\":50,\"skip\":$skip,\"order\":[\"creationInfo.doneAt ASC\"]}" \ | jq '.result[].value'doneFour facts to design around, all set by the filter schema:
- Paging is offset-based —
limitplusskip(or its aliasoffset); there are no cursors. A set that changes while you page can shift rows between pages, so always sort on a stable key, as the creation timestamp does above. - The server does not cap
limit. The schema requires onlylimit >= 1, so nothing protects you from requesting a million rows — choose your own page size and keep it. ordertakes"<field> ASC|DESC", as a string or an array, exactly as in the examples above.- The count you fetched can drift while you page. Treat it as a progress estimate, not a contract.
Step 6 — Create an entry
Section titled “Step 6 — Create an entry”Writes take a JSON body. Send the new entry’s business fields under value, keyed by each field’s normalized name:
curl -s -X POST "$BASE/api/v1/entities/employees/entries" \ -H "x-app-token: $TOKEN" \ -H "Content-Type: application/json" \ -d '{"value": {"full_name": "Sara Nasser", "department": "Finance"}}'The created entry comes back under result, with its new id and the same metadata you saw in step 2:
{ "success": true, "result": { "id": "6660a1b2c3d4e5f6a7b8c9d0", "dataEntity": "664ade91b2f7a2418c0c11aa", "state": 1, "value": { "full_name": "Sara Nasser", "department": "Finance" } // … further entry metadata trimmed }}If a field fails the entity’s rules — a required field left out, say — the answer is a 400 whose error.code is ENTRY_VALIDATION_ERROR (or ALL_ENTRY_VALIDATION_ERROR, with one item per failing field) and whose details name the field; branch on it exactly as in step 4. Updates, JSON Patch, batch creates and the per-row results of bulk writes are in Writing data.
Where to go next
Section titled “Where to go next”- Reading data — the
criteriaexpression tree insidefilterCriteria, projection withfields, validating a filter before saving it, quick filters and tag filters. - Writing data — creates, updates, and bulk operations with per-row results.
- Errors and retries — the full
error.codecatalogue and a written retry/backoff policy. - Choosing a credential and Token lifecycle — when an app token is the wrong shape, and how to rotate without downtime.
- Calling the HTTP API — the conventions this page leaned on: routing, versioning, the envelope, the two filter dialects.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27