deploy.kill-switches.apply

Pull a kill switch on an app

POST /deploy/api/apps/{id}/kill-switchesIAM deploy:ApplyKillSwitchChanges stateDestructive

route_offline: target is one of the app’s hostnames, or a path prefix such as /admin on every hostname of a machine-hosted app; it answers 503 (a pooled app’s host answers 404 for a hostname taken offline). private_only: only private-network sources (RFC 1918, the app’s VPC) are served, public ones get 403 — HTTP-level, TLS still completes; behind a load balancer the balancer itself is refused; not for pooled apps (409). scale_to_zero: every container stops; machines stay on and are billed; a deployment started meanwhile also stays at zero. Effective on the machines’ next poll, within seconds. A switch survives deploys, app updates and Terraform applies, and is never released by the platform. Pulling an active switch again returns it (200).

Request syntax

POST /deploy/api/apps/{id}/kill-switches
{
  "kind": "enum",
  "target": "string",
  "reason": "string",
  "findingId": "string"
}

Path parameters

  • idRequired

    string

    Constraints: uuid

Request body

  • kindRequired

    enum

    route_offline, private_only or scale_to_zero

    One of: route_offline, private_only, scale_to_zero

  • targetOptional

    string

    route_offline only: one of the app’s hostnames, or a path prefix such as /admin

  • reasonRequired

    string

    Why, for the record (3–500 characters)

    Constraints: 3-500 chars

  • findingIdOptional

    string

    The Security Posture finding it answers, if any

Response

201 with `data`: the switch (200 when the same switch was already active). 409 when it does not fit the app (a pooled app, a hostname that is not the app’s); 502 when the app’s load balancer could not be read.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Fields of data

  • idAlways

    string

    The switch id, which releases it
  • appIdAlways

    string

    The app it is pulled on
  • appNameWhen present

    string

    The app’s name (list-active only)
  • kindAlways

    one of route_offline, private_only, scale_to_zero

    What the switch does
  • labelAlways

    string

    The kind, for people: "Route offline"
  • targetAlways

    string, may be null

    route_offline: the hostname or path prefix; null for the other kinds
  • reasonAlways

    string

    Why it was pulled, as given
  • findingIdAlways

    string, may be null

    The Security Posture finding it was pulled from
  • activeAlways

    boolean

    true until released
  • appliedByAlways

    string

    Who pulled it
  • appliedAtAlways

    string

    When it was pulled
  • releasedByAlways

    string, may be null

    Who released it; null while active
  • releasedAtAlways

    string, may be null

    When it was released; null while active

Checked against the handlers: every route test validates their answers against this schema.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow deploy:ApplyKillSwitch on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud deploy kill-switches apply id --kind route_offline --reason example

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_deploy_kill-switches_apply.