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

Patch secrets

Deletes first, then sets, in one write that bumps record_generation. Deleting a name that is not there is not an error here. A name you set that the app’s bindings do not declare as a secret is stored, but the Worker’s env does not carry it: the answer lists it in warnings (code: secret-not-declared, with the fix) and the status is still 200. Declare it in the deploy’s bindings and the value goes live with that deploy. Names match [A-Za-z_][A-Za-z0-9_]*, at most 128 characters; at most 128 secrets per app and 64 KiB of values in total. Values are strings.

PATCH/v1/apps/{project}/secrets
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
setobject

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

deletestring[]
Responses
200

Written.

app_idstringrequired
record_generationintegerrequired
namesstring[]required
warningsSecretWarningsrequired

Empty when every name set is declared. Absent from answers of Clouds before 2026-11-25.

Show properties
Array of SecretWarning
codestringrequired

Match on this, not on the text.

Allowed:secret-not-declared
namestringrequired

The secret that is stored but not declared.

messagestringrequired

A message for people. Do not parse it.

fixstringrequired

The change that makes the Worker see it, as one line for people: add the name to secrets in sproutboat.jsonc and deploy.

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 (reason: forbidden, need: "<resource>:<action>").

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:forbidden
needstringrequired

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

404

No such app, build, secret, manifest or claim in this team (another team's resource looks the same).

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
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 PATCH 'https://dash.sproutboat.com/v1/apps/my-app/secrets' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "set": {
    "property1": "pa$$word",
    "property2": "pa$$word"
  },
  "delete": [
    "string"
  ]
}'
Response
{
  "app_id": "string",
  "record_generation": 0,
  "names": [
    "string"
  ],
  "warnings": [
    {
      "code": "secret-not-declared",
      "name": "string",
      "message": "string",
      "fix": "string"
    }
  ]
}