Connecting an integration
An integration talks to the same HTTP API the OnERP app uses. Three ways in exist:
- HTTP, from any language, with a service account’s API key. This page and HTTP conventions.
- MCP, for an AI client that should read and act in a workspace. See MCP.
- Node-RED, for flows built in its editor. See Node-RED.
Authenticate with an API key
Section titled “Authenticate with an API key”Each integration gets its own service account and API key; the workspace owner issues them under Service accounts. The key belongs to one workspace, and the account’s roles decide what it may do.
Send the key on every request in the x-api-key header:
curl https://erp.example.com/api/business-object/sales/SalesOrder?limit=10 \ -H "x-api-key: $ONERP_API_KEY"A missing or revoked key answers 401. A request outside the account’s roles answers 403
with the code core.forbidden and the missing permission.
Base URL and routes
Section titled “Base URL and routes”Every route sits under /api on the server’s address. A kind of business object is addressed
by its name, such as sales/SalesOrder or master/Product, which becomes two path segments.
| Route | Does |
|---|---|
GET /api/meta |
The workspace’s definitions: every kind of business object, its fields, actions and functions |
GET /api/business-object/{namespace}/{Name} |
A page of business objects |
GET /api/business-object/{namespace}/{Name}/{id} |
One business object |
POST /api/business-object/{namespace}/{Name} |
Create a business object. ?status=draft creates a draft |
PATCH /api/business-object/{namespace}/{Name}/{id} |
Change a business object |
DELETE /api/business-object/{namespace}/{Name}/{id} |
Delete a draft or an archived business object |
POST …/{id}/activate, …/archive, …/restore |
Move a business object through its lifecycle |
GET …/{id}/actions |
The actions available on a business object right now |
POST …/{id}/actions/{action} |
Run an action, with its parameters as the body |
POST /api/functions/{namespace}/{name} |
Call a function: a read that takes parameters |
Business objects on the wire
Section titled “Business objects on the wire”Business objects are JSON. Decimals and dates travel as strings, so no precision is lost.
Every business object carries its id and status (draft, active or archived).
A write sends only the fields it sets. Rows of a collection are changed with three lists:
{ "items": { "create": [{ "product": "01J…", "quantity": "2" }], "update": [{ "id": "01J…", "quantity": "5" }], "delete": ["01J…"] }}Fields the system computes (totals, statuses, invoiced quantities) are read-only, and a document past release refuses changes to its entered fields.
Lists and paging
Section titled “Lists and paging”A list answers { "items": [...], "nextCursor": "…" | null }. Pass nextCursor back as
cursor for the next page; null means the last page. limit defaults to 50; above 1000 the
request is refused with core.validation_failed. withTotal=true adds total.
Other query parameters:
filter: a JSON object keyed by field, for example{"customer":{"equals":"01J…"},"orderDate":{"gte":"2026-01-01"}}. Operators includeequals,notEquals,in,notIn,isNull,contains,startsWith,gt,gte,lt,lteandbetween;AND,ORandNOTcombine them, andsomeornonereach into a collection’s rows.search: free text over the searchable fields.sortandorder(ascordesc). Without them, the newest business object comes first.statuses: which lifecycle statuses to include. Lists hold active business objects by default.
A cursor belongs to the question that produced it; sending it with a different filter or sort
answers 400 core.invalid_cursor.
TypeScript client
Section titled “TypeScript client”The OnERP app and the Node-RED nodes use @onerp/client, a TypeScript client that reads
/api/meta once and then offers typed reads, writes and actions. It lives in the OnERP source
repository and is not published to npm.