Skip to content
sproutboatDocs
Esc
↑↓navigate↵open⌘Jpreview

Replace an app's spec

Writes the whole spec of an app and bumps its record_generation. A team key cannot place a module directly: module.sha256 must be the module the app already runs, or one your own team’s builds produced; anything else is 403 module-upload-disabled. So this route changes configuration (bindings, crons, limits, routes, assets) of an existing app, or moves it to an earlier module of yours. To create an app or ship new code, use POST /v1/apps/{project}/builds.

PUT replaces. Omitted hosts, bindings, services, crons, queue_consumers and limits become empty and active becomes true. Send everything you want to keep, or use hosts_patch and secrets_patch to leave routes and secrets alone. Omitting secrets keeps the stored secrets; secrets: null clears them; an object replaces the whole set. Setting any secret needs secret:write in addition to app:write.

Unknown keys are refused by name (400, reason: invalid, path). Every value of limits the team may set is checked against the account’s ceilings (GET /v1/limits): over one is 403 quota-memory, quota-storage, quota-cpu, quota-wall, quota-rate or quota-ops, never clamped, and a new app over the app quota is 403 quota-apps. An app already over a ceiling keeps its value and can be lowered or redeployed, not raised. Route keys: a team may add only <name>.<team slug>.sproutboat.app (any path under it) or a hostname it has verified as a custom domain; another route is 403 host-not-yours. A route another app holds is 409 route-taken.

PUT/v1/apps/{project}
Authorization
AuthorizationBearer token · headerrequired

A team API key, sbk_..., from Settings, API keys.

or
x-api-keyAPI key · headerrequired

The same key, in a header of its own.

Path parameters
projectstringrequired

The app's name, unique within the team. 3 to 51 characters (or 1), lowercase letters, digits and dashes, not starting or ending with a dash.

matches ^[a-z0-9](?:[a-z0-9-]{1,49}[a-z0-9])?$
Request body
requiredapplication/json
activeboolean
default: true
hostsstring[]

The app's whole route list. Exclusive with hosts_patch.

max items 64
hosts_patchHostsPatch
Show properties
addstring[]
max items 64
removestring[]
max items 64
bindingsBinding[]
max items 64
Show properties
Array of Binding
namestringrequired
kindstringrequired
Allowed:kvd1r2queuedoaeratelimitassetssecretservice
resource_idstring | nullrequired
matches ^[a-z0-9][a-z0-9_-]{0,63}$
configobjectrequired

By kind: do {class_name} (the exported Durable Object class); ratelimit {limit, period}; queue {queue, retry_delay?}; service {} with the callee in the spec's services; the others {}.

servicesobject

Service bindings: binding name to the callee's app_id (from GET /v1/apps). Both apps must belong to the team and the callee cannot be the app itself. The runtime enables service bindings from compatibility date 2026-11-18 (CLI-enforced).

cronsstring[]
max items 16
queue_consumersQueueConsumer[]
max items 16
Show properties
Array of QueueConsumer
queuestringrequired
matches ^[a-z0-9][a-z0-9_-]{0,63}$
max_batch_sizeintegerrequired
min 1 · max 100
max_batch_timeout_msintegerrequired
min 0 · max 60000
max_retriesintegerrequired
min 0 · max 100
dead_letter_queuestring | nullrequired
limitsLimits

Per-app ceilings. A null or absent value means the platform default. The account's own ceilings (GET /v1/limits) cap what a team may ask for here: a value over one is refused with 403 quota-* (never clamped), and rate_rps: 0 (no limit) is refused too.

Show properties
memory_mbinteger | null
min 8 · max 4096
cpu_msinteger | null
min 10 · max 600000
wall_msinteger | null
min 100 · max 600000
storage_mbinteger | null
min 1 · max 1048576
rate_rpsinteger | null
min 0
rate_burstinteger | null

Needs rate_rps.

min 1
ops_per_secinteger | null
min 1
egress_bytes_per_dayinteger | null
min 0
egress_policy_refstring | null
assets_manifest_refstring | null

assets/<sha256 of the uploaded manifest>. The manifest must be uploaded first.

matches ^assets/[0-9a-f]{64}$
moduleobjectrequired

The module the app runs, or one your team's builds produced. Take module_sha256 from a build.

Show properties
sha256Sha256required
matches ^[0-9a-f]{64}$
secretsobject | null

Absent keeps the stored secrets, null clears them, an object replaces the set. Needs secret:write.

Show properties
One of:
object
object
null
null
secrets_patchSecretsPatch
Show properties
setobject

Secret name to value. The values are secrets: never returned by any route, keep them out of logs.

deletestring[]
Responses
200

The spec was stored. Wait for apply as in Deploy flow, step 8.

app_idstringrequired
record_generationintegerrequired

Wait for apply.applied_generation of the app to reach this.

400

The request is malformed. path names the field when one is at fault; some refusals (a digest mismatch, a body that is not JSON) carry a message only.

One of:
ErrorInvalid
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:invalid
ErrorPlain
errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
401

No key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
403

The key lacks a grant (forbidden); a route is not the team's to use (host-not-yours); the module is not one the team may place (module-upload-disabled, the one error with no reason: read error); or the write is over a free alpha quota (quota-apps, quota-memory, quota-storage, quota-cpu, quota-wall, quota-rate, quota-ops).

One of:
ErrorForbidden
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:forbidden
needstringrequired

The grant, as <resource>:<action>, for example app:write.

ErrorHostNotYours
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:host-not-yours
pathstringrequired
Allowed:hosts
ErrorModuleUploadDisabled
errorstringrequired
Allowed:module-upload-disabled
messagestringrequired
ErrorQuotaApps
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-apps
limitintegerrequired

Apps allowed.

usedintegerrequired

Apps the team has.

ErrorQuotaMemory
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-memory
limitintegerrequired

The ceiling, in MiB.

askedintegerrequired

What the spec asked for.

ErrorQuotaStorage
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-storage
limitintegerrequired

The ceiling, in MiB.

askedinteger

What limits.storage_mb asked for.

would_use_mbinteger

The static assets of the team's apps with this deploy, in MiB.

ErrorQuotaCpu
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-cpu
limitintegerrequired

The ceiling, in milliseconds of CPU per request.

askedintegerrequired
ErrorQuotaWall
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-wall
limitintegerrequired

The ceiling, in milliseconds of wall time per request.

askedintegerrequired
ErrorQuotaRate
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-rate
limitintegerrequired

The ceiling.

askedintegerrequired
ErrorQuotaOps
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:quota-ops
limitintegerrequired

The ceiling, in binding operations per second.

askedintegerrequired
409

Another app holds one of the routes (reason: route-taken).

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:route-taken
pathstringrequired
Allowed:hosts
413

The body is over the limit for this route (reason: too-large; some refusals carry a message only).

One of:
ErrorTooLarge
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:too-large
ErrorPlain
errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
429

The key is over its requests a minute (600, or 2,000 with app:write; reason: key-rate-limited, retry_after_s, Retry-After). Wait that long and retry.

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:key-rate-limited
retry_after_sintegerrequired

Seconds to wait; also the Retry-After header.

Request
curl -X PUT 'https://dash.sproutboat.com/v1/apps/my-app' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "active": true,
  "hosts": [
    "string"
  ],
  "hosts_patch": {
    "add": [
      "string"
    ],
    "remove": [
      "string"
    ]
  },
  "bindings": [
    {
      "name": "string",
      "kind": "kv",
      "resource_id": "string",
      "config": {}
    }
  ],
  "services": {
    "property1": "string",
    "property2": "string"
  },
  "crons": [
    "string"
  ],
  "queue_consumers": [
    {
      "queue": "string",
      "max_batch_size": 1,
      "max_batch_timeout_ms": 0,
      "max_retries": 0,
      "dead_letter_queue": "string"
    }
  ],
  "limits": {
    "memory_mb": 8,
    "cpu_ms": 10,
    "wall_ms": 100,
    "storage_mb": 1,
    "rate_rps": 0,
    "rate_burst": 1,
    "ops_per_sec": 1,
    "egress_bytes_per_day": 0
  },
  "egress_policy_ref": "string",
  "assets_manifest_ref": "string",
  "module": {
    "sha256": "string"
  },
  "secrets": {
    "property1": "pa$$word",
    "property2": "pa$$word"
  },
  "secrets_patch": {
    "set": {
      "property1": "pa$$word",
      "property2": "pa$$word"
    },
    "delete": [
      "string"
    ]
  }
}'
Response
{
  "app_id": "string",
  "record_generation": 0
}