GET /servers
List servers
Responses:
200The caller's servers.401Missing or invalid API key.
| Name | Type | Required | Description |
|---|---|---|---|
servers | Server[] | yes |
Version 0.1.0. Base URL: https://api.server4agent.com. Every request authenticates with Authorization: Bearer sk_live_..., and every request with a body sends Content-Type: application/json.
REST API for Server4Agent: provision servers, run agent tasks and builds, manage projects and files, and subscribe to webhooks. This is the code *around* your agent (your backend, a CI job, a webhook receiver). If your agent itself does tool-calling, point it at the MCP server instead. Authenticate every request with an sk_live_ API key as a bearer token: Authorization: Bearer sk_live_.... Keys are server-side secrets, so never ship them in a browser bundle. Scoped keys can access only their explicitly allowed servers and projects. Account-level operations such as creating servers, managing keys, and managing webhooks require an account-wide key.
Also available as Markdown and as the OpenAPI spec. Guides: REST API, Examples.
Sized compute boxes. Multiple projects share a server's resources.
GET /serversList servers
Responses:
200 The caller's servers.401 Missing or invalid API key.| Name | Type | Required | Description |
|---|---|---|---|
servers | Server[] | yes |
POST /serversProvision a server
No plan field: the allowed tiers and limits come from the account behind the key.
| Name | Type | Required | Description |
|---|---|---|---|
task | string | no | |
tier | small | medium | large | no | |
kind | standard | browser | no | Defaults to standard. |
region | us | eu | se | no | Where the server runs, fixed once it exists. us (United States) is the default. eu runs the server, its files and its apps in Europe, in Germany, and se in Europe, in Sweden. Asia is not open yet and is refused rather than placed somewhere else. |
secrets | SecretInput[] | no | Server-wide environment variables to set and bind, shared by all projects on the server. |
Responses:
201 The provisioned server.400 The request was malformed.401 Missing or invalid API key.403 The key is scoped, or the account's plan does not allow the requested server.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
url | string, nullable | no | |
status | running | sleeping | building | yes | |
tier | small | medium | large | yes | |
kind | standard | browser | no | What kind of box a server is, orthogonal to its tier. standard is headless. browser adds a screen with a browser on it, so a run can drive sites that need a real one. A browser box costs more to run and needs a plan that allows the medium tier. |
GET /servers/{serverId}Get a server
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 The server.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
server | Server | yes |
PATCH /servers/{serverId}Rename or relocate a server
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
task | string | no | |
region | us | eu | se | no | A server cannot change region, so only the one it is in is accepted. To run somewhere else, create a server there. |
Responses:
200 The updated server.400 The request was malformed.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
server | Server | yes |
DELETE /servers/{serverId}Delete a server
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 Deleted.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deleted | true | yes |
POST /servers/{serverId}/actionsStart, stop, or restart a server
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
action | start | stop | restart | yes |
Responses:
200 The server's new state.400 The request was malformed.401 Missing or invalid API key.404 No such resource.502 The compute backend returned an error.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
status | running | sleeping | building | yes |
POST /servers/{serverId}/execRun a shell command on the server
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
command | string | yes | |
project_id | string | no | Optional. Run the command inside this project's workspace folder instead of the server workspace root. The project must live on this server. |
Responses:
200 Command output.400 The request was malformed.401 Missing or invalid API key.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
stdout | string | yes |
Give the on-server agent a goal; it plans, writes code, runs it, and can deploy.
GET /servers/{serverId}/tasksList a server's tasks
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 Tasks.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
tasks | Task[] | yes |
POST /servers/{serverId}/tasksGive the agent a goal
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
goal | string | yes | |
project_id | string | no | Optional. Run in this project's workspace folder. Omit to run at the server workspace root. The project must live on this server. Not needed with follow_up_of, which runs where the earlier task did. |
follow_up_of | string | no | Optional. The id of an earlier task on this server to continue. Without it every task starts a new conversation. With it the agent picks up that task's conversation, in the same folder and project, so it remembers what it did. Use it to answer a task that is awaiting_input or to ask for changes to what a task built. |
Responses:
201 The created task.400 The request was malformed.401 Missing or invalid API key.402 Authorized, but the account is out of budget (credits/cap reached).404 No such resource.409 The server is paused (server_paused), or the follow_up_of task's project is paused (project_paused).| Name | Type | Required | Description |
|---|---|---|---|
task_id | string | yes | |
status | running | completed | failed | awaiting_input | cancelled | yes | |
project_id | string, nullable | no | |
follow_up_of | string | no | Present when the task continues an earlier one. |
resumed | boolean | no | Present on a follow-up. False when the earlier task left no conversation to pick up: the agent then works in the same folder without that memory. |
GET /servers/{serverId}/tasks/{taskId}Get a task
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
taskId (path) | string | yes |
Responses:
200 The task.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
task | Task | yes |
Structured build pipeline (plan → scaffold → implement → install → build → deploy).
GET /servers/{serverId}/buildsList a server's builds
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 Builds.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
builds | Build[] | yes |
POST /servers/{serverId}/buildsStart a build pipeline
Starts an agent run on the server that plans, scaffolds, writes, installs, builds and starts what the goal describes. Poll getBuild for the result; it counts against the AI budget like any run.
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
goal | string | yes |
Responses:
201 The started build.400 The request was malformed.401 Missing or invalid API key.402 Authorized, but the account is out of budget (credits/cap reached).404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
build_id | string | yes | |
status | queued | running | completed | yes | |
steps | BuildStep[] | yes |
GET /servers/{serverId}/builds/{buildId}Get a build
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
buildId (path) | string | yes |
Responses:
200 The build.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
build | Build | yes |
Log-file tails from a server's background processes. Every long-running process a project starts appends to a log file in its workspace; the latest tails are captured after each task.
GET /servers/{serverId}/logsGet a server's log tails
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
project_id (query) | string | no | Only log files from this project's workspace folder. |
lines (query) | integer | no | Max tail lines per file. |
Responses:
200 The latest log snapshot, or null when the server has not reported one yet.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
logs | LogsSnapshot | yes |
Read and write files in a server's workspace.
GET /servers/{serverId}/filesList files, or read one with ?path=
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
path (query) | string | no | When set, returns that file's content instead of the file list. |
Responses:
200 A file listing, or a single file's content.401 Missing or invalid API key.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.PUT /servers/{serverId}/filesWrite a file
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
path | string | yes | |
content | string | yes | |
encoding | utf8 | base64 | no | Set to base64 to upload binary content (e.g. a .zip to use as an archive project source) without corrupting the bytes. |
Responses:
201 Written.400 The request was malformed.401 Missing or invalid API key.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.413 The content is larger than a single write carries.500 The workspace ran the write and refused it (out of disk space, the path is a folder).503 The write never reached the server. Safe to retry once it is awake.| Name | Type | Required | Description |
|---|---|---|---|
path | string | yes | |
written | true | yes |
DELETE /servers/{serverId}/filesDelete a file
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
path (query) | string | yes |
Responses:
200 Deleted.400 The request was malformed.401 Missing or invalid API key.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
path | string | yes | |
deleted | true | yes |
GET /servers/{serverId}/files/download-urlMint a signed download link for one file
Returns a signed, expiring link to exactly one file in the server's workspace. Anyone holding the link can download that file without an API key until it expires, so share it like a password. Platform files are refused.
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
path (query) | string | yes | Workspace path of the file, e.g. report.xlsx. |
ttl_seconds (query) | number | no | How long the link stays valid. Defaults to 24 hours, capped at 7 days. |
Responses:
200 The signed link.400 The request was malformed.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
path | string | yes | |
url | string (uri) | yes | |
expires_at | string (date-time) | yes |
Record a deployment against a server. It starts nothing: a project serves at its own URL once it is public and something inside it is running and listening for HTTP.
GET /servers/{serverId}/deploymentsList a server's public projects
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 Deployments.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
deployments | Deployment[] | yes |
POST /servers/{serverId}/deploymentsPut a running project online
Checks that something in the project is listening on its listen port, makes the project public, and waits for its URL to answer. It builds and starts nothing: when nothing is listening it answers 409 and leaves the project as it was. Without project_id, a server with exactly one project deploys that one.
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | no | The project to deploy. Optional when the server has exactly one project. |
Responses:
201 The project is public. status is live when its URL answered, and publishing when it had not answered yet.400 The request was malformed.401 Missing or invalid API key.402 Authorized, but the account is out of budget (credits/cap reached).404 No such resource.409 Nothing to deploy: the server has no project (no_project), nothing is listening on the project's port (not_listening), or the server is paused (server_paused).502 The compute backend returned an error.| Name | Type | Required | Description |
|---|---|---|---|
url | string (uri) | yes | |
status | live | publishing | yes | |
project_id | string | no |
A workspace + app inside a server, with its own slug and public URL. A project's workspace can be seeded from a source (blank, a named template, a git repo, or an uploaded archive), then initialized: the on-server agent installs dependencies, starts the app, and confirms the service is up.
GET /servers/{serverId}/projectsList a server's projects
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 Projects on the server.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
projects | Project[] | yes |
POST /servers/{serverId}/projectsCreate a project on a server
Defaults to private; pass visibility=public to expose its URL. Pass a source to seed the workspace from a template, a git repo, or an uploaded archive. When the source carries code (git/archive) and auto_init is true (the default for those sources), the response includes an init_run_id: the on-server agent seeds the workspace, installs dependencies, starts the app, and confirms the service is up. Poll the project's init_phase until it is ready or failed.
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
name | string | no | |
description | string | no | |
visibility | public | private | no | |
access | public | team | password | no | Who may open a public project's URL. public is anyone with the link, which is how every project behaved before this field existed. team requires the visitor to sign in to Server4Agent and be a member of the account that owns the project. password asks the visitor for a password the owner set with access_password, and needs no account. No effect while the project is private, since there is no URL to gate. |
access_password | string | no | The password visitors enter when access is password, which requires it. Stored encrypted and never returned. Rejected with 400 alongside any other access. |
lifecycle | persistent | ephemeral | no | |
source | ProjectSource | no | Where to seed the workspace from. Omit for a blank project. A git or archive source carries your own code to install and run. |
auto_init | boolean | no | Dispatch bring-up (seed, install, start, confirm it answers) immediately on create. Defaults to true when source carries code (git/archive), false otherwise. When true, the response carries an init_run_id. |
secrets | SecretInput[] | no | Project-scoped environment variables to set and bind (only this project's runs see them). Provide known values up front so bring-up doesn't pause at awaiting_secrets for keys the code requires. |
template | string | no | Shorthand for source: { kind: template, template: <id> }, using a template id from listTemplates. Ignored if source is also given. |
Responses:
201 The created project.400 The request was malformed.401 Missing or invalid API key.403 The account hit a plan limit (e.g. a tier's project cap).404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
server_id | string | yes | |
name | string | yes | |
slug | string | yes | |
description | string, nullable | no | |
visibility | public | private | yes | |
access | public | team | password | no | Who may open a public project's URL. public is anyone with the link, which is how every project behaved before this field existed. team requires the visitor to sign in to Server4Agent and be a member of the account that owns the project. password asks the visitor for a password the owner set with access_password, and needs no account. No effect while the project is private, since there is no URL to gate. |
lifecycle | persistent | ephemeral | yes | |
runtime_status | unbuilt | running | paused | yes | Pause/resume state of a built project. Distinct from init_phase: a project runs through init_phase from creation to its first ready, after which runtime_status governs whether its processes are running or paused. |
source | ProjectSource | no | How this project's workspace was seeded. Absent for legacy projects created before sources existed. |
init_phase | seeding | awaiting_plan | awaiting_secrets | installing | starting | ready | failed | no | Bring-up progress; absent once the project is a long-lived running app (see runtime_status) or for an unbuilt blank project. |
run_plan | RunPlan | no | How bring-up installs and starts this project, or null when no plan has been settled yet. A plan whose port is null means the project is not a server. |
template | string, nullable | no | Convenience mirror of source.template when the source is a named template. Kept for backward compatibility; prefer source. |
url | string, nullable | no | Live URL, or null while the project is private. |
created_at | string (date-time) | yes | |
updated_at | string (date-time) | yes | |
init_run_id | string, nullable | no | The bring-up run dispatched for this project when auto_init ran. Poll it like any task; null when no bring-up was dispatched (blank project, or auto_init=false). |
POST /servers/{serverId}/projects/importImport a project from an export bundle
Recreates a project on this server from a bundle that POST /projects/{projectId}/export produced, on this deployment or on another one. The bundle decides the project's name, description, lifecycle, link access and run plan; it never decides anything that would act on its own, so the project lands private with its own slug and URL regardless of what the original was. Environment variables the bundle names are bound only where this account already holds a value for them, because a bundle carries names and never values: missing_env lists what still has to be set here with PUT /secrets before the app can run. Bring-up always starts, because the bundle only reaches the server as part of that run; the response carries its init_run_id. Pass the bundle in one of two ways. Base64 in bundle travels in the request body, so the platform's request size limit holds it to about 3 MB. A bundle exported on this deployment can instead be passed as the url its export returned, in bundle_url, which carries bundles up to 25 MB. Larger bundles from another deployment can be uploaded from the dashboard, which takes up to 25 MB too.
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
bundle | string (byte) | no | The export file, base64 encoded. Pass this or bundle_url. |
bundle_url | string (uri) | no | The download link an export on this deployment returned, while it is still valid. Pass this or bundle. |
name | string | no | Name the project here. Defaults to the name in the bundle. |
Responses:
201 The imported project.400 The request was malformed.401 Missing or invalid API key.402 Out of AI credits. An import needs a bring-up run to unpack its files, so nothing was created.403 The account hit a plan limit (e.g. a tier's project cap).404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
imported_from | string, nullable | no | The deployment the bundle was exported from, as its manifest recorded it. |
exported_at | string (date-time) | no | When the bundle was built. |
bound_env | string[] | no | Variables the bundle named that this account already had a value for. |
missing_env | string[] | no | Variables the bundle named that still need a value here. Set them with PUT /secrets before the app can run. |
warnings | string[] | no | Things the bundle asked for that this deployment could not honour. Not failures: the import succeeded, and each of these would otherwise only surface later as unexplained behaviour. |
GET /projectsList every project across the caller's servers
Responses:
200 Projects.401 Missing or invalid API key.| Name | Type | Required | Description |
|---|---|---|---|
projects | Project[] | yes |
GET /projects/{projectId}Get a project
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
Responses:
200 The project.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
server_id | string | yes | |
name | string | yes | |
slug | string | yes | |
description | string, nullable | no | |
visibility | public | private | yes | |
access | public | team | password | no | Who may open a public project's URL. public is anyone with the link, which is how every project behaved before this field existed. team requires the visitor to sign in to Server4Agent and be a member of the account that owns the project. password asks the visitor for a password the owner set with access_password, and needs no account. No effect while the project is private, since there is no URL to gate. |
lifecycle | persistent | ephemeral | yes | |
runtime_status | unbuilt | running | paused | yes | Pause/resume state of a built project. Distinct from init_phase: a project runs through init_phase from creation to its first ready, after which runtime_status governs whether its processes are running or paused. |
source | ProjectSource | no | How this project's workspace was seeded. Absent for legacy projects created before sources existed. |
init_phase | seeding | awaiting_plan | awaiting_secrets | installing | starting | ready | failed | no | Bring-up progress; absent once the project is a long-lived running app (see runtime_status) or for an unbuilt blank project. |
run_plan | RunPlan | no | How bring-up installs and starts this project, or null when no plan has been settled yet. A plan whose port is null means the project is not a server. |
template | string, nullable | no | Convenience mirror of source.template when the source is a named template. Kept for backward compatibility; prefer source. |
url | string, nullable | no | Live URL, or null while the project is private. |
created_at | string (date-time) | yes | |
updated_at | string (date-time) | yes |
PATCH /projects/{projectId}Rename, redescribe, toggle visibility/lifecycle, or correct the run plan
The slug and URL stay the same across visibility toggles. A run_plan here is recorded for the next bring-up, not acted on, so correcting a wrong start command never restarts a working project.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
name | string | no | |
description | string | no | |
visibility | public | private | no | |
access | public | team | password | no | Who may open a public project's URL. public is anyone with the link, which is how every project behaved before this field existed. team requires the visitor to sign in to Server4Agent and be a member of the account that owns the project. password asks the visitor for a password the owner set with access_password, and needs no account. No effect while the project is private, since there is no URL to gate. |
access_password | string | no | Sets or changes the password for access password. Required when switching to password unless one is already set; sent on its own, it changes the password and signs out everyone who used the old one. Switching to any other access discards the password. Stored encrypted and never returned. |
lifecycle | persistent | ephemeral | no | |
run_plan | RunPlan | no | Replaces the stored plan wholesale, so send every field you want kept. Recorded for the next bring-up rather than acted on: POST /projects/{projectId}/init is how you ask for the rebuild. Rejected with 400 if neither install nor start is set. |
Responses:
200 The updated project.400 The request was malformed.401 Missing or invalid API key.403 The account hit a plan limit (e.g. a tier's project cap).404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
server_id | string | yes | |
name | string | yes | |
slug | string | yes | |
description | string, nullable | no | |
visibility | public | private | yes | |
access | public | team | password | no | Who may open a public project's URL. public is anyone with the link, which is how every project behaved before this field existed. team requires the visitor to sign in to Server4Agent and be a member of the account that owns the project. password asks the visitor for a password the owner set with access_password, and needs no account. No effect while the project is private, since there is no URL to gate. |
lifecycle | persistent | ephemeral | yes | |
runtime_status | unbuilt | running | paused | yes | Pause/resume state of a built project. Distinct from init_phase: a project runs through init_phase from creation to its first ready, after which runtime_status governs whether its processes are running or paused. |
source | ProjectSource | no | How this project's workspace was seeded. Absent for legacy projects created before sources existed. |
init_phase | seeding | awaiting_plan | awaiting_secrets | installing | starting | ready | failed | no | Bring-up progress; absent once the project is a long-lived running app (see runtime_status) or for an unbuilt blank project. |
run_plan | RunPlan | no | How bring-up installs and starts this project, or null when no plan has been settled yet. A plan whose port is null means the project is not a server. |
template | string, nullable | no | Convenience mirror of source.template when the source is a named template. Kept for backward compatibility; prefer source. |
url | string, nullable | no | Live URL, or null while the project is private. |
created_at | string (date-time) | yes | |
updated_at | string (date-time) | yes |
DELETE /projects/{projectId}Delete a project
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
Responses:
200 Deleted.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deleted | true | yes |
POST /projects/{projectId}/cleanupTear down an ephemeral project's runtime
Ephemeral projects only. Use delete for persistent ones.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
Responses:
200 Cleaned up.400 The request was malformed.401 Missing or invalid API key.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
cleaned | true | yes |
POST /projects/{projectId}/startStart a project's app and keep it running
Runs command in the project folder as a background process with PORT set to the project's routed port, records it so a server restart starts it again, and waits about 10 seconds for it to answer. The app must listen on PORT. A project's URL serves only while something listens there and the project is public. Starting again with the same name replaces the earlier process. Name a second process (a worker, a scheduler) to run it beside the web app; only web serves the URL.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
command | string | yes | The shell command that starts the app, e.g. node server.js. |
name | string | no | Process name. Defaults to web, the process that serves the URL. |
Responses:
200 Started. status is starting while the web app has not answered yet.400 The request was malformed.401 Missing or invalid API key.404 No such resource.409 The app could not be started (error is app_failed, with the last output in log_tail), or the project cannot run one right now (paused, no_port, unsupported, failed).| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | yes | |
name | string | yes | |
status | running | starting | yes | |
listening | boolean | yes | |
listen_port | integer, nullable | no | |
url | string, nullable | no | The project's URL when it is public, otherwise null. |
visibility | public | private | no | |
access | public | team | password | no | Who may open a public project's URL. public is anyone with the link, which is how every project behaved before this field existed. team requires the visitor to sign in to Server4Agent and be a member of the account that owns the project. password asks the visitor for a password the owner set with access_password, and needs no account. No effect while the project is private, since there is no URL to gate. |
replaced_previous | boolean | no | |
restart_command | string | yes | What a server restart runs to bring this process back. |
log_tail | string, nullable | no |
POST /projects/{projectId}/initStart or resume a project's bring-up
Kicks off bring-up for a project that wasn't auto-initialized, or resumes one paused at awaiting_secrets. Pass proceed: true to continue past still-missing (optional) secrets instead of waiting.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
proceed | boolean | no | Continue bring-up even if some discovered secrets are still unset. |
Responses:
201 Bring-up dispatched.400 The request was malformed.401 Missing or invalid API key.402 Authorized, but the account is out of budget (credits/cap reached).404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
init_run_id | string, nullable | no | |
init_phase | seeding | awaiting_plan | awaiting_secrets | installing | starting | ready | failed | yes |
POST /projects/{projectId}/exportExport a project to a portable bundle
Packages the project into one file and returns a time-limited link to it. The bundle carries the source tree, the project's settings, its run plan, and the NAMES of the environment variables it reads. Left out: dependency caches, git history, and any .env or credential file in the workspace, so the bundle never carries a secret value; a credential embedded in the project's own source URL is stripped too. Feed the file to POST /servers/{serverId}/projects/import, on this deployment or on another one. The link needs no credentials, so treat it as the code itself.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
ttl_seconds | number | no | How long the link stays valid. Defaults to 24 hours, capped at 7 days. |
Responses:
201 The bundle, and where to fetch it.400 The request was malformed.401 Missing or invalid API key.404 No such resource.409 The server (or the project) is paused, so nothing runs on it until it is resumed from the dashboard.| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | no | |
url | string (uri) | yes | |
expires_at | string (date-time) | yes | |
filename | string | yes | |
bytes | integer (int64) | yes | |
env | string[] | yes | Names of the environment variables the project reads. Whoever imports the bundle has to supply the values. |
Starter sources for new projects: named recipes the agent follows, plus the git and archive sources that carry your own code to run.
GET /templatesList project templates
Responses:
200 Templates.401 Missing or invalid API key.| Name | Type | Required | Description |
|---|---|---|---|
templates | ProjectTemplate[] | yes |
Custom domains a project also serves at, over HTTPS with a certificate issued automatically. On paid plans. Add a domain, create the two DNS records it returns, then check it: a domain serves once both records are found and the project is public.
GET /projects/{projectId}/domainsList a project's custom domains
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
Responses:
200 The project's custom domains, each with the DNS records it needs.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
domains | CustomDomain[] | yes |
POST /projects/{projectId}/domainsAdd a custom domain to a project
Claims the domain for the project and returns the CNAME and TXT records to create at the domain's DNS provider. Nothing is served on it until POST /projects/{projectId}/domains/{domain}/check finds both. Counts against the plan's custom domain allowance.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
domain | string | yes | The hostname, e.g. app.yourcompany.com. |
Responses:
201 The domain was added and is pending its DNS records.400 The request was malformed.401 Missing or invalid API key.403 The account hit a plan limit (e.g. a tier's project cap).404 No such resource.409 The domain is already added to one of your projects, or connected to another account.| Name | Type | Required | Description |
|---|---|---|---|
domain | string | yes | The hostname. |
status | pending | verified | active | cert_failed | yes | pending: waiting for the DNS records. verified: records found, certificate being issued. active: serving over HTTPS while the project is public. cert_failed: the certificate could not be issued; see problem. |
problem | string, nullable | no | What is still wrong, in words. |
records | object[] | yes | The DNS records to create at the domain's DNS provider. |
url | string, nullable | no | https://{domain} once active and the project is public. |
checked_at | string (date-time), nullable | no |
DELETE /projects/{projectId}/domains/{domain}Remove a custom domain
The domain stops serving and its certificate is removed. The project keeps its own address.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes | |
domain (path) | string | yes | The hostname. |
Responses:
200 Removed.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
deleted | boolean | yes |
POST /projects/{projectId}/domains/{domain}/checkCheck a custom domain's DNS records
Looks the records up now. When both are right the domain is verified and its certificate is issued; while it is pending, problem says what is still missing. DNS changes can take a while to spread, so call it again later rather than in a tight loop.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes | |
domain (path) | string | yes | The hostname. |
Responses:
200 The domain after the check.401 Missing or invalid API key.404 No such resource.409 The domain is already added to one of your projects, or connected to another account.503 DNS did not answer in time. Retry shortly.| Name | Type | Required | Description |
|---|---|---|---|
domain | string | yes | The hostname. |
status | pending | verified | active | cert_failed | yes | pending: waiting for the DNS records. verified: records found, certificate being issued. active: serving over HTTPS while the project is public. cert_failed: the certificate could not be issued; see problem. |
problem | string, nullable | no | What is still wrong, in words. |
records | object[] | yes | The DNS records to create at the domain's DNS provider. |
url | string, nullable | no | https://{domain} once active and the project is public. |
checked_at | string (date-time), nullable | no |
Environment variables (key → value) bound to a server (shared by all its projects) or to a single project. Injected as env into agent runs and bring-up; values are write-only and never returned.
GET /secretsList secrets (keys and bindings only, never values)
Responses:
200 The account's secrets, safe view.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
secrets | Secret[] | yes |
PUT /secretsCreate or update a secret
One secret per key per account; setting an existing key updates its value. Binding to a server/project is done separately, or inline on create.
| Name | Type | Required | Description |
|---|---|---|---|
key | string | yes | Environment variable name: letters, digits, and underscore. |
value | string | yes | The secret value. Write-only, never returned by any read. |
description | string | no | Optional human note about what the secret is for. |
Responses:
200 The secret, safe view.400 The request was malformed.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
key | string | yes | |
description | string, nullable | no | |
masked | string, nullable | no | A masked hint (e.g. "sk_…3f9"), never the full value. |
server_ids | string[] | no | Servers this secret is bound to server-wide. |
project_ids | string[] | no | Projects this secret is bound to. |
created_at | string (date-time) | yes | |
updated_at | string (date-time) | yes |
DELETE /secrets/{secretId}Delete a secret and all its bindings
| Name | Type | Required | Description |
|---|---|---|---|
secretId (path) | string | yes |
Responses:
200 Deleted.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deleted | true | yes |
GET /servers/{serverId}/secretsList secrets bound to a server (server-wide)
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
Responses:
200 Secrets bound server-wide, safe view.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
secrets | Secret[] | yes |
PUT /servers/{serverId}/secretsSet and bind server-wide secrets
| Name | Type | Required | Description |
|---|---|---|---|
serverId (path) | string | yes | The server id. |
| Name | Type | Required | Description |
|---|---|---|---|
secrets | SecretInput[] | yes |
Responses:
200 The server's secrets after the change, safe view.400 The request was malformed.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
secrets | Secret[] | yes |
GET /projects/{projectId}/secretsList secrets a project sees (its own + server-wide)
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
Responses:
200 Secrets in scope for the project, safe view.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
secrets | Secret[] | yes |
PUT /projects/{projectId}/secretsSet and bind project-scoped secrets
Sets values only this project's runs see. Setting them does not resume a bring-up paused at awaiting_secrets; call POST /projects/{projectId}/init afterwards to continue it.
| Name | Type | Required | Description |
|---|---|---|---|
projectId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
secrets | SecretInput[] | yes |
Responses:
200 The project's secrets after the change, safe view.400 The request was malformed.401 Missing or invalid API key.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
secrets | Secret[] | yes |
The account an API key acts on, with its spend and budget.
GET /meThe account this key acts on, with spend and budget
Reports the account the key acts on, not the person holding it. For a teammate's key, you names the key's holder as well. Check usage before a long series of tasks: blocked is true when new tasks are refused, and reason says which ceiling stopped them. Scoped keys cannot read this.
Responses:
200 The account, its spend this period, and resource counts.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
account | object | yes | |
you | object | no | Present only when the key belongs to a teammate rather than the account owner. |
usage | object | yes | |
authenticated_key | object | yes | |
servers | integer | yes | |
projects | integer | yes | |
keys | integer | yes |
Manage the API keys on your account.
GET /keysList API keys
Responses:
200 API keys (masked).401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
keys | ApiKey[] | yes |
POST /keysMint a new API key
The plaintext key is returned in this creation response. The authenticated dashboard can also reveal the encrypted-at-rest value.
| Name | Type | Required | Description |
|---|---|---|---|
label | string | yes |
Responses:
201 The new key, including its plaintext value.400 The request was malformed.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
label | string | yes | |
masked | string | yes | Masked display form (e.g. "sk_live_abc···wxyz"). Never the full secret. |
allowed_server_ids | string[] | yes | |
allowed_project_ids | string[] | yes | |
created_at | string (date-time) | yes | |
last_used_at | string (date-time), nullable | no | |
key | string | yes | The plaintext sk_live_ key returned when the key is created. |
PATCH /keys/{keyId}Replace a key's access scope
Empty/omitted arrays mean the key can reach everything.
| Name | Type | Required | Description |
|---|---|---|---|
keyId (path) | string | yes |
| Name | Type | Required | Description |
|---|---|---|---|
allowed_server_ids | string[] | no | |
allowed_project_ids | string[] | no |
Responses:
200 The updated scope.400 The request was malformed.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | no | |
allowed_server_ids | string[] | no | |
allowed_project_ids | string[] | no |
DELETE /keys/{keyId}Revoke a key
| Name | Type | Required | Description |
|---|---|---|---|
keyId (path) | string | yes |
Responses:
200 Revoked.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deleted | true | yes |
Subscribe to events. Deliveries are HMAC-signed.
GET /webhooksList webhook subscriptions
Responses:
200 Webhooks.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
webhooks | Webhook[] | yes |
POST /webhooksSubscribe to events
The signing secret is returned once, here. Store it for signature verification.
| Name | Type | Required | Description |
|---|---|---|---|
url | string (uri) | yes | Public HTTPS endpoint. Private, loopback, link-local, and redirect destinations are rejected. |
events | task.created | task.completed | task.failed | build.failed | deployment.live | deployment.removed | server.created | server.stopped | server.deleted | quota.threshold | quota.cap_reached | quota.egress_cap_reached[] | no |
Responses:
201 The subscription, including its one-time signing secret.400 The request was malformed.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
url | string (uri) | yes | |
events | task.created | task.completed | task.failed | build.failed | deployment.live | deployment.removed | server.created | server.stopped | server.deleted | quota.threshold | quota.cap_reached | quota.egress_cap_reached[] | yes | |
created_at | string (date-time) | yes | |
secret | string | yes | The HMAC signing secret (whsec_...). Returned once; store it now. |
DELETE /webhooks/{webhookId}Remove a webhook subscription
| Name | Type | Required | Description |
|---|---|---|---|
webhookId (path) | string | yes |
Responses:
200 Deleted.401 Missing or invalid API key.403 The API key is valid but its resource scope does not allow this operation.404 No such resource.| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
deleted | true | yes |