Developer API
Everything your agent does over MCP, as plain HTTP: create a project, write its files, check and apply, run verify, deploy, roll back and operate the running app. Use it from scripts and CI, or from any language. The CLI is a thin client of it.
When you would use it
- A CI job that applies, verifies and deploys on every merge.
- A script that sets up projects for clients from a template.
- Your own tools around Appbricx, in any language.
Your app's own API (its tables, actions and queries) is a different surface: see the data API.
Base URL and auth
https://appbricx.com/api/dev/v1 # self-hosted: https://<your platform host>/dev/v1
Authorization: Bearer apx_pat_…- A personal access token for one workspace, with the scopes it needs:
read(reads, checks, dry runs),apply(dev writes, secrets),deploy(production writes, deploys, rollbacks, restores, domains). See access tokens. - JSON in and out. A project outside the token's reach answers 404.
- Every write is in the workspace's audit log with the token as the actor.
From files to production
API=https://appbricx.com/api/dev/v1
H=(-H "Authorization: Bearer $APPBRICX_TOKEN" -H 'content-type: application/json')
# 1. a project from the code-first starter, built in dev
curl -sS -X POST "$API/templates/team-outings/use" "${H[@]}" \
-d '{"name": "Offsite Co", "params": {"brand_name": "Offsite Co"}}'
PROJECT=3b7e…
# 2. change files in the draft (rev from the last answer refuses a concurrent edit)
curl -sS -X POST "$API/projects/$PROJECT/files" "${H[@]}" \
-d '{"files": {"db/queries/bookings-by-status.sql": "-- @param status text\n-- @roles ops\nselect count(*)::int as n from booking where status = :status;"}}'
# 3. check, then apply to dev
curl -sS -X POST "$API/projects/$PROJECT/files/check" "${H[@]}"
curl -sS -X POST "$API/projects/$PROJECT/files/apply" "${H[@]}"
# 4. verify (a 202 "running" answer means: call again to join the run)
curl -sS -X POST "$API/projects/$PROJECT/verify" "${H[@]}" -d '{}'
# 5. read the plan, then deploy
curl -sS -X POST "$API/projects/$PROJECT/deploy/plan" "${H[@]}" -d '{"subdomain": "offsite"}'
curl -sS -X POST "$API/projects/$PROJECT/deploy" "${H[@]}" -d '{"subdomain": "offsite"}'Push a whole folder
If your client has a shell, push the tree with one request instead of sending files one by one (or pasting them into tool calls): stream a tar.gz (or a zip) of the folder that holds app.config.ts to PUT …/files/archive. The dev draft becomes exactly that tree in one edit; nothing is live until you apply.
tar -czf - --exclude=node_modules --exclude=.git -C ./myapp . \
| curl -sS -X PUT "$API/projects/$PROJECT/files/archive?then=check" \
-H "Authorization: Bearer $APPBRICX_TOKEN" -H 'content-type: application/gzip' --data-binary @-
# a zip works too
(cd myapp && zip -qr - . -x 'node_modules/*' '.git/*') \
| curl -sS -X PUT "$API/projects/$PROJECT/files/archive?then=apply" \
-H "Authorization: Bearer $APPBRICX_TOKEN" -H 'content-type: application/zip' --data-binary @-mode=replace(default) deletes draft files the archive doesn't have, exceptpackage.jsonandpackage-lock.jsonwhen the archive has neither (the answer lists them inkept);mode=mergeonly adds and replaces files.delete=path1,path2deletes those draft files in the same edit, in either mode (paths the draft doesn't have come back innot_in_draft). A.appbricx-deletefile at the archive's root, one path a line, does the same.then=checkanswers the check report (errors at file and line);then=applybuilds dev;rev=refuses the push if someone wrote the draft since.- Dot-files and folders (
.env,.git),node_modulesand binary files are left out and listed inskipped; files whose text didn't change aren't rewritten. A tree inside one folder (tar czf - myapp) works as well. Limits: 32 MiB compressed, 8 MiB of source, 2,000 files. - An agent signed in over MCP has no token in its shell: it calls
project_files { action: "upload_url" }, which answers a token (apx_upl_…) that works for 30 minutes on this route of this one project, and the ready-made command. See upload tokens.
Routes by task
Paths below are under the base URL; … is /projects/:id. Each has the same scope and answer as the MCP tool next to it. Bodies, answers and errors are in the build and operate references.
| Task | Routes | MCP tool |
|---|---|---|
| Tokens and you | GET /me · POST, GET /tokens · DELETE /tokens/:id | whoami |
| Projects | GET, POST /projects · GET /projects/:id | list_projects, create_project, get_project |
| Files (the dev draft) | GET /projects/:id/files (?content=1) · GET, PUT, DELETE …/files/<path> · POST, PUT …/files · PUT …/files/archive (a tar.gz or zip of the tree) · POST …/files/move, /reset | project_files, code |
| Check and apply | POST …/files/check · POST …/files/apply · POST …/check, /apply {files} · POST …/plan | check_contract, apply_contract |
| Versions | GET …/versions · …/versions/:n · …/versions/diff · …/versions/compare · POST …/versions/:n/restore · PUT …/versions/:n/label | versions |
| Previews | POST, GET …/previews · DELETE …/previews/:name | (appbricx push --preview) |
| Templates | GET /templates · GET /templates/:slug · POST /templates/:slug/use · POST /templates · DELETE /templates/:slug | search_templates, get_template, use_template, save_template |
| Test | POST …/verify · POST …/screenshot · POST …/check-code · POST …/workflows/:wid/run · GET …/runs/:runId | verify, screenshot, check_code, run |
| Ship | POST …/deploy/plan · POST …/deploy · GET …/deploys · POST …/deploys/:did/rollback | deploy, deploys |
| Data | POST …/data/query · POST …/sql · POST …/rows · GET …/schema · POST …/data/export, /import, /copy · GET …/data/exports | query_data, sql, edit_rows, describe_schema, data_transfer |
| Snapshots | GET, POST …/snapshots · POST …/snapshots/:sid/restore · POST …/snapshots/:sid/download | snapshots |
| Operate | GET …/logs · GET …/tail · GET …/dead-letters · POST …/dead-letters/replay | logs, tail, run |
| Settings | GET …/secrets · PUT, DELETE …/secrets/:name · GET, POST …/sign-in · POST …/app-users · GET …/roles | secrets, sign_in_providers, app_users, roles |
| Addresses | GET …/routing · GET, PUT …/routing/subdomain · POST …/domains · POST …/domains/:d/verify · PATCH, DELETE …/domains/:d | routing, domains |
In CI
# .github/workflows/appbricx.yml (a step)
- name: Apply and verify
env:
APPBRICX_API: https://appbricx.com/api/dev/v1
APPBRICX_TOKEN: ${{ secrets.APPBRICX_TOKEN }}
run: |
appbricx push "$PROJECT" . --apply | tee apply.json
jq -e '.report.ok' apply.json
curl -sS -X POST "$APPBRICX_API/projects/$PROJECT/verify" \
-H "Authorization: Bearer $APPBRICX_TOKEN" -H 'content-type: application/json' -d '{}'On pull requests, appbricx push "$PROJECT" . --preview gives each branch its own preview instead of touching the dev draft.
Errors
| Status | Code | What to do |
|---|---|---|
| 401 | UNAUTHENTICATED | No token, or an expired or revoked one. |
| 403 | FORBIDDEN_SCOPE | The token lacks the scope; mint one with it. |
| 404 | The project doesn't exist or is outside the token's workspace. | |
| 400 | BAD_ARCHIVE | The upload isn't a tar.gz, tar or zip, a path leaves the tree, or it has no project files. |
| 409 | DRAFT_CHANGED | Someone wrote the draft since your rev: read it again. |
| 409 | PROJECT_BUSY | An apply is running: retry. |
| 422 | CONTRACT_INVALID | The files don't check; the answer's report has each error at its file and line. |
| 428 | CONFIRM_REQUIRED | A production change needs dry_run: false (or confirm); the answer previews it. |
Every code the platform answers, with its fix, is in the guide's error catalogue: get_guide { section: "errors" }, or explain { about: "error", code } over MCP.