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

# Cancel Strategy

> Cancel a `pending` or `open` strategy by `strategy_id`. Cancellation stops further child-order scheduling. An already-submitted child order may still fill while cancellation completes, and those fills are kept. The strategy normally finishes as `cancelled` with `reason: userRequested`; if the in-flight order completes the requested volume, it can finish as `closed`. Poll `QueryStrategies` for the terminal status and final execution totals. Terminal strategies are returned by `GetClosedStrategies`.

**API Key Permissions Required:** `Orders and trades - Cancel & close orders`




## OpenAPI

````yaml /openapi/spot-rest.yaml post /private/CancelStrategy
openapi: 3.0.0
info:
  title: REST API
  version: 1.1.0
  description: ''
servers:
  - url: https://api.kraken.com/0
    description: Production Server
security:
  - API-Key: []
    API-Sign: []
tags:
  - name: Market Data
  - name: Account Data
  - name: Trading
  - name: Algo Trading
    description: >
      Algo Trading endpoints create and manage **strategies**: parent
      instructions that Kraken executes on your behalf as a series of regular
      child orders.


      The only strategy available today is **TWAP** (time-weighted average
      price). A TWAP buys or sells a total `volume` evenly between `starttm` and
      `expiretm`. How child orders are sized, timed and placed is managed by
      Kraken and may change as execution improves.


      An algo runs as a strategy. In Kraken Pro, TWAP strategies show under
      Bots.


      ### Strategy lifecycle


      `pending` → `open` → `closed` | `expired` | `cancelled`


      - `pending`: accepted, waiting for `starttm`.

      - `open`: running, child orders are being placed.

      - `closed`: the full `volume` was filled before `expiretm`.

      - `expired`: `expiretm` was reached before the full `volume` was filled.

      - `cancelled`: cancelled with `CancelStrategy`.


      TWAP child orders are immediate-or-cancel limit orders and do not rest on
      the book. Completed child orders appear in `ClosedOrders`, and fills
      appear in trade history. Use the strategy endpoints to monitor overall
      progress.
  - name: funding-beta
    x-group: Funding (Beta)
    x-displayName: Funding (Beta)
  - name: Funding
    x-group: Funding (Legacy)
    x-displayName: Funding (Legacy)
  - name: Subaccounts
    description: >-
      Subaccounts are currently only available to institutional clients. Please
      contact your Account Manager for more details.
  - name: Earn
    description: >
      The earn API allows interacting with all of Kraken's yield generating
      products. It replaces the old `/staking` part of the API.


      The different available earn products are represented by earn strategies.
      This corresponds to the legacy `Staking/Assets`. `Stake`/`Unstake` are
      replaced by `Allocate`/`Deallocate`.


      ### Overview of the available endpoints under `/Earn`:


      - `Strategies` - list all earn strategies for which you are eligible or
      have a balance.

      - `Allocations` - lists the balance in your earn account for each
      strategy. Requires the `Query Funds` API key permission.

      - `Allocate`/`Deallocate` - allocate/deallocate to an earn strategy
      through an async operation. Requires the `Earn Funds` API key permission.

      - `AllocateStatus`/`DeallocateStatus` - verifies the state of the last
      allocation/deallocation. Requires the `Earn Funds` or `Query Funds` API
      key permission.


      ### Example usage:


      ### Determine which funds are earning rewards:


      1. Call `Strategies` to obtain information about the relevant strategy.
      The `lock_type` field shows whether bonding/unbonding funds are earning
      yield. The relevant fields are `bonding_rewards`/`unbonding_rewards`.

      2. Call `Allocations` for the relevant strategy. From the previous step,
      for strategies where bonding/unbonding does not earn yield, substract
      these balances from `amount_allocated.total` to determine which balances
      are currently earning.


      ### Get allocatable balance:


      Call `/0/private/BalanceEx`, subtract `hold_trading` amount. Remaining
      balance is available for allocation to a strategy.


      ### Geo restrictions:


      Some earn strategies are not available in all geographic regions.
      `Strategies` will return only strategies available to the caller.
  - name: Transparency
paths:
  /private/CancelStrategy:
    post:
      tags:
        - Algo Trading
      summary: Cancel Strategy
      description: >
        Cancel a `pending` or `open` strategy by `strategy_id`. Cancellation
        stops further child-order scheduling. An already-submitted child order
        may still fill while cancellation completes, and those fills are kept.
        The strategy normally finishes as `cancelled` with `reason:
        userRequested`; if the in-flight order completes the requested volume,
        it can finish as `closed`. Poll `QueryStrategies` for the terminal
        status and final execution totals. Terminal strategies are returned by
        `GetClosedStrategies`.


        **API Key Permissions Required:** `Orders and trades - Cancel & close
        orders`
      operationId: cancelStrategy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cancelStrategy'
      responses:
        '200':
          description: Strategy cancelled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cancelStrategy-2'
              examples:
                Strategy cancelled:
                  value:
                    error: []
                    result:
                      strategy_id: ASMBA64-R23M2-J7JRJV
components:
  schemas:
    cancelStrategy:
      title: Cancel Strategy Request Body
      required:
        - nonce
        - strategy_id
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/nonce'
        strategy_id:
          $ref: '#/components/schemas/algoStrategyId'
      example:
        nonce: 1781169958000
        strategy_id: ASMBA64-R23M2-J7JRJV
    cancelStrategy-2:
      type: object
      properties:
        result:
          title: StrategyCancelled
          type: object
          properties:
            strategy_id:
              $ref: '#/components/schemas/algoStrategyId'
        error:
          $ref: '#/components/schemas/error'
    nonce:
      description: Nonce used in construction of `API-Sign` header
      type: integer
      format: int64
    algoStrategyId:
      description: >-
        Kraken strategy identifier, assigned when the strategy is created.
        Always starts with `AS`.
      type: string
      pattern: ^AS[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{6}$
      example: ASMBA64-R23M2-J7JRJV
    error:
      type: array
      items:
        description: Kraken API error
        type: string
        example: EGeneral:Invalid arguments
  securitySchemes:
    API-Key:
      type: apiKey
      description: The "API-Key" header should contain your API key.
      name: API-Key
      in: header
    API-Sign:
      type: apiKey
      description: >-
        Authenticated requests should be signed with the "API-Sign" header,
        using a signature generated with your private key, nonce, encoded
        payload, and URI path.
      name: API-Sign
      in: header

````