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

# Cancel TWAP instruction

> Submit wallet.cancel_twap over the authenticated Relay WebSocket.

Send `wallet.cancel_twap` with a connection-local `id` over `wss://relay.testnet.kuru.io/relay/ws?account_id=<accountId>` (or the mainnet host) and a wallet-bound JWT in the upgrade `Authorization` header. The request uses the same exact payload and signature rules as the [REST method](/api/relay/reference/cancel-twap); omit the REST `wallet` and `requestId` fields. Use the signed trading account ID as the required upgrade `account_id`.

This is a slow operational request. Its bounded RPC simulation can hold later submissions on the same ordered WebSocket; use REST or a separate connection for latency-sensitive trading. `BROADCAST` only indicates asynchronous scheduling. Relay automatically sends `transaction.outcome` on this connection with the original `id`; no explicit subscription or client acknowledgement is required. Verify the intended on-chain state or events after a terminal outcome.


## AsyncAPI

````yaml api/relay/asyncapi.yaml cancelTwap
id: cancelTwap
title: wallet.cancel_twap
description: Opt-in slow operational method; exact simulation precedes signer submission.
servers:
  - id: mainnet
    protocol: wss
    host: relay.mainnet.kuru.io
    bindings: []
    variables: []
  - id: testnet
    protocol: wss
    host: relay.testnet.kuru.io
    bindings: []
    variables: []
address: /relay/ws
parameters: []
bindings:
  - protocol: ws
    version: 0.1.0
    value:
      method: GET
      query:
        type: object
        required:
          - account_id
        properties:
          account_id:
            type: string
            pattern: ^[1-9][0-9]*$
            maxLength: 13
            description: >-
              Exactly one canonical positive uint40 Kuru trading account ID (1
              through 1099511627775), without leading zero, sign, or whitespace.
            examples: &ref_0
              - '123'
    schemaProperties:
      - name: method
        type: string
        description: GET
        required: false
      - name: query
        type: object
        required: false
        properties:
          - name: account_id
            type: string
            description: >-
              Exactly one canonical positive uint40 Kuru trading account ID (1
              through 1099511627775), without leading zero, sign, or whitespace.
            examples: *ref_0
            required: true
operations:
  - &ref_3
    id: receiveCancelTwapRequest
    title: Receive cancel twap request
    type: receive
    messages:
      - &ref_4
        id: request
        contentType: application/json
        payload:
          - allOf: &ref_1
              - type: object
                additionalProperties: false
                required:
                  - id
                  - method
                  - payload
                properties:
                  id:
                    type: string
                    minLength: 1
                    maxLength: 128
                    description: Correlation ID unique within this connection.
                    x-parser-schema-id: <anonymous-schema-1>
                  method:
                    type: string
                    x-parser-schema-id: <anonymous-schema-2>
                  payload:
                    type: object
                    x-parser-schema-id: <anonymous-schema-3>
                  authorization7702:
                    oneOf:
                      - type: object
                        x-parser-schema-id: <anonymous-schema-5>
                      - type: 'null'
                        x-parser-schema-id: <anonymous-schema-6>
                    default: null
                    x-parser-schema-id: <anonymous-schema-4>
                x-parser-schema-id: BaseRequest
              - type: object
                properties:
                  method:
                    type: string
                    const: wallet.cancel_twap
                    x-parser-schema-id: <anonymous-schema-73>
                  payload:
                    type: object
                    additionalProperties: false
                    required:
                      - accountId
                      - authNonce
                      - nonce
                      - deadline
                      - twapId
                      - signature
                    properties:
                      accountId:
                        type: string
                        pattern: ^[1-9][0-9]*$
                        x-parser-schema-id: <anonymous-schema-74>
                      authNonce:
                        type: string
                        pattern: ^(0|[1-9][0-9]*)$
                        x-parser-schema-id: <anonymous-schema-75>
                      nonce:
                        type: string
                        pattern: ^[1-9][0-9]*$
                        description: One-shot trigger/TWAP nonce.
                        x-parser-schema-id: <anonymous-schema-76>
                      deadline:
                        type: string
                        pattern: ^[1-9][0-9]*$
                        x-parser-schema-id: <anonymous-schema-77>
                      twapId:
                        type: string
                        description: Nonzero bytes32 TWAP ID.
                        x-parser-schema-id: <anonymous-schema-78>
                      signature:
                        type: string
                        x-parser-schema-id: <anonymous-schema-79>
                    x-parser-schema-id: CancelTwapPayload
                x-parser-schema-id: <anonymous-schema-72>
            not: &ref_2
              required:
                - authorization7702
              x-parser-schema-id: <anonymous-schema-80>
            x-parser-schema-id: CancelTwapRequest
            name: wallet.cancel_twap
        headers: []
        jsonPayloadSchema:
          allOf: *ref_1
          not: *ref_2
          x-parser-schema-id: CancelTwapRequest
        title: wallet.cancel_twap
        example: |-
          {
            "id": "canceltwap-1",
            "method": "wallet.cancel_twap",
            "payload": {
              "accountId": "123",
              "authNonce": "1",
              "nonce": "1792480000002",
              "deadline": "1792500000",
              "twapId": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
              "signature": "0x..."
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: request
    bindings: []
    extensions:
      - id: x-parser-unique-object-id
        value: cancelTwap
sendOperations:
  - *ref_3
receiveOperations: []
sendMessages:
  - *ref_4
receiveMessages: []
extensions:
  - id: x-parser-unique-object-id
    value: cancelTwap
securitySchemes:
  - id: bearerAuth
    name: bearerAuth
    type: http
    description: Wallet-bound JWT supplied in the WebSocket upgrade Authorization header.
    scheme: bearer
    bearerFormat: JWT
    extensions: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.