Toggle a killswitch or one of its switches
Flips a killswitch on one environment and publishes a new version there. This is the one-call incident verb: it reads the current value, flips it, and…
Flips a killswitch on one environment and publishes a new version there. This is the one-call incident verb: it reads the current value, flips it, and publishes, so you don't have to fetch the killswitch first.
Every body field is optional, which is what makes the call widen cleanly:
- Flip the killswitch —
{}. Flips the flatvalueonprod. - Flip one sub-switch —
{ "switchKey": "eu_region" }. Flips that entry onprod, creating it (fromfalse) if it isn't in the map yet. - Set it idempotently —
{ "switchKey": "eu_region", "value": true }. Publishes exactly that value, so a retried call can't undo the first one. Anullvaluemeans "flip", not "set to null". - Choose the environment — add
"env": "staging". Omitted,envisprod.
The response reports both previous and value, so a caller that asked for a flip can see what it actually changed.
Prefer this over PUT /{id}/value and PUT /{id}/switch unless you specifically need those endpoints' unconditional set semantics.
Authorization
bearerSdkKey Pass an admin SDK key as Authorization: Bearer sdk_admin_…. Mint via POST /api/admin/keys with type: "admin".
In: header
Path Parameters
Stable opaque killswitch id (ksw_…) or the killswitch's name.
1 <= length <= 128Header Parameters
Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://shipeasy.ai/api/admin/killswitches/string/toggle" \ -H "Content-Type: application/json" \ -d '{}'{
"id": "ksw_01j7w9d8h2k4m6n8p0q2r4s6t8",
"env": "prod",
"switchKey": "eu_region",
"previous": false,
"value": true,
"version": 7,
"published": {
"value": false,
"switches": {
"eu_region": true
}
}
}{
"error": "Malformed request (bad JSON, missing project scope).",
"code": "BAD_REQUEST"
}{
"error": "Missing or invalid admin SDK key.",
"code": "UNAUTHORIZED"
}{
"error": "Key is valid but not allowed to act on this project.",
"code": "FORBIDDEN"
}{
"error": "The resource does not exist or is not visible to the caller.",
"code": "NOT_FOUND"
}{
"error": "A resource with this name already exists in the project.",
"code": "ALREADY_EXISTS"
}{
"error": "The request body failed structural (schema) validation.",
"code": "VALIDATION"
}Set the flat value on one env
Sets the flat value on a single env, publishing one new version on that env only. switches and other envs are untouched.
List gate templates
Returns the merged targeting-rule template catalog — read-only built-ins first (the @team/@owner audience aliases, country, email-domain, region presets,…