Data API
List, read, create, update and delete rows of the app's tables, with filters, embedded related rows, aggregates, full-text search, lifecycle transitions, batches of calls, and raw SQL for trusted backends. Every call runs as the caller under your row-level security policies.
On this page
- Authentication
- Endpoints
- POST /data/:op
- GET /api/v1/search
- GET /api/v1/openapi.json
- GET /api/v1/:table
- POST /api/v1/:table
- GET /api/v1/:table/aggregate
- GET /api/v1/:table/search
- GET /api/v1/:table/:id
- PATCH /api/v1/:table/:id
- DELETE /api/v1/:table/:id
- PATCH /api/v1/:table/:id/transition
- POST /api/v1/:table/:id/restore
- POST /batch
Base URL: your app's origin ($APP_ORIGIN): the dev site (https://dev-<slug>.apps.appbricx.com), the published host or a custom domain. Errors answer { ok: false, error: { code, message } } unless noted. The host decides the environment: the dev site reads and writes the dev database, the published host and custom domains production's.
Authentication
- Server key
- A server-tier project key (dpk_s_…). Browser keys and end-user sessions are refused. Treat it like a database password.
Authorization: Bearer $SERVER_KEYx-appbricx-data-api: 1 - App key + data marker
- A project key (dpk_c_… in browsers, bound to the app's origins and sent with Origin; dpk_s_… on servers) plus the data-API marker header. With an app session (the header, or the appbricx_app_session cookie) the call acts as that user under row-level security; without one it acts as a signed-out visitor. A server key may assert x-appbricx-app-user and x-appbricx-app-role.
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Endpoints
Raw SQL (server keys)
POST/__appbricx/data/:op
op is query (one read with $1… params), exec (one write), schema (tables, columns and keys) or migrate (DDL once, by migration_id). Runs past row-level security on the host's environment: for trusted backends only. Prefer the data API, named queries or actions.
- Auth
- Server key:
Authorization: Bearer $SERVER_KEYx-appbricx-data-api: 1
Path parameters
| Name | Type | Description |
|---|---|---|
:oprequired | string | query, exec, schema or migrate. |
Body
| Name | Type | Description |
|---|---|---|
sqloptional | string | query, exec, migrate: the statement. |
paramsoptional | unknown[] | Values for $1, $2… |
migration_idoptional | string | migrate: a unique id. |
Response
{
"ok": true,
"rows": [
{
"ref": "BK-ACME1",
"status": "requested"
}
],
"rowCount": 1,
"fields": [],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | RAW_SQL_FORBIDDEN | Not a server-tier key. |
Audited. On production only when the workspace owner allowed it.
curl -X POST "$APP_ORIGIN/__appbricx/data/query" \
-H "Authorization: Bearer $SERVER_KEY" \
-H "x-appbricx-data-api: 1" \
-H "content-type: application/json" \
-d '{"sql":"select ref, status from booking where status = $1 limit 10","params":["requested"]}'const res = await fetch(`${APP_ORIGIN}/__appbricx/data/query`, {
method: "POST",
headers: {
Authorization: `Bearer ${SERVER_KEY}`,
"x-appbricx-data-api": "1",
"content-type": "application/json",
},
body: JSON.stringify({
"sql": "select ref, status from booking where status = $1 limit 10",
"params": [
"requested"
]
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/builder_http.go:50
Search several tables
GET/__appbricx/api/v1/search
Ranked full-text search across the tables you name, under the caller's row-level security.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Query parameters
| Name | Type | Description |
|---|---|---|
qrequired | string | Search text. |
tablesrequired | string | Comma-separated tables (up to 20); tables the caller may not read are skipped. |
limitoptional | number | Rows per table (default 5). |
Response
{
"ok": true,
"results": [
{
"table": "experience",
"rows": [
{
"id": "e1a2…",
"title": "Pottery Jam"
}
]
},
{
"table": "booking",
"rows": []
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 400 | MISSING_QUERY | q is empty. |
curl "$APP_ORIGIN/__appbricx/api/v1/search?q=pottery&tables=experience%2Cbooking" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/search?q=pottery&tables=experience%2Cbooking`, {
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:181
OpenAPI document
GET/__appbricx/api/v1/openapi.json
The app's OpenAPI document: every table and view with its columns, embed and search parameters, one path per action with its argument and result schemas, and batch. No data.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Response
{
"openapi": "3.1.0",
"info": {
"title": "Teamday API",
"version": "1"
},
"paths": {
"/__appbricx/api/v1/booking": {
"get": {
"summary": "List booking"
}
},
"/__appbricx/actions/confirmBooking": {
"post": {}
}
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
curl "$APP_ORIGIN/__appbricx/api/v1/openapi.json" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/openapi.json`, {
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:182
List rows
GET/__appbricx/api/v1/:table
A page of the rows the caller may read, filtered, sorted and paged in SQL, with related rows embedded. Hidden columns (@hide <role> in a column comment) are left out for those roles.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
Query parameters
| Name | Type | Description |
|---|---|---|
whereoptional | JSON object | Equality filters, ANDed: {"status":"requested"}. |
filteroptional | JSON array | Clauses [{ field, op, value }]. op: eq, neq, lt, lte, gt, gte, in, not_in, contains, not_contains, starts_with, ends_with, is_null, is_not_null, between ([a, b]), and on dates today, yesterday, this_week, this_month, this_year, last_n_days, next_n_days, range. |
sortoptional | JSON object | {"field":"created_at","dir":"desc"} (dir defaults to asc). |
limitoptional | number | 1 to 500 (default 50). |
offsetoptional | number | Rows to skip. |
cursoroptional | string | start, then the nextCursor of the previous page (keyset paging; the answer adds nextCursor and hasMore). |
embedoptional | string | Up to 8 related relations in the same read: a reference by its table or column (experience(title,city)), or the rows pointing here (booking, booking!experience_id). Each embedded table's row-level security applies. |
trashoptional | "1" | Soft-deleted rows (ctx.soft_delete tables; needs delete rights). |
Response
With cursor: { ok, rows, rowCount, nextCursor, hasMore }.
{
"ok": true,
"rows": [
{
"id": "5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10",
"ref": "BK-ACME1",
"status": "requested",
"team_size": 12,
"total": "21600.00",
"created_at": "2026-10-28T09:14:03Z",
"experience": {
"title": "Pottery Jam"
}
}
],
"rowCount": 1,
"fields": [
{
"name": "id",
"type": "uuid"
}
],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 400 | PARAMS_INVALID | where, filter, sort or embed names an unknown column or relation, or isn't valid JSON. |
curl "$APP_ORIGIN/__appbricx/api/v1/booking?where=%7B%22status%22%3A%22requested%22%7D&embed=experience(title)&limit=20" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking?where=%7B%22status%22%3A%22requested%22%7D&embed=experience(title)&limit=20`, {
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:183
Create a row
POST/__appbricx/api/v1/:table
Insert a row as the caller. Your policies' with check decide whether it may be written, your triggers run, and columns with defaults (user_id default ctx.uid(), ctx.short_ref) are filled by the database.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
Body
| Name | Type | Description |
|---|---|---|
(columns)required | object | The row's own columns. |
Response
201 Created.
{
"ok": true,
"rows": [
{
"id": "5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10",
"ref": "BK-ACME1",
"status": "requested",
"team_size": 12,
"total": "21600.00",
"created_at": "2026-10-28T09:14:03Z"
}
],
"rowCount": 1,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "ref",
"type": "text"
},
{
"name": "status",
"type": "text"
}
],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 400 | RLS_VIOLATION | A policy's with check refused the row. |
| 409 | CONFLICT | A unique column is taken (or your trigger raised with errcode unique_violation). |
| 422 | RULE_REFUSED | Your trigger's raise exception, with its message. |
| 422 | CHECK_VIOLATION | A check constraint failed. |
| 422 | E_LIFECYCLE_DIRECT_WRITE | A ctx.lifecycle column was written with a state other than its initial one. |
curl -X POST "$APP_ORIGIN/__appbricx/api/v1/booking" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION" \
-H "content-type: application/json" \
-d '{"experience_id":"e1a2…","hr_id":"9b3c…","team_size":12,"email":"offsite@acme.test"}'const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking`, {
method: "POST",
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
"content-type": "application/json",
},
body: JSON.stringify({
"experience_id": "e1a2…",
"hr_id": "9b3c…",
"team_size": 12,
"email": "offsite@acme.test"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:184
Aggregate
GET/__appbricx/api/v1/:table/aggregate
count, sum, avg, min or max over the rows the caller may read, optionally per group or per day, week or month, in a time window with the previous one to compare.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
Query parameters
| Name | Type | Description |
|---|---|---|
metricrequired | "count" | "sum" | "avg" | "min" | "max" | What to compute. |
columnoptional | string | The column (required unless metric=count). |
filteroptional | JSON array | Clauses as on list. |
rangeoptional | string | today, this_week, last_7_days, this_month, last_30_days, this_quarter, this_year or all. |
dateFieldoptional | string | The date column range applies to (default created_at). |
tzoptional | IANA zone | For range and bucket (default UTC). |
compareoptional | "1" | With range: the previous period too. |
groupByoptional | string | One value per distinct value of this column. |
bucketoptional | "day" | "week" | "month" | With groupBy on a date column. |
Response
One value: { ok, value, window?, previous?, previousWindow? }.
{
"ok": true,
"groups": [
{
"key": "confirmed",
"value": 40
},
{
"key": "requested",
"value": 20
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 400 | PARAMS_INVALID | Unknown metric or column. |
curl "$APP_ORIGIN/__appbricx/api/v1/booking/aggregate?metric=sum&column=team_size&groupBy=status" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking/aggregate?metric=sum&column=team_size&groupBy=status`, {
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:185
Search one table
GET/__appbricx/api/v1/:table/search
Full-text search on the table's own generated tsvector column (search tsvector generated always as (to_tsvector('simple', …)) stored), ranked, under row-level security, answered like a list.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
Query parameters
| Name | Type | Description |
|---|---|---|
qrequired | string | Web-search syntax: quotes, OR, -word. |
limitoptional | number | Default 20, max 100. |
Response
{
"ok": true,
"rows": [
{
"id": "5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10",
"ref": "BK-ACME1",
"status": "requested",
"team_size": 12,
"total": "21600.00",
"created_at": "2026-10-28T09:14:03Z"
}
],
"rowCount": 1,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "ref",
"type": "text"
},
{
"name": "status",
"type": "text"
}
],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 400 | PARAMS_INVALID | The table has no search vector. |
| 400 | MISSING_QUERY | q is empty. |
curl "$APP_ORIGIN/__appbricx/api/v1/booking/search?q=acme" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking/search?q=acme`, {
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:186
Get a row
GET/__appbricx/api/v1/:table/:id
One row by id. rows is empty when it doesn't exist or row-level security hides it.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
:idrequired | string | The row id. |
Query parameters
| Name | Type | Description |
|---|---|---|
embedoptional | string | As on list. |
Response
{
"ok": true,
"rows": [
{
"id": "5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10",
"ref": "BK-ACME1",
"status": "requested",
"team_size": 12,
"total": "21600.00",
"created_at": "2026-10-28T09:14:03Z"
}
],
"rowCount": 1,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "ref",
"type": "text"
},
{
"name": "status",
"type": "text"
}
],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
Every row of a table (not a view) carries `_version`, its version (it changes on every write of the row); a one-row answer also has it as its `ETag`. Send it back as `If-Match` on PATCH or DELETE to refuse a write over someone else's change.
curl "$APP_ORIGIN/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10`, {
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:187
Update a row
PATCH/__appbricx/api/v1/:table/:id
Patch a row as the caller. A ctx.lifecycle column moves only through its transitions (PATCH …/transition).
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
:idrequired | string | The row id. |
Body
| Name | Type | Description |
|---|---|---|
(columns)required | object | The columns to change. |
Response
{
"ok": true,
"rows": [
{
"id": "5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10",
"ref": "BK-ACME1",
"status": "requested",
"team_size": 12,
"total": "21600.00",
"created_at": "2026-10-28T09:14:03Z"
}
],
"rowCount": 1,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "ref",
"type": "text"
},
{
"name": "status",
"type": "text"
}
],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 422 | RULE_REFUSED | Your trigger refused (its message). |
| 422 | E_LIFECYCLE_DIRECT_WRITE | A lifecycle column in the patch. |
| 409 | CONFLICT | A unique column is taken. |
| 409 | VERSION_CONFLICT | With If-Match: the row changed since that version (error.details.current). |
`If-Match: "<_version>"` (the version you read, or the read's ETag) makes the write conditional: if the row changed since, nothing is written and the answer is 409 `VERSION_CONFLICT` with `error.details.current` (the row as you may read it now, or null when it was deleted or is out of your reach) and `error.details.version`. Without it the last write wins. A `_version` key in the body is ignored.
In a batch, give the item `ifMatch` (the batch's own If-Match header isn't carried to its items).
curl -X PATCH "$APP_ORIGIN/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION" \
-H "content-type: application/json" \
-d '{"notes":"Vegetarian lunch"}'const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
"content-type": "application/json",
},
body: JSON.stringify({
"notes": "Vegetarian lunch"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:188
Delete a row
DELETE/__appbricx/api/v1/:table/:id
Delete a row as the caller; on a ctx.soft_delete table it moves to the trash (reads hide it; restore brings it back).
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
:idrequired | string | The row id. |
Response
{
"ok": true,
"rows": [],
"rowCount": 1
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 400 | INTERNAL | Postgres refused, with its message (for example a foreign key other rows still use). |
| 409 | VERSION_CONFLICT | With If-Match: the row changed since that version (error.details.current). |
`If-Match: "<_version>"`: only delete the row at that version (as on PATCH). A row already gone answers as without it.
curl -X DELETE "$APP_ORIGIN/__appbricx/api/v1/ops_note/1f0e…" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/ops_note/1f0e…`, {
method: "DELETE",
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:189
Move a lifecycle state
PATCH/__appbricx/api/v1/:table/:id/transition
Move a ctx.lifecycle column along its declared transitions (db/schema: select ctx.lifecycle('booking', 'status', $$ requested -> confirmed | cancelled $$)). Policies and triggers apply.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
:idrequired | string | The row id. |
Body
| Name | Type | Description |
|---|---|---|
fieldrequired | string | The lifecycle column. |
torequired | string | The target state. |
Response
{
"ok": true,
"from": "requested",
"to": "cancelled"
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
| 400 | E_TRANSITION_INVALID | The body isn't { field, to }. |
| 409 | E_TRANSITION_FORBIDDEN | No transition from the current state to `to`. |
| 403 | E_TRANSITION_ROW | The caller may not change this row. |
curl -X PATCH "$APP_ORIGIN/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10/transition" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION" \
-H "content-type: application/json" \
-d '{"field":"status","to":"cancelled"}'const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10/transition`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
"content-type": "application/json",
},
body: JSON.stringify({
"field": "status",
"to": "cancelled"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:190
Restore a deleted row
POST/__appbricx/api/v1/:table/:id/restore
Bring a soft-deleted row back from the trash.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Path parameters
| Name | Type | Description |
|---|---|---|
:tablerequired | string | A table (or security_invoker view) of db/schema. |
:idrequired | string | The row id. |
Response
{
"ok": true,
"rows": [
{
"id": "5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10",
"ref": "BK-ACME1",
"status": "requested",
"team_size": 12,
"total": "21600.00",
"created_at": "2026-10-28T09:14:03Z"
}
],
"rowCount": 1,
"fields": [
{
"name": "id",
"type": "uuid"
},
{
"name": "ref",
"type": "text"
},
{
"name": "status",
"type": "text"
}
],
"truncated": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 403 | TABLE_FORBIDDEN | The table is marked @api off (or @api read for a write), or a policy refuses the row. |
curl -X POST "$APP_ORIGIN/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10/restore" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION"const res = await fetch(`${APP_ORIGIN}/__appbricx/api/v1/booking/5d0c2f9e-0d4b-4c39-9f63-2a1d5b7e8f10/restore`, {
method: "POST",
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:191
Batch
POST/__appbricx/batch
Up to 20 data API, named query and action calls in one round trip. Each item runs exactly as if sent alone with the batch's headers (its own transaction, rate-limit count, status and body); a failing item doesn't stop the others.
- Auth
- App key + data marker:
Authorization: Bearer $APP_KEYx-appbricx-data-api: 1x-appbricx-app-session: $APP_SESSION (optional: acts as that user)
Body
| Name | Type | Description |
|---|---|---|
(array)required | Array<{ method, path, body? }> | Paths under /__appbricx/api/v1/, /__appbricx/queries or /__appbricx/actions/ only. |
Response
{
"ok": true,
"results": [
{
"status": 200,
"body": {
"ok": true,
"rows": [],
"rowCount": 0
}
},
{
"status": 200,
"body": {
"ok": true,
"result": {
"ref": "BK-ACME1",
"status": "confirmed"
},
"runId": "…"
}
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid Authorization bearer. |
| 400 | PARAMS_INVALID | The x-appbricx-data-api: 1 header is missing. |
| 403 | ORIGIN_NOT_ALLOWED | A browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all). |
| 429 | RATE_LIMITED | The project's per-minute request budget is spent (600 a minute, 1,200 with a server key; a quarter of that per IP and per user). |
| 400 | PARAMS_INVALID | Not an array, more than 20 items, or (per item) a path outside the allowed ones. |
curl -X POST "$APP_ORIGIN/__appbricx/batch" \
-H "Authorization: Bearer $APP_KEY" \
-H "x-appbricx-data-api: 1" \
-H "x-appbricx-app-session: $APP_SESSION" \
-H "content-type: application/json" \
-d '[{"method":"GET","path":"/__appbricx/api/v1/booking?limit=5"},{"method":"POST","path":"/__appbricx/actions/confirmBooking","body":{"booking":"5d0c…"}}]'const res = await fetch(`${APP_ORIGIN}/__appbricx/batch`, {
method: "POST",
headers: {
Authorization: `Bearer ${APP_KEY}`,
"x-appbricx-data-api": "1",
"x-appbricx-app-session": APP_SESSION,
"content-type": "application/json",
},
body: JSON.stringify([
{
"method": "GET",
"path": "/__appbricx/api/v1/booking?limit=5"
},
{
"method": "POST",
"path": "/__appbricx/actions/confirmBooking",
"body": {
"booking": "5d0c…"
}
}
]),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/runtime/data/http.go:207