Sproutboat Cloud API
Everything an integration needs to deploy and run an app on Sproutboat Cloud without the CLI: create and delete apps, upload a source bundle and static assets by sha256, start and follow a build, wait until a generation is live, set secrets, edit routes and custom domains, read build logs, app metrics and a running app’s logs.
This is a draft. It describes what the code does today, and it is checked against the Cloud’s routes whenever a route is added or removed. Statements marked Uncertain were read from the code but not exercised against a live Cloud.
Authentication
Every route except GET /v1/health takes a team API key, sbk_..., in either header:
Authorization: Bearer sbk_...
x-api-key: sbk_...
A key belongs to one team (organization) and every call acts on that team’s apps; there is no team header to set.
Create a key in the dashboard, Settings, API keys: pick a preset (Read only, Read data, Deploy, Deploy and
data, Admin) and an expiry (1 day to 1 year, or none). The key is shown once. A key holds grants, listed on each
operation as x-sproutboat-permission, for example app:write. GET /v1/whoami returns the grants of the key
you present. A key cannot create keys, and no route returns a secret value.
| Grant | Allows |
|---|---|
app:read |
list and read apps, builds, metrics, events |
app:write |
deploy: upload sources and assets, start builds, replace an app’s spec, edit routes |
app:delete_own |
delete the apps this key created |
app:delete |
delete any app of the team |
secret:list |
read secret names |
secret:write |
set and delete secrets |
data:read / data:write |
read / change an app’s D1 and R2 data |
logs:read |
read a running app’s logs: the recent lines and the live stream |
domain:read / domain:write |
read / add, verify and remove custom domains |
Servers
The CLI’s default is https://dash.sproutboat.com (the API and the dashboard share one origin; the API lives under
/v1). Cloud apps are served on https://<project>.<team>.sproutboat.app, where <team> is
organization_slug from GET /v1/whoami.
Errors
An error is a JSON object with a human-readable error string and, for most of them, a machine-readable
reason. Some add path (the field at fault), need (the missing grant) or a wait (retry_after_s; the
upload and data limits spell it retry_after). Branch on the HTTP status and reason, never on the wording of
error.
Every documented reason has a schema of its own, Error<Reason> in the components (for example
ErrorBlobsMissing, with its missing and missing_count), whose reason is a const. Each operation lists
the ones it can answer, per status, as a oneOf (with a discriminator on reason where every arm has one). The
list is checked against the Cloud’s handlers whenever one is added, so a reason that is thrown is documented. A Cloud
may add reasons over time: treat an unknown reason like the rest of its status.
{ "error": "hosts[0]: \"x.example.com\" is not a valid route (...)", "reason": "invalid", "path": "hosts[0]" }
Not every error has a reason (schema ErrorPlain): a missing app or build is {"error": "no such app"} (404), a
wrong method is 405 {"error": "method not allowed"}, an unknown path is 404 {"error": "not found"}, and an
unexpected failure is 500 {"error": "internal error"}. The one 403 without a reason is
{"error": "module-upload-disabled", "message": "..."} (ErrorModuleUploadDisabled): read error.
Statuses: 400 invalid input, 401 missing, invalid, expired or revoked key, 403 the key lacks a grant
(reason: forbidden, need), may not use a route (host-not-yours) or is over a quota, 404 not found (another
team’s app is also 404), 409 conflict, 411 a chunked upload without a declared length, 413 too large (too-large,
on JSON bodies as well: 256 KiB, or 1 MiB for specs, builds, secrets and route edits), 422 a D1 statement over the
host’s memory, 429 limited, 502 the host agent misbehaved, 503 temporarily unavailable, 504 the host timed out,
507 an app’s storage on its host is full.
Free alpha quotas apply per team (one team per user, and a team’s URL name, its slug, never changes): apps per team,
what an app may ask for in limits (memory, storage, CPU time, wall time, request rate, binding operations), builds
that compile per rolling 24 hours, bytes of new sources and of new static assets per rolling 24 hours, and storage
(limits.storage_mb and the team’s static assets). GET /v1/limits returns the team’s limits and usage. Over a
limit: 403 with reason quota-apps, quota-memory, quota-storage, quota-cpu, quota-wall, quota-rate or
quota-ops when an app is written (a limits value over its ceiling is refused, never clamped; an app already over a
ceiling keeps it and can be lowered or redeployed, not raised), 429 with reason: quota-builds when a build is
started, and 429 with reason: quota-upload when a source or a blob would pass the 24-hour byte budget. The 429s carry
retry_after_s and a Retry-After header. The error text is meant to be shown as it is. Treat any 403 or 429 with
an unknown reason the same way.
Rate limits
- Per key: 2,000 requests a minute for a key that holds
app:write(a deploy sends one request per missing asset file, plus the polls of the rollout), 600 for a key that cannot write. Over it: 429,reason: key-rate-limited,retry_after_s, and aRetry-Afterheader; wait that long and send the same request again. Keys made before 2026-11-25 that could deploy were raised to 2,000 as well. - Data routes (D1 query, R2 objects): per team, 2 requests in flight and a bucket of 60 refilled at 10 a second.
Over it: 429,
reason: rate,retry_after,Retry-Afterheader. Counted per API process, so treat them as approximate. - Uploads (
PUT /v1/sources/...,PUT /v1/assets/blobs/...,PUT /v1/assets/manifests/...): per team, not per key. Over the rate: 429,reason: upload-rate,retry_after,Retry-After. Blob uploads in flight at once are bounded per API process: 429,reason: busy,Retry-After: 5. New bytes per rolling 24 hours: 429,reason: quota-upload. - Builds: per team, 3 builds queued or running, 20 new (not cached) builds an hour; platform-wide, a queue of
50. See
POST /v1/apps/{project}/buildsfor the reasons. - Domains: 10 custom domains per team, one verification check per domain every 10 seconds, 20 new verifications an hour platform-wide.
Idempotency, concurrency, pagination
There is no Idempotency-Key header. What is safe to repeat:
- Uploads by sha256 (
PUT /v1/sources/...,PUT /v1/assets/blobs/...,PUT /v1/assets/manifests/...) are content-addressed: sending the same bytes again is a no-op (stored: false, and no quota is charged). What a team has uploaded is private to it:POST /v1/sources/missingandPOST /v1/assets/missinganswer for the team’s own uploads only (bytes another team holds are reported missing until you send them), a manifest may name only blobs the team uploaded, andGET /v1/assets/manifests/{sha256}is 404 for a manifest the team neither uploaded nor uses. POST /v1/apps/{project}/buildswith the same source,buildand runtime answers from a cache (HTTP 200, areadybuild withcached: true) instead of building again; the app still gets a newrecord_generation.POST /v1/domainsfor a host you already claimed returns the existing claim (200).- Every write to an app (
PUT, secrets, routes, a finished build) bumps itsrecord_generation, even when the content did not change. Writes to one app are serialized; the last write wins. A newer build of a project cancels its older queued build (superseded: true).
No list route has a cursor. GET /v1/apps returns every app. GET /v1/apps/{project}/builds takes limit
(1 to 100, default 20) and returns the newest. Metrics and events are windows (a range, the last 20 events per kind).
What is not in this file
Git push-to-deploy (/v1/git/*, /v1/apps/{project}/git*), the browser sign-in flows, and team and key management
are not part of this file. A running app’s own output is read through
GET /v1/apps/{project}/logs (recent lines) and GET /v1/apps/{project}/tail (live), or grouped one run per request through
GET /v1/apps/{project}/invocations and .../invocations/tail; build logs stream over
GET /v1/builds/{id}/events, and GET /v1/apps/{project}/events returns only the last exceptions and triggers (a
counter ring, not a log). There is no rollback route either; see Deploy flow for how a previous version is redeployed.
Deploy flow
This is the order the CLI calls the routes for sproutboat deploy (source build, the default):
GET /v1/whoamifor the team slug, once, to name the route<project>.<slug>.sproutboat.app.GET /v1/apps(only when the app binds other apps as services) andGET /v1/apps/{project}(404 means a new app).- If the app has static assets:
POST /v1/assets/missing,PUT /v1/assets/blobs/{sha256}for each missing one,PUT /v1/assets/manifests/{sha256}. The manifest’s digest is itsassets_manifest_ref(assets/<sha256>). POST /v1/sources/missing, thenPUT /v1/sources/{sha256}if the source is missing. The source is the app’s generated JavaScript, a single UTF-8 file of at most 8 MiB that the CLI produces (sproutboat build --standalone --emit-onlyprints its path). The API has no way to build from your own TypeScript.POST /v1/apps/{project}/buildswith{source_sha256, kind: "generated", build, spec}. Thespeccarries the routes (hosts_patch),assets_manifest_ref,bindings,crons,queue_consumersandservices. This is how a team creates or updates an app; there is no separate create call. Secrets are not allowed in a build’sspec(it is stored in plain text).- Follow
GET /v1/builds/{id}/events(Server-Sent Events) untildone, or pollGET /v1/builds/{id}untilstateisready,failedorcanceled.record_generationappears on the build when it isready. - If there are secrets:
PATCH /v1/apps/{project}/secrets; it returns a newerrecord_generation. - Is it live? Poll
GET /v1/apps/{project}untilapply.stateisappliedandapply.applied_generationis at least therecord_generationyou are waiting for. The CLI treatsfailedandfencedas terminal (apply.errorsays why) and otherwise waits up to 120 s, polling every 2 s.applyis null until the first apply was attempted.
Redeploying an earlier version. A finished build names its module_sha256. PUT /v1/apps/{project} accepts a
module your own team’s builds produced, so a spec with module.sha256 set to an earlier build’s value moves the app
back to it (Uncertain: this follows from the rule on PUT /v1/apps/{project}, and was not exercised against a live Cloud). Building the same
source again is a cache hit and takes no build time.
https://dash.sproutboat.comMeta
Health, the identity of a key, and the team’s limits.
- GETLiveness
/v1/health - GETWho a key is
/v1/whoami - DELETERevoke this key
/v1/keys/self - GETGet the team's limits and usage
/v1/limits
Apps
Create, read, replace and delete apps.
- GETList the team's apps
/v1/apps - GETRead an app
/v1/apps/{project} - PUTReplace an app's spec
/v1/apps/{project} - DELETEDelete an app
/v1/apps/{project}
Uploads
Source bundles and static assets, uploaded by sha256.
- POSTMissing sources
/v1/sources/missing - PUTUpload a source bundle
/v1/sources/{sha256} - POSTMissing asset blobs
/v1/assets/missing - PUTUpload one asset file
/v1/assets/blobs/{sha256} - GETRead an assets manifest
/v1/assets/manifests/{sha256} - PUTUpload an assets manifest
/v1/assets/manifests/{sha256}
Builds
Start a build, follow its log, cancel it.
- GETList an app's builds
/v1/apps/{project}/builds - POSTStart a build
/v1/apps/{project}/builds - GETBuild status
/v1/builds/{id} - DELETECancel a build
/v1/builds/{id} - GETStream a build's log
/v1/builds/{id}/events
Secrets
Per-app secrets. Names can be listed, values never come back.
- GETList secret names
/v1/apps/{project}/secrets - PATCHPatch secrets
/v1/apps/{project}/secrets - PUTSet one secret
/v1/apps/{project}/secrets/{name} - DELETEDelete one secret
/v1/apps/{project}/secrets/{name}
Routes and domains
Routes of an app, and custom domains a team proves it owns.
- PATCHAdd and remove routes
/v1/apps/{project}/routes - GETList the team's custom domains
/v1/domains - POSTClaim a custom domain
/v1/domains - DELETERelease a custom domain
/v1/domains/{host} - POSTCheck the DNS proof
/v1/domains/{host}/verify - GETDomain status
/v1/domains/{host}/status
Data
SQL on an app’s D1 databases and objects in its R2 buckets.
- POSTQuery D1
/v1/apps/{project}/d1/{binding}/query - GETRead an object
/v1/apps/{project}/r2/{bucket}/objects/{key} - PUTWrite an object
/v1/apps/{project}/r2/{bucket}/objects/{key} - DELETEDelete an object
/v1/apps/{project}/r2/{bucket}/objects/{key}
Observability
Metrics, recent events and notices.
- GETApp metrics
/v1/apps/{project}/metrics - GETRecent exceptions and triggers
/v1/apps/{project}/events - GETRecent log lines of a running app
/v1/apps/{project}/logs - GETStream a running app's events live
/v1/apps/{project}/tail - GETRecent runs of a running app, one per request
/v1/apps/{project}/invocations - GETStream a running app's runs live, one per request
/v1/apps/{project}/invocations/tail - GETList notices
/v1/notices