Skip to content

Secret routes: revoke, rotate, store

The Secret Verbs revoke, rotate, store as api.sb routes, with inputs, result, refusals and an example.

Reference for Secret, one group of Secret routes.

Secret.revoke

Revoke ends a Secret so no call fills it again; the record and its history stay. Verb page.

Text
POST /{namespace}/secrets/{secret}/revoke

Path: secret. Body, as JSON: the other inputs. Emits Secret.revoked.

Inputs

InputTypeRequiredDescription
secretSecretrequiredThe Secret to revoke.
reasontextWhy, such as a leaked value.

Returns

OutputTypeRequiredDescription
secretSecretrequiredThe revoked Secret.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X POST https://api.sb/leaseline.app/secrets/secret_UaNXUkKsJB/revoke \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "secret": {
    "$id": "https://api.sb/leaseline.app/secrets/secret_UaNXUkKsJB",
    "$type": "Secret",
    "name": "MAPS_KEY",
    "environment": "test",
    "scope": "startup"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Secret.revoke",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Secret.rotate

Rotate replaces a Secret’s value, and calls already running finish on the old one. Verb page.

Text
POST /{namespace}/secrets/{secret}/rotate

Path: secret. Body, as JSON: the other inputs. Emits Secret.rotated.

Inputs

InputTypeRequiredDescription
secretSecretrequiredThe Secret to rotate.
valuestringThe new value; omitted when the upstream issues one.

Returns

OutputTypeRequiredDescription
secretSecretrequiredThe Secret, with its new rotatedAt.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X POST https://api.sb/leaseline.app/secrets/secret_UaNXUkKsJB/rotate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "secret": {
    "$id": "https://api.sb/leaseline.app/secrets/secret_UaNXUkKsJB",
    "$type": "Secret",
    "name": "MAPS_KEY",
    "environment": "test",
    "scope": "startup"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Secret.rotate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Secret.store

Store writes a Secret’s value for one environment; the value is never returned by any Interface. Verb page.

Text
POST /{namespace}/secrets/store

Body, as JSON: the inputs. Emits Secret.stored.

Inputs

InputTypeRequiredDescription
namestringrequiredThe name Functions declare.
valuestringrequiredThe credential; write-only.
environmentstringrequiredWhere it holds.

Returns

OutputTypeRequiredDescription
secretSecretrequiredThe Secret, without its value.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X POST https://api.sb/leaseline.app/secrets/store \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"MAPS_KEY","value":"Example value","environment":"test"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "secret": {
    "$id": "https://api.sb/leaseline.app/secrets/secret_UaNXUkKsJB",
    "$type": "Secret",
    "name": "MAPS_KEY",
    "environment": "test",
    "scope": "startup"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Secret.store",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}