Shipeasy
APIOperations

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 flat value on prod.
  • Flip one sub-switch{ "switchKey": "eu_region" }. Flips that entry on prod, creating it (from false) 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. A null value means "flip", not "set to null".
  • Choose the environment — add "env": "staging". Omitted, env is prod.

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.

POST
/api/admin/killswitches/{id}/toggle

Authorization

bearerSdkKey
AuthorizationBearer <token>

Pass an admin SDK key as Authorization: Bearer sdk_admin_…. Mint via POST /api/admin/keys with type: "admin".

In: header

Path Parameters

id*string

Stable opaque killswitch id (ksw_…) or the killswitch's name.

Length1 <= length <= 128

Header Parameters

X-Project-Id?string

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"
}

Was this page helpful?
Updated August 8, 2026