> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whitebit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sync kill-switch timer

> Set or reset a kill-switch timer for automatic cancellation of open spot, margin, or futures orders after a timeout.

export const RelatedResources = ({children}) => {
  const ref = useRef(null);
  const [visible, setVisible] = useState(false);
  useEffect(() => {
    if (!ref.current) return;
    const el = ref.current;
    if (el.parentElement) {
      el.parentElement.appendChild(el);
    }
    setVisible(true);
  }, []);
  return <div ref={ref} className="related-resources" style={{
    marginTop: "2.5rem",
    paddingTop: "1.5rem",
    borderTop: "1px solid var(--border-color, #e5e7eb)",
    opacity: visible ? 1 : 0,
    transition: "opacity 0.15s ease-in"
  }}>
      <h2 style={{
    marginTop: 0
  }}>Related resources</h2>
      {children}
    </div>;
};

<RelatedResources>
  * [Status kill-switch timer](/api-reference/spot-trading/status-kill-switch-timer) — check the current kill-switch timer status
  * [Cancel all orders](/api-reference/spot-trading/cancel-all-orders) — cancel all open orders immediately
</RelatedResources>


## OpenAPI

````yaml /openapi/private/http-trade-v4.yaml POST /api/v4/order/kill-switch
openapi: 3.0.3
info:
  title: Private HTTP API V4 - Collateral Trading
  description: |
    WhiteBIT Private HTTP API V4 for collateral/margin trading operations.

    Base URL: https://whitebit.com

    All endpoints return time in Unix-time format.
    All endpoints return either a JSON object or array.
    For receiving responses from API calls please use http method POST.

    Authentication required for all endpoints.
  version: 4.0.0
  license:
    name: WhiteBIT Terms of Service
    url: https://whitebit.com/terms
servers:
  - url: https://whitebit.com
    description: WhiteBIT Global Server
  - url: https://whitebit.eu
    description: WhiteBIT EU Server
security:
  - ApiKeyAuth: []
    PayloadAuth: []
    SignatureAuth: []
tags:
  - name: Collateral Trading
    description: Endpoints for collateral/margin trading operations
  - name: Spot Trading
    description: Endpoints for spot trading operations
  - name: Market Fee
    description: Endpoints for querying trading fees
paths:
  /api/v4/order/kill-switch:
    post:
      tags:
        - Spot Trading
      summary: Sync kill-switch timer
      description: >
        The endpoint creates, updates, or deletes a [kill-switch
        timer](/glossary#kill-switch-timer). The kill-switch acts as a safety
        mechanism for automated trading systems — the timer automatically
        cancels all open orders for the specified market if the client fails to
        reset the timer before expiration. Set `timeout` to a value between `5`
        and `600` (seconds) to create or update a timer. Set `timeout` to `null`
        to delete an existing timer.


        <Warning>

        Rate limit: 10000 requests/10 sec.

        </Warning>


        <Note>

        - If timeout=null - delete existing timer by market.

        - If types=null - create timer by market for all order types.

        </Note>


        <Accordion title="Error Codes">

        - `30` - default validation error code

        - `31` - market validation failed

        </Accordion>


        <Accordion title="Errors">

        ```json

        {
          "code": 30,
          "message": "Validation failed",
          "errors": {
            "market": ["Market field is required."],
            "timeout": ["Timeout field is required."]
          }
        }

        ```


        ```json

        {
          "code": 31,
          "message": "Validation failed",
          "errors": {
            "market": ["Market is not available."]
          }
        }

        ```


        ```json

        {
          "code": 30,
          "message": "Validation failed",
          "errors": {
            "timeout": ["Timeout should be at least 5."]
          }
        }

        ```

        </Accordion>
      operationId: setKillSwitch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - market
                - timeout
              properties:
                market:
                  type: string
                  description: 'Available [market](/glossary#market). Example: BTC_USDT'
                  example: BTC_USDT
                timeout:
                  type: string
                  description: 'Timer value. Example: ''5''-''600'' or null'
                  example: '60'
                types:
                  type: array
                  description: >-
                    Order types to target. Valid values: "spot" — standard spot
                    orders. "margin" — marginal orders placed on spot markets.
                    Note: the "margin" value is not the same as the collateral
                    account balance; "collateral" in other endpoints refers to
                    the funding account, whereas "margin" here refers
                    specifically to the order type. "futures" — marginal orders
                    placed on futures markets (e.g., BTC_PERP). If omitted, the
                    API targets all order types.
                  example:
                    - spot
                    - margin
                  items:
                    type: string
                    enum:
                      - spot
                      - margin
                      - futures
                request:
                  type: string
                  example: '{{request}}'
                nonce:
                  type: string
                  example: '{{nonce}}'
      responses:
        '200':
          description: Successful response - kill-switch timer synced
          content:
            application/json:
              schema:
                type: object
                properties:
                  market:
                    type: string
                    description: Trading pair the timer applies to.
                    example: BTC_USDT
                  startTime:
                    type: integer
                    description: >-
                      Unix timestamp (seconds) when the timer was created or
                      last reset.
                    example: 1662478154
                  cancellationTime:
                    type: integer
                    description: >-
                      Unix timestamp (seconds) when the kill-switch will cancel
                      orders. Equals `startTime + timeout`.
                    example: 1662478154
                  types:
                    type: array
                    description: >-
                      Order types targeted by the kill-switch. Possible values:
                      `spot`, `margin`, `futures`.
                    items:
                      type: string
                      enum:
                        - spot
                        - margin
                        - futures
                    example:
                      - spot
                      - margin
              example:
                market: BTC_USDT
                startTime: 1662478154
                cancellationTime: 1662478154
                types:
                  - spot
                  - margin
        '400':
          description: Inner validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
          PayloadAuth: []
          SignatureAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          description: Error code
          example: 30
        message:
          type: string
          description: Error message
          example: Validation failed
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Detailed error information
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-TXC-APIKEY
      description: The public WhiteBIT API key.
    PayloadAuth:
      type: apiKey
      in: header
      name: X-TXC-PAYLOAD
      description: Base64-encoded JSON request body.
    SignatureAuth:
      type: apiKey
      in: header
      name: X-TXC-SIGNATURE
      description: >-
        HMAC-SHA512 signature of the payload, hex-encoded. Computed as
        hex(HMAC-SHA512(payload, api_secret)).

````