Skip to content

REST API Reference ​

LatticeDX exposes two complementary HTTP surfaces behind the shared edge perimeter (Caddy TLS and Apache APISIX): the NocoBase host resource API at /api/<resource>:<action> enforced by latticeNativeScope and PostgreSQL 16 FORCE ROW LEVEL SECURITY, and the companion Fastify Core API at /v1/* (:4000) serving workflows, files, entities, and operational endpoints.

Authentication Headers and Gateway Routing ​

All inbound requests to /api/* and /v1/* traverse Apache APISIX (:9080 internal, :8080 local), which injects X-Request-Id globally and applies Redis-backed limit-count rate limits.

Standard HTTP Headers
ParameterTypeDefaultDescription
Authorization
string—Bearer JWT from NocoBase/Keycloak OIDC or scoped personal access token formatted as Bearer ldx_pat_*.
X-Lattice-API-Key
string—Scoped PaaS personal access token (ldx_pat_<8hex>_<32hex>) accepted as an alternative to Authorization Bearer.
X-Role
string—Requested role for multi-role sessions. When authenticating with ldx_pat_*, middleware clamps X-Role to the key bound role.
X-Authenticator
string—NocoBase authenticator identifier (default basic or lattice-keycloak).
X-Lattice-Edge-Token
string—Edge device ingestion token for public IIoT ingestion actions such as telemetryIngest and deviceStatusIngest.
If-Match / X-Expected-Version
string—Optimistic concurrency token when updating vouchers or assets (positive integer).
Idempotency-Key
string—Replay-safe deduplication header on Fastify /v1/* creation routes.
traceparent
string—W3C Trace Context header propagated through to the OpenTelemetry Collector.

APISIX enforces four limit-count tiers keyed by remote_addr over a 60-second window:

APISIX Route TierRepresentative PathsLimit (req/60s)Notes
dxos-telemetry-ingest/api/dxosBlocks:telemetryIngest, /api/dxosBlocks:alarmIngest, /api/dxosBroker:deviceStatusIngest, /api/dxosBroker:orionNotify300High-throughput ingestion for edge sensors and Orion-LD
dxos-core-api/api/*240Default ceiling for CRUD and domain resource actions
dxos-public-paas/api/dxos:openapi, /api/dxos:asyncapi, /api/dxosForms:*, /api/dxosWms:publicTrack, /.well-known/agent-card.json120Protects unauthenticated discovery and public tracking portals
dxos-enterprise-auth & dxos-mcp/api/enterpriseAuth:*, /api/dxos-oidc/*, /api/dxos-mcp/*120Configured with 600s read/send timeouts for MCP streaming

URL Conventions, Envelopes, and Pagination ​

NocoBase Surface (/api/<resource>:<action>) ​

Resources registered through NocoBase resourceManager.define separate resource name and action with a colon, such as /api/dxosWms:issueStock or /api/latticeOrders:list?page=1&pageSize=20.

GET/api/latticeOrders:list?page=1&pageSize=20&sort=-id
Bearer JWT | X-Lattice-API-Keyread
Lists orders automatically scoped to the caller organizationId and enforced by PostgreSQL FORCE RLS.
POST/api/dxosWms:issueStock
Bearer JWT | X-Lattice-API-Keywrite | wms
Issues FEFO stock lots against order lines inside a tenant-scoped RLS transaction.

Responses follow two envelope modes:

  1. Standard Data Wrapping (dataWrapping): Returns { "data": <payload>, "meta": { "count": <n>, "page": <n>, "pageSize": <n>, "totalPage": <n> } } for paginated queries, or { "data": <object> } for single-record operations.
  2. Raw Response (ctx.withoutDataWrapping = true): Emits raw JSON or plain text without a data wrapper. Used by /api/dxActions:*, /api/dxos:metrics (Prometheus text), /api/dxos:openapi, /api/dxos:asyncapi, /api/dxos-mcp, /api/dxos-mcp/it-ot, /api/dxos-a2a, and /.well-known/agent-card.json.

Pagination Bounds and Safe Filtering (latticeNativeScope) ​

The createNativeScopeMiddleware guard validates every query parameter before Sequelize executes SQL:

NocoBase Query Parameters
ParameterTypeDefaultDescription
page
integer1Page index bounded to 1..100000.
pageSize / limit
integer20Records per page, clamped to 1..200 (dxosApiKeys:list defaults to 50).
sort
string | string[]—Sort fields (prefix - for descending). Rejects dotted paths and sensitive field names.
filter
object | json—Sequelize filter object ($eq, $in, $and, $or, $startsWith). Automatically intersected with { organizationId: actor.organizationId }.
expectedVersion
integer—Supplied via body values.expectedVersion, query string, or If-Match header. Returns 409 VERSION_CONFLICT on mismatch.

Security guards fail closed on invalid query shapes:

Security GuardValidation Rule & Error Code
Relation expansion and raw operator blocks (NATIVE_RELATION_EXPANSION_UNSUPPORTED)Rejects appends, targetCollection, dotted fields/sort entries (except self-actor mapping for requester.userId and assignee.userId), raw SQL keys ($where, $raw, $sql), prototype-pollution keys (__proto__, constructor, prototype), and sensitive column patterns (password, secret, token, apikey, privateKey, hash, salt).
Private collection guardsNon-root callers cannot access latticeApiKeys, latticePkiKeys, latticeCryptoLedger, latticeConnectors, latticeWebhookSubscriptions, latticeTelemetryPoints, latticeTwinShadows, latticeIotDevices, latticeBrokerSubscriptions, latticeFrozenSnapshots, latticeDataLineage, latticeDataQuarantine, or latticeOrganizations via generic collection REST (403 PAAS_PRIVATE_COLLECTION_FORBIDDEN). Callers must invoke the dedicated domain resources (dxosApiKeys, dxosLedger, dxosVault, dxosEvents, dxosBlocks, dxosBroker, dxosDataGov, dxosBuilder).
Voucher immutability (VOUCHER_IMMUTABLE)On latticeRequests and latticeOrders, updates to records in submitted, approved, completed, or cancelled status fail with 409, and destroy is blocked (NATIVE_DOCUMENT_DELETE_UNSUPPORTED). Revisions use latticeVoucher:cancel followed by latticeVoucher:amend.

Catalog of 31 NocoBase Resources (resourceManager.define) ​

All domain endpoints are registered across the 7 official Apache-2.0 plugins under plugins/nocobase/:

#ResourceOwning PluginPrimary Actions
1dxos@latticedx/plugin-lattice-foundationhealth, metrics, openapi, asyncapi, manifest, sw.js, icon-192.png, icon-512.png
2dxosApiKeys@latticedx/plugin-lattice-foundationissue, list, revoke
3dxosLedger@latticedx/plugin-lattice-foundationpublicKey, entries, status, verify, signDocument, verifySignature, rotateKey, exportProof
4dxosDataGov@latticedx/plugin-lattice-foundationtierSummary, freezeSnapshot, listSnapshots, lineage, listQuarantine, resolveQuarantine, computeMkt
5dxosVault@latticedx/plugin-lattice-foundationlist, save, rotateSecret, delete, testConnection
6dxosEvents@latticedx/plugin-lattice-foundationlistEvents, publish, listSubscriptions, saveSubscription, toggleSubscription, deleteSubscription, listDeliveries, dispatchNow, replayDlq, resetCircuit
7dxosApprovals@latticedx/plugin-lattice-foundationlistInbox, decide, request, cancel, listPolicies, savePolicy, deletePolicy, evaluateSlaNow
8dxosNotify@latticedx/plugin-lattice-foundationsend, testSend, logs, channels
9dxosForms@latticedx/plugin-lattice-foundationmeta, submit, status, list, get, save, delete, rotateToken
10latticeNative@latticedx/plugin-lattice-foundationcontext
11latticeApps@latticedx/plugin-lattice-foundationlist, get
12latticePortals@latticedx/plugin-lattice-foundationlist, save, compose
13latticeChatter@latticedx/plugin-lattice-foundationlist, post
14latticeVoucher@latticedx/plugin-lattice-foundationsubmit, cancel, amend, lineage
15latticeNotifications@latticedx/plugin-lattice-foundationlistMine, unreadCount, markRead, markAllRead
16latticeSla@latticedx/plugin-lattice-foundationsummary, policies, savePolicy, evaluateNow
17latticeContextSync@latticedx/plugin-lattice-foundationdispatch, status, retry
18latticeIntegrations@latticedx/plugin-lattice-foundationreceive, receiveAlert, propose, proposalReceipt, record, context, proposals
19latticePara@latticedx/plugin-dxos-parasummary, hybridSearch, extractAttachment, reindex
20dxosBlocks@latticedx/plugin-dxos-blocksproposals, decideProposal, contextTelemetry, telemetrySeries, telemetryIngest, alarmIngest, alarmAck, alarmClear, exportReport, globalSearch, twinShadow, twinSetDesired, twinAckCommand, bulkImportDryRun, bulkImportCommit, collectionsMeta, aggregateQuery
21dxosBroker@latticedx/plugin-dxos-blockslistDevices, provisionDevice, revokeDevice, deviceStatusIngest, orionEntities, orionListSubscriptions, orionCreateSubscription, orionToggleSubscription, orionDeleteSubscription, orionNotify
22dxosStudio@latticedx/plugin-dxos-studiolistTemplates, listEmployees, installWorkflow, composePortals, pluginStatus, readiness, outboxDlqList, outboxDlqReplay, solutionBundleExport, solutionBundleDiff, solutionBundleImport, solutionBundleRollback
23dxosWms@latticedx/plugin-dxos-studiostockSummary, receiveStock, issueStock, epodCapture, publicTrack, verifyTrackSignature
24dxosDmn@latticedx/plugin-dxos-studiolistTables, saveTable, evaluate, delegations, saveDelegation
25dxosDelegations@latticedx/plugin-dxos-studiolist, save, revoke
26dxosAutomations@latticedx/plugin-dxos-studiolistRules, saveRule, toggleRule, deleteRule, listRuns, runNow, replayRun
27dxosBuilder@latticedx/plugin-dxos-studiolistDomains, createDomain, listBusinessPacks, installBusinessPack, listTenants, provisionTenant
28dxosN8n@latticedx/plugin-dxos-studiostatus, appCatalog, workflows, getWorkflow, createWorkflow, updateWorkflow, activateWorkflow, executions, retryExecution, syncCredential
29dxosAi@latticedx/plugin-dxos-ailistProfiles, saveProfile, deleteProfile, bootstrapDefaults, portalAgents, auditLogs, quotaSummary, enterpriseTopology, pageSurfaceState, inspectPageBlocks, rollbackPageSnapshot, surfaceEvents, listApprovals, approveAction, rejectAction
30dxActions@latticedx/plugin-action-bridgeconnect, callback, status, catalog, list, run, files, workflow, studio, entity, agent, logistics, disconnect
31enterpriseAuth@latticedx/plugin-enterprise-authstart, callback, finish, backchannelLogout, configuration, link, listLinkTargets, listMappings, unlink

In addition to these 31 core resources, @latticedx/plugin-lattice-foundation registers latticeRequestAttachments for ClamAV-scanned attachments (1 MiB cap), and @latticedx/plugin-dxos-ai mounts the AI protocol endpoints POST /api/dxos-mcp, POST /api/dxos-mcp/it-ot, GET /.well-known/agent-card.json, GET /api/dxos-a2a/agent-card.json, and POST /api/dxos-a2a. Dynamic latticeCustom* collections provisioned through dxosBuilder expose standard list, get, create, update, and destroy actions at /api/latticeCustom<Name>:<action>.

Fastify Core API Surface (/v1/*) ​

The Fastify Core API (apps/api/src/app.ts, default port 4000) enforces a 16 KiB request body limit (bodyLimit: 16_384), an in-memory sliding-window rate limiter (API_RATE_LIMIT_MAX=1000 per 60s, emitting X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and Retry-After on 429), and a uniform error payload { "error": "<message>" }.

Fastify /v1/* Pagination and Envelope
ParameterTypeDefaultDescription
limit
integer50Maximum items returned per page, bounded to 1..100.
offset
integer0Zero-based item offset (>= 0).
q
string—Search query string, maximum 200 characters.
items / pagerequired
object—Response shape: { items: [...], page: { limit, offset, hasMore, nextOffset } }.

Major Fastify /v1/* route groups include:

Route GroupRepresentative Endpoints
Health and OperationsGET /health, /v1/operations/diagnostics, /v1/operations/metrics, /v1/operations/queues, /v1/operations/retention-preview, /v1/system-*
Records, Entities, and Tasks/v1/records, /v1/records/:id, /v1/entities*, /v1/entity-*, /v1/tasks*, /v1/files*, /v1/actions*, /v1/blocks*
Directory, Workflows, and Integrations/v1/directory/*, /v1/organization/*, /v1/workflow-*, /v1/logistics/orders*, /v1/integrations/ngsi-ld/*, /v1/enterprise-modules*, /v1/studio/*, POST /v1/agent/demo

Request Examples and Error Handling ​

bash
# Paginated order query with a scoped API key
curl -sS -G "https://app.example.com/api/latticeOrders:list" \
  -H "X-Lattice-API-Key: ldx_pat_a1b2c3d4_0123456789abcdef0123456789abcdef" \
  --data-urlencode "page=1" \
  --data-urlencode "pageSize=20" \
  --data-urlencode "sort=-id"

# Draft voucher update with optimistic locking
curl -sS -X POST "https://app.example.com/api/latticeOrders:update?filterByTk=42" \
  -H "Authorization: Bearer <OIDC_OR_PAT_TOKEN>" \
  -H "Content-Type: application/json" \
  -H 'If-Match: "3"' \
  -d '{"values":{"notes":"Batch verified"}}'

Error Envelopes and Common Status Codes ​

NocoBase endpoints serialize errors as { "errors": [{ "message": "...", "code": "..." }] }, whereas Fastify /v1/* endpoints return { "error": "..." }.

HTTP StatusMeaningTypical Cause
400Bad RequestMissing required field, malformed expectedVersion, q exceeding 200 chars, or invalid JSON payload
401UnauthorizedMissing credential, expired PAT (API_KEY_EXPIRED), revoked PAT (API_KEY_REVOKED), or backchannel-revoked OIDC session
403ForbiddenMissing ldx_pat_* scope (API_KEY_SCOPE_INSUFFICIENT), cross-org mismatch (NATIVE_ORGANIZATION_MISMATCH), or private collection guard
409ConflictStale expectedVersion (VERSION_CONFLICT) or editing a locked voucher (VOUCHER_IMMUTABLE)
429Too Many RequestsExceeded APISIX limit-count (120/240/300 req/60s) or Fastify sliding-window limit

Apache-2.0 · LatticeDX v0.4.2 · Powered by NocoBase · v2.2.50 · Apache-2.0 (Clause 5.2)