Developer API: build
Tokens, projects, the project's files (the dev draft), check and apply, versions, previews and templates. The CLI and the MCP tools call the same operations.
On this page
- Authentication
- Endpoints
- POST /tokens
- GET /tokens
- DELETE /tokens/:tokenId
- GET /me
- GET /docs
- GET /projects
- POST /projects
- GET /projects/:id
- GET /projects/:id/versions
- GET /projects/:id/versions/diff
- GET /projects/:id/versions/compare
- POST /projects/:id/versions/:n/restore
- PUT /projects/:id/versions/:n/label
- POST /projects/:id/plan
- POST /projects/:id/check-code
- GET /projects/:id/versions/:n
- POST /projects/:id/check
- POST /projects/:id/apply
- POST /projects/:id/previews
- GET /projects/:id/previews
- DELETE /projects/:id/previews/:name
- GET /templates
- POST /templates
- GET /templates/:slug
- DELETE /templates/:slug
- POST /templates/:slug/use
- GET /projects/:id/templates
- GET /projects/:id/files
- GET /projects/:id/files/diff
- POST /projects/:id/files/check
- POST /projects/:id/files/apply
- POST /projects/:id/files/reset
- POST /projects/:id/files/move
- POST /projects/:id/files
- PUT /projects/:id/files
- GET /projects/:id/files/*
- PUT /projects/:id/files/*
- DELETE /projects/:id/files/*
Base URL: https://appbricx.com/api/dev/v1 (self-hosted: https://<your platform host>/dev/v1). Errors answer { error, code? } with the HTTP status. The MCP tools and the CLI call the same operations and get the same answers.
Authentication
- Console session only
- The signed-in console session. A personal access token can't mint another token.
Authorization: Bearer $SESSION_JWT - Developer token
- A personal access token (apx_pat_…, one workspace, scopes read / apply / deploy), an MCP client's OAuth token, or a console session. A project outside the token's reach answers 404, never 403.
Authorization: Bearer $APPBRICX_TOKEN
Endpoints
Mint a token
POST/api/dev/v1/tokens
Create a personal access token for one workspace. The token is shown once; Appbricx keeps only its hash.
- Auth
- Console session only:
Authorization: Bearer $SESSION_JWT
Scope: console session
Body
| Name | Type | Description |
|---|---|---|
namerequired | string | What it is for (ci, laptop). |
workspaceIdrequired | uuid | The workspace it reaches. |
scopesoptional | Array<"read" | "apply" | "deploy"> | Default read and apply. A workspace viewer may mint read only. |
expiresInDaysoptional | number | 1 to 366; omitted, it doesn't expire. |
Response
201 Created.
{
"token": "apx_pat_…",
"id": "t_1",
"name": "ci",
"workspaceId": "6c4ea024-…",
"scopes": [
"read",
"apply",
"deploy"
],
"expiresAt": "2027-01-26T00:00:00Z"
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 403 | SESSION_REQUIRED | Called with a token, not a session. |
| 400 | INVALID_SCOPE | Unknown scope, or a viewer asking for more than read. |
curl -X POST "https://appbricx.com/api/dev/v1/tokens" \
-H "Authorization: Bearer $SESSION_JWT" \
-H "content-type: application/json" \
-d '{"name":"ci","workspaceId":"6c4ea024-…","scopes":["read","apply","deploy"],"expiresInDays":90}'const res = await fetch("https://appbricx.com/api/dev/v1/tokens", {
method: "POST",
headers: {
Authorization: `Bearer ${SESSION_JWT}`,
"content-type": "application/json",
},
body: JSON.stringify({
"name": "ci",
"workspaceId": "6c4ea024-…",
"scopes": [
"read",
"apply",
"deploy"
],
"expiresInDays": 90
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:156
List my tokens
GET/api/dev/v1/tokens
Your live personal access tokens: id, name, prefix, scopes, expiry and last use. Never the token.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: any
Response
{
"tokens": [
{
"id": "t_1",
"name": "ci",
"token_prefix": "apx_pat_Ab12",
"scopes": [
"read",
"apply"
],
"expires_at": null,
"last_used_at": "2026-10-28T08:12:00Z"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
curl "https://appbricx.com/api/dev/v1/tokens" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/tokens", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:161
Revoke a token
DELETE/api/dev/v1/tokens/:tokenId
Revoke one of your tokens. It stops working on the next request, on every node.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: any (your own tokens)
Path parameters
| Name | Type | Description |
|---|---|---|
:tokenIdrequired | string | The token id. |
Response
{
"revoked": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | Not one of your tokens. |
curl -X DELETE "https://appbricx.com/api/dev/v1/tokens/t_1" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/tokens/t_1", {
method: "DELETE",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:162
Who am I
GET/api/dev/v1/me
The user, the credential's scopes and workspaces (MCP whoami).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: any
Response
{
"user": {
"id": "96f4…",
"email": "dev@example.com"
},
"scopes": [
"read",
"apply",
"deploy"
],
"workspaces": [
{
"id": "6c4ea024-…",
"name": "Acme",
"role": "owner"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
curl "https://appbricx.com/api/dev/v1/me" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/me", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:165
The guide
GET/api/dev/v1/docs
The whole guide (what get_guide serves) as one Markdown document.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: any
Response
text/markdown.
## Code-first: TypeScript and SQL files (every new app)
…Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
curl "https://appbricx.com/api/dev/v1/docs" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/docs", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const text = await res.text();Source: internal/svc/agentapi/transport/http.go:166
List projects
GET/api/dev/v1/projects
Projects the token can reach, newest first.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Response
{
"projects": [
{
"id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
"name": "Teamday",
"slug": "teamday",
"workspace_id": "6c4ea024-…",
"updated_at": "…"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
curl "https://appbricx.com/api/dev/v1/projects" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:176
Create a project
POST/api/dev/v1/projects
An empty project in the token's workspace. Fill it with POST …/files and apply it, or use an app template.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Body
| Name | Type | Description |
|---|---|---|
namerequired | string | 1 to 100 characters. |
descriptionoptional | string | Up to 2000 characters. |
Response
{
"project": {
"id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
"name": "Teamday",
"slug": "teamday",
"workspaceId": "6c4ea024-…"
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 403 | FORBIDDEN_SCOPE | The token lacks the "apply" scope. |
curl -X POST "https://appbricx.com/api/dev/v1/projects" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"name":"Teamday","description":"Team experiences, booked in a minute"}'const res = await fetch("https://appbricx.com/api/dev/v1/projects", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"name": "Teamday",
"description": "Team experiences, booked in a minute"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:177
Get a project
GET/api/dev/v1/projects/:id
Whether it is built, the last failed apply and the preview path.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Response
{
"project": {
"id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
"name": "Teamday",
"role": "owner"
},
"state": {
"built": true,
"failed": null
},
"previewPath": "/preview/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/"
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:182
List versions
GET/api/dev/v1/projects/:id/versions
Every apply is a version: newest first with author, time, label and what changed, and the releases that published it. env=prod lists the releases.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Query parameters
| Name | Type | Description |
|---|---|---|
envoptional | "dev" | "prod" | Default dev. |
limitoptional | number | Page size. |
beforeoptional | number | Older than this version. |
Response
{
"env": "dev",
"total": 10,
"live": {
"release": 7,
"version": 9,
"url": "https://teamday.apps.appbricx.com"
},
"versions": [
{
"n": 10,
"label": null,
"author": {
"kind": "agent",
"tokenId": "…"
},
"createdAt": "…",
"changes": [
"server/bookings.ts"
]
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:189
Diff two versions
GET/api/dev/v1/projects/:id/versions/diff
What changed between two version numbers.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Query parameters
| Name | Type | Description |
|---|---|---|
fromrequired | number | A version. |
torequired | number | A version. |
Response
{
"from": 8,
"to": 10,
"changes": {
"files": [
"server/bookings.ts",
"db/access/booking.sql"
]
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/diff?from=8&to=10" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/diff?from=8&to=10", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:193
Compare dev, prod or versions
GET/api/dev/v1/projects/:id/versions/compare
versions {action: "diff"} over HTTP: refs dev, prod or a number (default prod → dev), with access, templates, bundle sizes and, when one side is a database's, the schema plan.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Query parameters
| Name | Type | Description |
|---|---|---|
fromoptional | string | dev, prod or a number (default prod). |
tooptional | string | Default dev. |
Response
{
"from": "prod",
"to": "dev",
"changes": {
"files": [
"server/bookings.ts"
],
"access": [],
"bundle": [
{
"route": "/bookings",
"gzip_before": 18211,
"gzip_after": 18904
}
]
},
"schema": {
"expand": [],
"contract": []
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 409 | NOT_DEPLOYED | prod before a release. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/compare?from=prod&to=dev" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/compare?from=prod&to=dev", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:200
Restore a version
POST/api/dev/v1/projects/:id/versions/:n/restore
A dry run (the diff from dev to that version with the dev plan) unless dryRun: false, which applies that version to dev as a new version. Rows are kept.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read for a dry run; apply to restore
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
:nrequired | string | The version number. |
Body
| Name | Type | Description |
|---|---|---|
dryRunoptional | boolean | Default true. |
Response
{
"restored": true,
"version": 11
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 404 | VERSION_NOT_FOUND | No such version. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/8/restore" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"dryRun":false}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/8/restore", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"dryRun": false
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:204
Label a version
PUT/api/dev/v1/projects/:id/versions/:n/label
Name a version ("launch", "before pricing change").
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
:nrequired | string | The version number. |
Body
| Name | Type | Description |
|---|---|---|
labelrequired | string | The label; empty clears it. |
Response
{
"version": {
"n": 9,
"label": "launch",
"hash": "…",
"createdAt": "…"
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 404 | VERSION_NOT_FOUND | No such version. |
curl -X PUT "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/9/label" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"label":"launch"}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/9/label", {
method: "PUT",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"label": "launch"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:215
Plan the database
POST/api/dev/v1/projects/:id/plan
The check with the database plan for env: the expand steps an apply would run, the contract steps (drops) left pending, and drift. A dry run.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
envoptional | "dev" | "prod" | Which database to plan against (default dev). |
Response
{
"report": {
"ok": true
},
"plan": {
"env": "prod",
"mode": "sql",
"expand": [
{
"sql": "alter table booking add column notes text"
}
],
"contract": [],
"drift": []
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/plan" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"env":"prod"}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/plan", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"env": "prod"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:222
Check one piece of code
POST/api/dev/v1/projects/:id/check-code
check_code over HTTP: a component through its gates, or a function, step or rule with a dry run.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
kindrequired | "component" | "function" | "step" | "rule" | What it is. |
sourcerequired | string | The code. |
sampleoptional | object | component: props to render with. |
Response
{
"ok": true,
"kind": "component",
"stages": [
{
"name": "static",
"status": "pass"
},
{
"name": "types",
"status": "pass"
},
{
"name": "compile",
"status": "pass"
},
{
"name": "render",
"status": "pass"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/check-code" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"kind":"component","name":"StatCard","source":"export default function StatCard() { return <div />; }"}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/check-code", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"kind": "component",
"name": "StatCard",
"source": "export default function StatCard() { return <div />; }"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:230
Get a version
GET/api/dev/v1/projects/:id/versions/:n
One version.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
:nrequired | string | The version number. |
Response
{
"version": {
"n": 9,
"label": "launch",
"hash": "…",
"createdAt": "…"
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 404 | VERSION_NOT_FOUND | No such version. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/9" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/9", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:253
Check files
POST/api/dev/v1/projects/:id/check
Check a whole tree you send (or the project's current files) without touching the draft.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
filesoptional | Record<path, text> | The tree to check. |
Response
{
"report": {
"ok": true,
"errors": [],
"warnings": []
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/check" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"files":{"app.config.ts":"…","db/schema/booking.sql":"…"}}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/check", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"files": {
"app.config.ts": "…",
"db/schema/booking.sql": "…"
}
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:256
Apply files
POST/api/dev/v1/projects/:id/apply
Build dev from a whole tree you send (or the project's current files).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
filesoptional | Record<path, text> | The tree. |
allow_destructiveoptional | boolean | Also run the plan's drops. |
Response
{
"report": {
"ok": true,
"errors": []
},
"appUrl": "https://dev-teamday.apps.appbricx.com",
"warnings": []
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 403 | FORBIDDEN_SCOPE | The token lacks the "apply" scope. |
| 422 | CONTRACT_INVALID | Doesn't check. |
| 409 | PROJECT_BUSY | An apply is running. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/apply" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"files":{"app.config.ts":"…"}}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/apply", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"files": {
"app.config.ts": "…"
}
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:261
Push a preview
POST/api/dev/v1/projects/:id/previews
Make or update a preview: a working copy with its own database (cloned from dev), bundle and address preview-<name>--<app>. The dev draft is left alone. What appbricx push --preview sends.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
namerequired | string | a-z, 0-9 and dashes, at most 30 (the branch). |
filesrequired | Record<path, text> | The tree. |
Response
{
"preview": {
"name": "feature-teaser",
"env": "pv-feature-teaser",
"url": "https://preview-feature-teaser--teamday.apps.appbricx.com"
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 403 | FORBIDDEN_SCOPE | The token lacks the "apply" scope. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"name":"feature-teaser","files":{"app.config.ts":"…"}}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"name": "feature-teaser",
"files": {
"app.config.ts": "…"
}
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:344
List previews
GET/api/dev/v1/projects/:id/previews
The project's previews and their addresses. A preview untouched for 7 days is removed.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Response
{
"previews": [
{
"name": "feature-teaser",
"url": "https://preview-feature-teaser--teamday.apps.appbricx.com",
"updated_at": "…"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:350
Remove a preview
DELETE/api/dev/v1/projects/:id/previews/:name
Remove a preview (its database and address).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
:namerequired | string | The preview's name. |
Response
{
"deleted": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl -X DELETE "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews/feature-teaser" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews/feature-teaser", {
method: "DELETE",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:353
Search templates
GET/api/dev/v1/templates
The template gallery and your workspace's private templates (search_templates).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Query parameters
| Name | Type | Description |
|---|---|---|
queryoptional | string | Words. |
kindoptional | "app" | "block" | "workflow" | "component" | Only one kind. |
categoryoptional | string | bookings, payments, teams… |
limitoptional | number | Page size. |
Response
{
"templates": [
{
"slug": "team-outings",
"kind": "app",
"title": "Team outings (code-first)",
"params": [
"brand_name",
"tagline"
]
}
],
"total": 1
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
curl "https://appbricx.com/api/dev/v1/templates?query=bookings&kind=app" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/templates?query=bookings&kind=app", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:448
Save a private template
POST/api/dev/v1/templates
Save a project's code-first tree as a private app template only your workspace sees (save_template).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply, on a plan with private templates
Body
| Name | Type | Description |
|---|---|---|
project_idrequired | uuid | The project. |
namerequired | string | The template's name. |
descriptionoptional | string | What it is. |
include_seedsoptional | boolean | Carry the seed rows. |
Response
{
"template": {
"slug": "acme-intake",
"kind": "app",
"private": true
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 403 | PLAN_REQUIRED | The plan has no private templates. |
| 409 | JSON_RETIRED | The project is still a JSON contract. |
curl -X POST "https://appbricx.com/api/dev/v1/templates" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"project_id":"3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b","name":"Acme intake","include_seeds":false}'const res = await fetch("https://appbricx.com/api/dev/v1/templates", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"project_id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
"name": "Acme intake",
"include_seeds": false
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:453
Get a template
GET/api/dev/v1/templates/:slug
One template: README, params and what it adds (get_template).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:slugrequired | string | The template's slug. |
Response
{
"template": {
"slug": "team-outings",
"kind": "app",
"params": [
{
"name": "brand_name",
"default": "Teamday"
}
]
}
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | No such template. |
curl "https://appbricx.com/api/dev/v1/templates/team-outings" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/templates/team-outings", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:467
Delete a private template
DELETE/api/dev/v1/templates/:slug
Delete a private template (whoever saved it, or a workspace owner or admin).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:slugrequired | string | The template's slug. |
Response
{
"deleted": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | No such template in your workspaces. |
curl -X DELETE "https://appbricx.com/api/dev/v1/templates/acme-intake" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/templates/acme-intake", {
method: "DELETE",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:471
Use a template
POST/api/dev/v1/templates/:slug/use
Start a project from an app template (or fill an empty one), built in dev. dry_run answers the check report and what it adds. Block, workflow and component templates are refused with TEMPLATE_RETIRED.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply (a dry run needs read)
Path parameters
| Name | Type | Description |
|---|---|---|
:slugrequired | string | The template's slug. |
Body
| Name | Type | Description |
|---|---|---|
nameoptional | string | The new project's name. |
paramsoptional | object | The template's params. |
project_idoptional | uuid | An empty project to build into. |
dry_runoptional | boolean | Check only. |
Response
{
"applied": true,
"created": true,
"template": "team-outings",
"project": {
"id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
"name": "Offsite Co",
"slug": "offsite-co"
},
"environment": "dev"
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 409 | PROJECT_HAS_APP | The project already has an app. |
| 422 | TEMPLATE_PARAMS | A param doesn't fit its pattern. |
| 410 | TEMPLATE_RETIRED | A block, workflow or component template. |
curl -X POST "https://appbricx.com/api/dev/v1/templates/team-outings/use" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"name":"Offsite Co","params":{"brand_name":"Offsite Co"}}'const res = await fetch("https://appbricx.com/api/dev/v1/templates/team-outings/use", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"name": "Offsite Co",
"params": {
"brand_name": "Offsite Co"
}
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:474
Templates used by a project
GET/api/dev/v1/projects/:id/templates
The templates this project was made from or used, with the params.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Response
{
"installs": [
{
"slug": "team-outings",
"version": "1.0.0",
"mode": "create_project",
"params": {
"brand_name": "Offsite Co"
},
"created_at": "…"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/templates" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/templates", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/http.go:493
List the draft's files
GET/api/dev/v1/projects/:id/files
The dev draft's files (or, with version, an applied version's), with rev, dirty (the draft differs from dev), the version it is based on, and kind (code for a code-first tree). content=1 adds every file's text: what appbricx pull reads.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Query parameters
| Name | Type | Description |
|---|---|---|
contentoptional | "1" | Include each file's text. |
versionoptional | number | An applied version instead of the draft. |
Response
{
"kind": "code",
"rev": 14,
"dirty": false,
"version": 9,
"dev_version": 9,
"behind": false,
"files": [
{
"path": "app.config.ts",
"size": 812,
"content": "import { defineApp } from \"@appbricx/define\"; …"
},
{
"path": "db/schema/booking.sql",
"size": 1404,
"content": "…"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files?content=1" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files?content=1", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:47
Diff files
GET/api/dev/v1/projects/:id/files/diff
Per-file unified diffs from a version (default the draft's base) to the draft, or to another version.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Query parameters
| Name | Type | Description |
|---|---|---|
fromoptional | number | A version (default the draft's base). |
tooptional | number | A version (default the draft). |
Response
{
"files": [
{
"path": "server/bookings.ts",
"status": "modified",
"diff": "@@ -6,7 +6,7 @@\n- roles: [\"ops\"],\n+ roles: [\"ops\", \"host\"],\n"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/diff?from=8" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/diff?from=8", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:48
Check the draft
POST/api/dev/v1/projects/:id/files/check
The draft's check report: SQL lint, strict TypeScript and the platform's lint rules, located file:line. Nothing changes.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Response
{
"report": {
"ok": false,
"errors": [
"routes/bookings.tsx:14: Property 'titel' does not exist on type 'BookingRow'. Did you mean 'title'?"
],
"warnings": []
},
"diagnostics": [
{
"file": "routes/bookings.tsx",
"line": 14,
"col": 22,
"severity": "error",
"message": "…"
}
]
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 409 | DRAFT_EMPTY | Nothing to check. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/check" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/check", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:49
Apply the draft
POST/api/dev/v1/projects/:id/files/apply
The draft becomes the next dev version: the database evolves with the plan's expand steps (rows kept), seeds run, routes and components build, workflows arm. Drops stay pending unless allow_destructive (dev is snapshotted first).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
allow_destructiveoptional | boolean | Also run the plan's drops. |
Response
{
"version": 10,
"report": {
"ok": true,
"errors": []
},
"appUrl": "https://dev-teamday.apps.appbricx.com",
"summary": {
"demo_logins": [
{
"role": "ops",
"email": "ops@demo.teamday.app"
}
]
},
"warnings": []
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 403 | FORBIDDEN_SCOPE | The token lacks the "apply" scope. |
| 422 | CONTRACT_INVALID | The draft doesn't check (report). |
| 409 | PROJECT_BUSY | An apply is running: retry. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/apply" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/apply", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:50
Drop the draft
POST/api/dev/v1/projects/:id/files/reset
Throw the draft away: it becomes the current dev version again.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Response
{
"rev": 20,
"dirty": false
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/reset" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/reset", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:51
Move a file
POST/api/dev/v1/projects/:id/files/move
Rename or move one file of the draft.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
pathrequired | string | From. |
torequired | string | To. |
revoptional | number | The draft revision you read. |
Response
{
"rev": 19,
"dirty": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 409 | DRAFT_CHANGED | Stale rev. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/move" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"path":"routes/bookings.tsx","to":"routes/bookings/index.tsx","rev":18}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/move", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"path": "routes/bookings.tsx",
"to": "routes/bookings/index.tsx",
"rev": 18
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:52
Write several files
POST/api/dev/v1/projects/:id/files
Write many files of the draft in one edit (what appbricx push sends).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
filesrequired | Record<path, text> | The files. |
revoptional | number | The draft revision you read. |
Response
{
"rev": 17,
"dirty": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 403 | FORBIDDEN_SCOPE | The token lacks the "apply" scope. |
| 409 | DRAFT_CHANGED | Stale rev. |
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"files":{"routes/index.tsx":"…","components/ExperienceCard.tsx":"…"},"rev":16}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files", {
method: "POST",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"files": {
"routes/index.tsx": "…",
"components/ExperienceCard.tsx": "…"
},
"rev": 16
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:54
Write and delete files
PUT/api/dev/v1/projects/:id/files
Write files and delete others in one edit (a path both written and deleted is 400).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
Body
| Name | Type | Description |
|---|---|---|
filesoptional | Record<path, text> | Files to write. |
deleteoptional | string[] | Paths to delete, after the writes. |
revoptional | number | The draft revision you read. |
Response
{
"rev": 18,
"dirty": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 400 | none | A path both written and deleted. |
| 409 | DRAFT_CHANGED | Stale rev. |
curl -X PUT "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"files":{"routes/bookings/index.tsx":"…"},"delete":["routes/bookings.tsx"],"rev":17}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files", {
method: "PUT",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"files": {
"routes/bookings/index.tsx": "…"
},
"delete": [
"routes/bookings.tsx"
],
"rev": 17
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:55
Read a file
GET/api/dev/v1/projects/:id/files/*
One file of the draft (or of version).
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: read
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
*required | string | The file's path, e.g. routes/bookings.tsx. |
Query parameters
| Name | Type | Description |
|---|---|---|
versionoptional | number | An applied version. |
Response
{
"path": "server/bookings.ts",
"content": "import { defineAction, v } from \"@appbricx/server\"; …",
"rev": 14
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 404 | FILE_NOT_FOUND | No such file. |
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/server/bookings.ts" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/server/bookings.ts", {
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:56
Write a file
PUT/api/dev/v1/projects/:id/files/*
Write one file of the draft. Nothing is live until apply.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
*required | string | The file's path. |
Body
| Name | Type | Description |
|---|---|---|
contentrequired | string | The whole file. |
revoptional | number | The draft revision you read; a newer draft is DRAFT_CHANGED. |
Response
{
"rev": 15,
"dirty": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 403 | FORBIDDEN_SCOPE | The token lacks the "apply" scope. |
| 409 | DRAFT_CHANGED | Someone wrote the draft since rev. |
curl -X PUT "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/db/access/booking.sql" \
-H "Authorization: Bearer $APPBRICX_TOKEN" \
-H "content-type: application/json" \
-d '{"content":"create policy booking_hr_read on booking for select using (hr_id = (select ctx.profile_id('hr')));","rev":14}'const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/db/access/booking.sql", {
method: "PUT",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
"content": "create policy booking_hr_read on booking for select using (hr_id = (select ctx.profile_id('hr')));",
"rev": 14
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:57
Delete a file
DELETE/api/dev/v1/projects/:id/files/*
Delete one file of the draft.
- Auth
- Developer token:
Authorization: Bearer $APPBRICX_TOKEN
Scope: apply
Path parameters
| Name | Type | Description |
|---|---|---|
:idrequired | string | The project id (uuid). |
*required | string | The file's path. |
Query parameters
| Name | Type | Description |
|---|---|---|
revoptional | number | The draft revision you read. |
Response
{
"rev": 16,
"dirty": true
}Errors
| Status | Code | When |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token. |
| 404 | none | "Project not found": the id is wrong or outside the token's reach. |
| 409 | DRAFT_CHANGED | Stale rev. |
| 404 | FILE_NOT_FOUND | No such file. |
curl -X DELETE "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/routes/old.tsx?rev=15" \
-H "Authorization: Bearer $APPBRICX_TOKEN"const res = await fetch("https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/routes/old.tsx?rev=15", {
method: "DELETE",
headers: {
Authorization: `Bearer ${APPBRICX_TOKEN}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(data.error?.message ?? data.error ?? res.statusText);Source: internal/svc/agentapi/transport/files.go:58