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.

13 endpointsHTTP API referenceGuide: Data API guide

On this page
  1. Authentication
  2. Endpoints
  3. POST /data/:op
  4. GET /api/v1/search
  5. GET /api/v1/openapi.json
  6. GET /api/v1/:table
  7. POST /api/v1/:table
  8. GET /api/v1/:table/aggregate
  9. GET /api/v1/:table/search
  10. GET /api/v1/:table/:id
  11. PATCH /api/v1/:table/:id
  12. DELETE /api/v1/:table/:id
  13. PATCH /api/v1/:table/:id/transition
  14. POST /api/v1/:table/:id/restore
  15. 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

NameTypeDescription
:oprequiredstringquery, exec, schema or migrate.

Body

NameTypeDescription
sqloptionalstringquery, exec, migrate: the statement.
paramsoptionalunknown[]Values for $1, $2…
migration_idoptionalstringmigrate: a unique id.

Response

Response
{
  "ok": true,
  "rows": [
    {
      "ref": "BK-ACME1",
      "status": "requested"
    }
  ],
  "rowCount": 1,
  "fields": [],
  "truncated": false
}

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
429RATE_LIMITEDThe 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).
403RAW_SQL_FORBIDDENNot a server-tier key.

Audited. On production only when the workspace owner allowed it.

curl
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"]}'
fetch
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

NameTypeDescription
qrequiredstringSearch text.
tablesrequiredstringComma-separated tables (up to 20); tables the caller may not read are skipped.
limitoptionalnumberRows per table (default 5).

Response

Response
{
  "ok": true,
  "results": [
    {
      "table": "experience",
      "rows": [
        {
          "id": "e1a2…",
          "title": "Pottery Jam"
        }
      ]
    },
    {
      "table": "booking",
      "rows": []
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
400MISSING_QUERYq is empty.
curl
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"
fetch
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

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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
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"
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.

Query parameters

NameTypeDescription
whereoptionalJSON objectEquality filters, ANDed: {"status":"requested"}.
filteroptionalJSON arrayClauses [{ 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.
sortoptionalJSON object{"field":"created_at","dir":"desc"} (dir defaults to asc).
limitoptionalnumber1 to 500 (default 50).
offsetoptionalnumberRows to skip.
cursoroptionalstringstart, then the nextCursor of the previous page (keyset paging; the answer adds nextCursor and hasMore).
embedoptionalstringUp 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 }.

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",
      "experience": {
        "title": "Pottery Jam"
      }
    }
  ],
  "rowCount": 1,
  "fields": [
    {
      "name": "id",
      "type": "uuid"
    }
  ],
  "truncated": false
}

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
400PARAMS_INVALIDwhere, filter, sort or embed names an unknown column or relation, or isn't valid JSON.
curl
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"
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.

Body

NameTypeDescription
(columns)requiredobjectThe row's own columns.

Response

201 Created.

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
400RLS_VIOLATIONA policy's with check refused the row.
409CONFLICTA unique column is taken (or your trigger raised with errcode unique_violation).
422RULE_REFUSEDYour trigger's raise exception, with its message.
422CHECK_VIOLATIONA check constraint failed.
422E_LIFECYCLE_DIRECT_WRITEA ctx.lifecycle column was written with a state other than its initial one.
curl
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"}'
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.

Query parameters

NameTypeDescription
metricrequired"count" | "sum" | "avg" | "min" | "max"What to compute.
columnoptionalstringThe column (required unless metric=count).
filteroptionalJSON arrayClauses as on list.
rangeoptionalstringtoday, this_week, last_7_days, this_month, last_30_days, this_quarter, this_year or all.
dateFieldoptionalstringThe date column range applies to (default created_at).
tzoptionalIANA zoneFor range and bucket (default UTC).
compareoptional"1"With range: the previous period too.
groupByoptionalstringOne 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? }.

Response
{
  "ok": true,
  "groups": [
    {
      "key": "confirmed",
      "value": 40
    },
    {
      "key": "requested",
      "value": 20
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
400PARAMS_INVALIDUnknown metric or column.
curl
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"
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.

Query parameters

NameTypeDescription
qrequiredstringWeb-search syntax: quotes, OR, -word.
limitoptionalnumberDefault 20, max 100.

Response

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
400PARAMS_INVALIDThe table has no search vector.
400MISSING_QUERYq is empty.
curl
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"
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.
:idrequiredstringThe row id.

Query parameters

NameTypeDescription
embedoptionalstringAs on list.

Response

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe 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
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"
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.
:idrequiredstringThe row id.

Body

NameTypeDescription
(columns)requiredobjectThe columns to change.

Response

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
422RULE_REFUSEDYour trigger refused (its message).
422E_LIFECYCLE_DIRECT_WRITEA lifecycle column in the patch.
409CONFLICTA unique column is taken.
409VERSION_CONFLICTWith 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
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"}'
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.
:idrequiredstringThe row id.

Response

Response
{
  "ok": true,
  "rows": [],
  "rowCount": 1
}

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
400INTERNALPostgres refused, with its message (for example a foreign key other rows still use).
409VERSION_CONFLICTWith 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
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"
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.
:idrequiredstringThe row id.

Body

NameTypeDescription
fieldrequiredstringThe lifecycle column.
torequiredstringThe target state.

Response

Response
{
  "ok": true,
  "from": "requested",
  "to": "cancelled"
}

Errors

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
400E_TRANSITION_INVALIDThe body isn't { field, to }.
409E_TRANSITION_FORBIDDENNo transition from the current state to `to`.
403E_TRANSITION_ROWThe caller may not change this row.
curl
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"}'
fetch
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

NameTypeDescription
:tablerequiredstringA table (or security_invoker view) of db/schema.
:idrequiredstringThe row id.

Response

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
403TABLE_FORBIDDENThe table is marked @api off (or @api read for a write), or a policy refuses the row.
curl
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"
fetch
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

NameTypeDescription
(array)requiredArray<{ method, path, body? }>Paths under /__appbricx/api/v1/, /__appbricx/queries or /__appbricx/actions/ only.

Response

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

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid Authorization bearer.
400PARAMS_INVALIDThe x-appbricx-data-api: 1 header is missing.
403ORIGIN_NOT_ALLOWEDA browser key used from an origin it isn't bound to (ORIGIN_REQUIRED when there is no Origin at all).
429RATE_LIMITEDThe 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).
400PARAMS_INVALIDNot an array, more than 20 items, or (per item) a path outside the allowed ones.
curl
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…"}}]'
fetch
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