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.

38 endpointsHTTP API referenceGuide: Developer API guide

On this page
  1. Authentication
  2. Endpoints
  3. POST /tokens
  4. GET /tokens
  5. DELETE /tokens/:tokenId
  6. GET /me
  7. GET /docs
  8. GET /projects
  9. POST /projects
  10. GET /projects/:id
  11. GET /projects/:id/versions
  12. GET /projects/:id/versions/diff
  13. GET /projects/:id/versions/compare
  14. POST /projects/:id/versions/:n/restore
  15. PUT /projects/:id/versions/:n/label
  16. POST /projects/:id/plan
  17. POST /projects/:id/check-code
  18. GET /projects/:id/versions/:n
  19. POST /projects/:id/check
  20. POST /projects/:id/apply
  21. POST /projects/:id/previews
  22. GET /projects/:id/previews
  23. DELETE /projects/:id/previews/:name
  24. GET /templates
  25. POST /templates
  26. GET /templates/:slug
  27. DELETE /templates/:slug
  28. POST /templates/:slug/use
  29. GET /projects/:id/templates
  30. GET /projects/:id/files
  31. GET /projects/:id/files/diff
  32. POST /projects/:id/files/check
  33. POST /projects/:id/files/apply
  34. POST /projects/:id/files/reset
  35. POST /projects/:id/files/move
  36. POST /projects/:id/files
  37. PUT /projects/:id/files
  38. GET /projects/:id/files/*
  39. PUT /projects/:id/files/*
  40. 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

NameTypeDescription
namerequiredstringWhat it is for (ci, laptop).
workspaceIdrequireduuidThe workspace it reaches.
scopesoptionalArray<"read" | "apply" | "deploy">Default read and apply. A workspace viewer may mint read only.
expiresInDaysoptionalnumber1 to 366; omitted, it doesn't expire.

Response

201 Created.

Response
{
  "token": "apx_pat_…",
  "id": "t_1",
  "name": "ci",
  "workspaceId": "6c4ea024-…",
  "scopes": [
    "read",
    "apply",
    "deploy"
  ],
  "expiresAt": "2027-01-26T00:00:00Z"
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
403SESSION_REQUIREDCalled with a token, not a session.
400INVALID_SCOPEUnknown scope, or a viewer asking for more than read.
curl
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}'
fetch
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

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

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
curl
curl "https://appbricx.com/api/dev/v1/tokens" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:tokenIdrequiredstringThe token id.

Response

Response
{
  "revoked": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404noneNot one of your tokens.
curl
curl -X DELETE "https://appbricx.com/api/dev/v1/tokens/t_1" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

Response
{
  "user": {
    "id": "96f4…",
    "email": "dev@example.com"
  },
  "scopes": [
    "read",
    "apply",
    "deploy"
  ],
  "workspaces": [
    {
      "id": "6c4ea024-…",
      "name": "Acme",
      "role": "owner"
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
curl
curl "https://appbricx.com/api/dev/v1/me" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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.

Response
## Code-first: TypeScript and SQL files (every new app)
…

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
curl
curl "https://appbricx.com/api/dev/v1/docs" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

Response
{
  "projects": [
    {
      "id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
      "name": "Teamday",
      "slug": "teamday",
      "workspace_id": "6c4ea024-…",
      "updated_at": "…"
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
curl
curl "https://appbricx.com/api/dev/v1/projects" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
namerequiredstring1 to 100 characters.
descriptionoptionalstringUp to 2000 characters.

Response

Response
{
  "project": {
    "id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
    "name": "Teamday",
    "slug": "teamday",
    "workspaceId": "6c4ea024-…"
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
403FORBIDDEN_SCOPEThe token lacks the "apply" scope.
curl
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"}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Response

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

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Query parameters

NameTypeDescription
envoptional"dev" | "prod"Default dev.
limitoptionalnumberPage size.
beforeoptionalnumberOlder than this version.

Response

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

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Query parameters

NameTypeDescription
fromrequirednumberA version.
torequirednumberA version.

Response

Response
{
  "from": 8,
  "to": 10,
  "changes": {
    "files": [
      "server/bookings.ts",
      "db/access/booking.sql"
    ]
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/diff?from=8&to=10" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Query parameters

NameTypeDescription
fromoptionalstringdev, prod or a number (default prod).
tooptionalstringDefault dev.

Response

Response
{
  "from": "prod",
  "to": "dev",
  "changes": {
    "files": [
      "server/bookings.ts"
    ],
    "access": [],
    "bundle": [
      {
        "route": "/bookings",
        "gzip_before": 18211,
        "gzip_after": 18904
      }
    ]
  },
  "schema": {
    "expand": [],
    "contract": []
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
409NOT_DEPLOYEDprod before a release.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/compare?from=prod&to=dev" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
:nrequiredstringThe version number.

Body

NameTypeDescription
dryRunoptionalbooleanDefault true.

Response

Response
{
  "restored": true,
  "version": 11
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
404VERSION_NOT_FOUNDNo such version.
curl
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}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
:nrequiredstringThe version number.

Body

NameTypeDescription
labelrequiredstringThe label; empty clears it.

Response

Response
{
  "version": {
    "n": 9,
    "label": "launch",
    "hash": "…",
    "createdAt": "…"
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
404VERSION_NOT_FOUNDNo such version.
curl
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"}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
envoptional"dev" | "prod"Which database to plan against (default dev).

Response

Response
{
  "report": {
    "ok": true
  },
  "plan": {
    "env": "prod",
    "mode": "sql",
    "expand": [
      {
        "sql": "alter table booking add column notes text"
      }
    ],
    "contract": [],
    "drift": []
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
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"}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
kindrequired"component" | "function" | "step" | "rule"What it is.
sourcerequiredstringThe code.
sampleoptionalobjectcomponent: props to render with.

Response

Response
{
  "ok": true,
  "kind": "component",
  "stages": [
    {
      "name": "static",
      "status": "pass"
    },
    {
      "name": "types",
      "status": "pass"
    },
    {
      "name": "compile",
      "status": "pass"
    },
    {
      "name": "render",
      "status": "pass"
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
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 />; }"}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
:nrequiredstringThe version number.

Response

Response
{
  "version": {
    "n": 9,
    "label": "launch",
    "hash": "…",
    "createdAt": "…"
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
404VERSION_NOT_FOUNDNo such version.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/versions/9" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
filesoptionalRecord<path, text>The tree to check.

Response

Response
{
  "report": {
    "ok": true,
    "errors": [],
    "warnings": []
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
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":"…"}}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
filesoptionalRecord<path, text>The tree.
allow_destructiveoptionalbooleanAlso run the plan's drops.

Response

Response
{
  "report": {
    "ok": true,
    "errors": []
  },
  "appUrl": "https://dev-teamday.apps.appbricx.com",
  "warnings": []
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
403FORBIDDEN_SCOPEThe token lacks the "apply" scope.
422CONTRACT_INVALIDDoesn't check.
409PROJECT_BUSYAn apply is running.
curl
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":"…"}}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
namerequiredstringa-z, 0-9 and dashes, at most 30 (the branch).
filesrequiredRecord<path, text>The tree.

Response

Response
{
  "preview": {
    "name": "feature-teaser",
    "env": "pv-feature-teaser",
    "url": "https://preview-feature-teaser--teamday.apps.appbricx.com"
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
403FORBIDDEN_SCOPEThe token lacks the "apply" scope.
curl
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":"…"}}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Response

Response
{
  "previews": [
    {
      "name": "feature-teaser",
      "url": "https://preview-feature-teaser--teamday.apps.appbricx.com",
      "updated_at": "…"
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
:namerequiredstringThe preview's name.

Response

Response
{
  "deleted": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl -X DELETE "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/previews/feature-teaser" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
queryoptionalstringWords.
kindoptional"app" | "block" | "workflow" | "component"Only one kind.
categoryoptionalstringbookings, payments, teams…
limitoptionalnumberPage size.

Response

Response
{
  "templates": [
    {
      "slug": "team-outings",
      "kind": "app",
      "title": "Team outings (code-first)",
      "params": [
        "brand_name",
        "tagline"
      ]
    }
  ],
  "total": 1
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
curl
curl "https://appbricx.com/api/dev/v1/templates?query=bookings&kind=app" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
project_idrequireduuidThe project.
namerequiredstringThe template's name.
descriptionoptionalstringWhat it is.
include_seedsoptionalbooleanCarry the seed rows.

Response

Response
{
  "template": {
    "slug": "acme-intake",
    "kind": "app",
    "private": true
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
403PLAN_REQUIREDThe plan has no private templates.
409JSON_RETIREDThe project is still a JSON contract.
curl
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}'
fetch
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

NameTypeDescription
:slugrequiredstringThe template's slug.

Response

Response
{
  "template": {
    "slug": "team-outings",
    "kind": "app",
    "params": [
      {
        "name": "brand_name",
        "default": "Teamday"
      }
    ]
  }
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404noneNo such template.
curl
curl "https://appbricx.com/api/dev/v1/templates/team-outings" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:slugrequiredstringThe template's slug.

Response

Response
{
  "deleted": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404noneNo such template in your workspaces.
curl
curl -X DELETE "https://appbricx.com/api/dev/v1/templates/acme-intake" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:slugrequiredstringThe template's slug.

Body

NameTypeDescription
nameoptionalstringThe new project's name.
paramsoptionalobjectThe template's params.
project_idoptionaluuidAn empty project to build into.
dry_runoptionalbooleanCheck only.

Response

Response
{
  "applied": true,
  "created": true,
  "template": "team-outings",
  "project": {
    "id": "3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b",
    "name": "Offsite Co",
    "slug": "offsite-co"
  },
  "environment": "dev"
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
409PROJECT_HAS_APPThe project already has an app.
422TEMPLATE_PARAMSA param doesn't fit its pattern.
410TEMPLATE_RETIREDA block, workflow or component template.
curl
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"}}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Response

Response
{
  "installs": [
    {
      "slug": "team-outings",
      "version": "1.0.0",
      "mode": "create_project",
      "params": {
        "brand_name": "Offsite Co"
      },
      "created_at": "…"
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/templates" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Query parameters

NameTypeDescription
contentoptional"1"Include each file's text.
versionoptionalnumberAn applied version instead of the draft.

Response

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

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files?content=1" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Query parameters

NameTypeDescription
fromoptionalnumberA version (default the draft's base).
tooptionalnumberA version (default the draft).

Response

Response
{
  "files": [
    {
      "path": "server/bookings.ts",
      "status": "modified",
      "diff": "@@ -6,7 +6,7 @@\n-  roles: [\"ops\"],\n+  roles: [\"ops\", \"host\"],\n"
    }
  ]
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/diff?from=8" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Response

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

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
409DRAFT_EMPTYNothing to check.
curl
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/check" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
allow_destructiveoptionalbooleanAlso run the plan's drops.

Response

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

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
403FORBIDDEN_SCOPEThe token lacks the "apply" scope.
422CONTRACT_INVALIDThe draft doesn't check (report).
409PROJECT_BUSYAn apply is running: retry.
curl
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 '{}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Response

Response
{
  "rev": 20,
  "dirty": false
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
curl
curl -X POST "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/reset" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
pathrequiredstringFrom.
torequiredstringTo.
revoptionalnumberThe draft revision you read.

Response

Response
{
  "rev": 19,
  "dirty": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
409DRAFT_CHANGEDStale rev.
curl
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}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
filesrequiredRecord<path, text>The files.
revoptionalnumberThe draft revision you read.

Response

Response
{
  "rev": 17,
  "dirty": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
403FORBIDDEN_SCOPEThe token lacks the "apply" scope.
409DRAFT_CHANGEDStale rev.
curl
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}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).

Body

NameTypeDescription
filesoptionalRecord<path, text>Files to write.
deleteoptionalstring[]Paths to delete, after the writes.
revoptionalnumberThe draft revision you read.

Response

Response
{
  "rev": 18,
  "dirty": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
400noneA path both written and deleted.
409DRAFT_CHANGEDStale rev.
curl
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}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
*requiredstringThe file's path, e.g. routes/bookings.tsx.

Query parameters

NameTypeDescription
versionoptionalnumberAn applied version.

Response

Response
{
  "path": "server/bookings.ts",
  "content": "import { defineAction, v } from \"@appbricx/server\"; …",
  "rev": 14
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
404FILE_NOT_FOUNDNo such file.
curl
curl "https://appbricx.com/api/dev/v1/projects/3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b/files/server/bookings.ts" \
  -H "Authorization: Bearer $APPBRICX_TOKEN"
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
*requiredstringThe file's path.

Body

NameTypeDescription
contentrequiredstringThe whole file.
revoptionalnumberThe draft revision you read; a newer draft is DRAFT_CHANGED.

Response

Response
{
  "rev": 15,
  "dirty": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
403FORBIDDEN_SCOPEThe token lacks the "apply" scope.
409DRAFT_CHANGEDSomeone wrote the draft since rev.
curl
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}'
fetch
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

NameTypeDescription
:idrequiredstringThe project id (uuid).
*requiredstringThe file's path.

Query parameters

NameTypeDescription
revoptionalnumberThe draft revision you read.

Response

Response
{
  "rev": 16,
  "dirty": true
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing, invalid, expired or revoked token.
404none"Project not found": the id is wrong or outside the token's reach.
409DRAFT_CHANGEDStale rev.
404FILE_NOT_FOUNDNo such file.
curl
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"
fetch
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