Deploy a web service or agent app from a Git repository
const url = 'https://api.global.stillbox.example/v1/deployments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","repository":"example","branch":"example","environment":"example","dir":"example","build":"example","start":"example","port":1,"health_path":"example","visibility":"private","image":"example","env":{"additionalProperty":"example"},"vcpus":1,"memory_mb":1,"disk_mb":1,"auto_sleep_seconds":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.global.stillbox.example/v1/deployments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "repository": "example", "branch": "example", "environment": "example", "dir": "example", "build": "example", "start": "example", "port": 1, "health_path": "example", "visibility": "private", "image": "example", "env": { "additionalProperty": "example" }, "vcpus": 1, "memory_mb": 1, "disk_mb": 1, "auto_sleep_seconds": 1 }'Makes a sandbox for the service, clones the repository (or the environment’s), runs the build command, then keeps the start command running, restarting it if it stops. Its port opens at an HTTPS address. The sandbox sleeps when nothing uses it and wakes on the next request.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Unique in your organization; lowercase letters, digits and dashes
An https link to a public Git repository, or one your organization allows. Or use an environment’s repositories.
The branch to deploy; the repository’s default if not set
An environment whose repositories, variables and secrets the service gets
Where to build and run, inside the home folder. The repository’s folder if not set.
Shell command run before start, and on every redeploy (npm ci && npm run build)
Shell command that runs the service. It must listen on $PORT.
Checked over HTTP until it answers; / if not set
The sandbox template; stillbox/base if not set
object
Sleep after this long with no requests; 0 never sleeps
Responses
Section titled “Responses”The new deployment; it builds and starts in its sandbox
object
The service’s HTTPS address
Goes up on every redeploy
Running, asleep, or on its way to one
Example
{ "visibility": "private"}The request is invalid
object
Example
{ "code": "not_found"}The API key is missing or invalid
object
Example
{ "code": "not_found"}Only an owner can do this (owner_only), or the invitation is for another address (not_invited)
object
Example
{ "code": "not_found"}The change would leave the organization without an owner (last_owner), its seats are full (member_limit), or
the person is already a member (already_member)
object
Example
{ "code": "not_found"}