Access tokens for CI and scripts
An access token lets CI, a headless machine or a script act as you in one workspace, without your password. You choose what it may do (look, build, or also publish), how long it lasts, and you can switch it off at any moment. Tokens start with apx_pat_.
Do you need one?
Not for your agent: Claude Code, Claude, Cursor, Codex and other MCP clients sign in with the browser. They open Appbricx, you click Authorize, and they keep their own short-lived tokens. See the agent quickstart. Use an access token when:
- You use the CLI (
appbricx pullandpush). - An agent or a job runs in CI, or on a remote or headless machine, where no browser can open.
- You are calling the developer API from a script.
Why it matters: a token can't reach billing, admin or workspace settings, and it can't publish unless you give it the deploy scope. If one leaks, the damage is limited and you can revoke it straight away.
Create a token
- Open Workspace settings → Coding agents in the workspace your agent should build in.
- Name the token, pick its scopes and, optionally, an expiry.
- Copy the token. It is shown once. Appbricx stores only a hash and can't show it again.
For the CLI, set APPBRICX_API=https://appbricx.com/api/dev/v1 and APPBRICX_TOKEN=apx_pat_…. For an MCP client that can't open a browser, send it as Authorization: Bearer apx_pat_…. From a signed-in session you can also mint one with POST /api/dev/v1/tokens (name, workspaceId, scopes, expiresInDays).
Scopes
| Scope | Allows |
|---|---|
read | Projects and their files, checks, dry runs and plans, verify, screenshots, reading data, logs, the guide |
apply | Create projects, write files and apply them to dev, dev data writes, secrets, packages and assets |
deploy | Deploy, roll back, restore snapshots, production data writes, domains, moving production |
The default is read + apply: the agent can build and verify in dev but not publish. Add deploy only when you want the agent to ship. A call without the scope answers 403 FORBIDDEN_SCOPE.
Workspace binding
- A token belongs to one user and one workspace. It reaches only that workspace's projects; any other project answers "Project not found".
- It acts with your role. Writes need a non-viewer role in the workspace.
- A workspace viewer can only mint read tokens.
- If you are removed from the workspace, your tokens for it stop working at once.
Expiry
Set an expiry between 1 and 366 days, or none. An expired token answers 401 UNAUTHENTICATED ("Token expired"). Create a new one and update your agent's environment.
Where tokens work
- The MCP server (
/api/mcp) and the developer API (/api/dev/v1), which the CLI uses. - Nowhere else. A token can't reach billing, admin or workspace settings, so a leaked agent token can't change them.
- A token can't mint another token. Minting needs a signed-in session, so a token can never widen itself. (An upload token, below, is narrower than the token that asked for it, never wider.)
Tokens from browser sign-in
When an agent signs in with the browser, Appbricx gives it an access token that works the same way (same scopes, same workspace binding) but lasts one hour, plus a refresh token that lasts 90 days and changes every time it is used. Those agents are listed under Authorized agents on the same settings screen, not under your tokens. Revoking one ends both its tokens at once. If a refresh token is ever used twice, Appbricx assumes it was stolen and revokes that authorization.
Upload tokens: pushing a folder from an agent's shell
An agent signed in with the browser keeps its tokens inside the MCP client, so its shell has none. To push a whole project folder in one request (instead of pasting every file into tool calls), it calls project_files { action: "upload_url" }. The answer is a token starting with apx_upl_ and the command to run:
tar -czf - --exclude=node_modules --exclude=.git -C ./myapp . \
| curl -sS -X PUT "https://appbricx.com/api/dev/projects/<id>/files/archive?then=check" \
-H "Authorization: Bearer apx_upl_…" -H "Content-Type: application/gzip" --data-binary @-- It works for 30 minutes, for that one project, on that one route: replacing or adding to the dev draft's files, then checking or applying them. It can't read data, deploy or reach any other project or route.
- It carries at most the scopes of the token or sign-in that asked for it, and asking needs the
applyscope. Minting one is in the audit log. - It isn't stored, so it can't be listed or revoked; it simply expires (it keeps working until then even if the token that asked for it is revoked). Mint a new one for the next push.
- With a personal access token in the shell (
APPBRICX_TOKEN), use it on the same route directly; see the developer API.
Revoke a token
Revoke it in Workspace settings → Coding agents. It stops working on the next request. From a script:
# list your tokens (id, name, prefix, scopes, expiry, last used)
curl -sS https://appbricx.com/api/dev/v1/tokens \
-H "Authorization: Bearer $APPBRICX_TOKEN"
# revoke one
curl -sS -X DELETE https://appbricx.com/api/dev/v1/tokens/<token-id> \
-H "Authorization: Bearer $APPBRICX_TOKEN"The list shows each token's first characters (its prefix) and when it was last used, so you can tell which one to revoke.
Keep tokens safe
- Store the token in an environment variable (
APPBRICX_TOKEN) or a secret manager. In CI, use the CI's secret store. - Never commit a token. In a committed
.mcp.json, use the browser sign-in, or reference an environment variable your client expands instead of the token itself. - If you pasted a token into
claude mcp add --header …, it is saved in your local Claude Code config. Don't share that file. - Use one token per agent or machine, give it the smallest scopes it needs, and set an expiry.
- Revoke a token as soon as you think it leaked.