Developer HTTP API
The HTTP door to the same operations as the MCP server and the CLI. JSON in, JSON out.
Base URL and auth
https://appbricx.com/api/dev/v1
Authorization: Bearer apx_pat_...- Use an access token. Tokens work on
/dev/v1and/mcponly; they are never accepted by the rest of the Appbricx API (billing, admin, workspace settings). - The web app's signed-in session also works here, with every scope across all of the user's workspaces.
- Send
content-type: application/jsonon requests with a body.
Endpoints
"read" endpoints work with any valid token. Writing endpoints also need a non-viewer role in the project's workspace.
| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | /me | read | User, auth kind, scopes, workspaces |
| GET | /docs | read | The contract guide (text/markdown) |
| POST | /tokens | session only | Mint a token. A token can't mint another token (403 SESSION_REQUIRED) |
| GET | /tokens | read | Your active tokens (prefix, scopes, expiry, last used) |
| DELETE | /tokens/:id | read | Revoke one of your tokens |
| GET | /projects | read | Projects in reach, newest first (max 200) |
| POST | /projects | apply | Create a project: { name, description?, workspaceId? } |
| GET | /projects/:id | read | Build state and preview path |
| GET | /projects/:id/contract | read | { contract, built } |
| POST | /projects/:id/check | read | { contract } → { report }; no changes |
| POST | /projects/:id/apply | apply | { contract, force? } → build dev |
| POST | /projects/:id/patch | apply | { edits, dryRun?, force? } → typed edit ops |
| POST | /projects/:id/verify | read | { report } — static, data, browser |
| POST | /projects/:id/screenshot | read | { route?, as?, width?, height?, fullPage? } → PNG (base64 in JSON, or raw with ?format=png) |
| POST | /projects/:id/data/query | read | { table, where?, orderBy?, desc?, limit? } → dev rows (read-only, max 200) |
| GET | /projects/:id/logs | read | ?limit=&workflow= → workflow runs and notifications |
| POST | /projects/:id/deploy | deploy | { environment?, allowDestructive?, skipVerify? } → publish, verify-gated |
| POST | /components/check | read | { name, source, sample? } → run one component through every gate |
HTTP bodies use camelCase (dryRun, fullPage, skipVerify); the MCP tools use snake_case for the same fields. data/query also accepts entity in place of table.
Examples
export API=https://appbricx.com/api/dev/v1
export AUTH="Authorization: Bearer $APPBRICX_TOKEN"
export P=3f2c9a10-... # project idCheck
curl -sS -X POST "$API/projects/$P/check" -H "$AUTH" \
-H "content-type: application/json" \
-d "{\"contract\": $(cat appbricx.json)}"
# → { "report": { "ok": true, "errors": [], "fixes": [...], "warnings": [], "summary": {...} } }Apply
curl -sS -X POST "$API/projects/$P/apply" -H "$AUTH" \
-H "content-type: application/json" \
-d "{\"contract\": $(cat appbricx.json)}"
# → { "report": {...}, "summary": "... demo sign-ins per role ...", "warnings": [], "changed": true }Verify
curl -sS -X POST "$API/projects/$P/verify" -H "$AUTH"
# → { "report": { "status": "pass", "ms": 25000, "stages": [
# { "stage": "static", "status": "pass", "checks": [...] },
# { "stage": "data", "status": "pass", "checks": [...] },
# { "stage": "browser", "status": "pass", "checks": [...] } ] } }Each check has id, status, evidence and, when it fails, a fix. skipped is never a pass.
Screenshot
# The PNG itself
curl -sS -X POST "$API/projects/$P/screenshot?format=png" -H "$AUTH" \
-H "content-type: application/json" \
-d '{"route": "/jobs", "as": "technician"}' -o jobs.png
# JSON: png (base64), url, signedInAs, viewport, errors, overflowX, text
curl -sS -X POST "$API/projects/$P/screenshot" -H "$AUTH" \
-H "content-type: application/json" \
-d '{"as": "guest"}'as is a persona id, a demo login email or "guest". The default viewport is 390×844.
Errors
Errors are JSON with a message and, usually, a code:
{ "error": "This token lacks the \"deploy\" scope", "code": "FORBIDDEN_SCOPE" }| Status | Code | Meaning |
|---|---|---|
| 400 | — / BAD_REQUEST / BAD_QUERY | Validation failed (details lists fields) or a query names an unknown table or column |
| 401 | UNAUTHENTICATED | Missing, invalid, expired or revoked token, or the user left the token's workspace |
| 403 | FORBIDDEN_SCOPE | The token lacks the scope |
| 403 | SESSION_REQUIRED / INVALID_SCOPE | Token minting rules (see Access tokens) |
| 404 | — | Project not found, or outside the token's reach (never "forbidden") |
| 409 | PROJECT_BUSY | Another build is running; retry |
| 409 | HAND_EDITED_FILES | Compiled files were edited by hand; files lists them. Re-run with force: true to back them up and regenerate |
| 409 | NOT_BUILT | Nothing to screenshot yet; apply first |
| 422 | CONTRACT_INVALID | The contract can't be built; read report.errors |
| 422 | VERIFY_FAILED | Deploy refused because verify is red; report is included |
| 422 | SCREENSHOT_FAILED | The screenshot couldn't be taken (message says why) |
| 500 | BUILD_FAILED | The build failed at stage |