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

# Cancel a conditional sell

> Stops a conditional sell: Lean cancels its resting leader sell and any follower sells still working. Shares already sold stay sold. Canceling works while trading is paused. The answer reads canceled.



## OpenAPI

````yaml api-reference/openapi.json DELETE /conditional-sells/{id}
openapi: 3.0.0
info:
  title: Lean API
  version: 0.1.0
  description: >-
    Programmatic access to Lean: canonical sports markets, quotes, orders,
    positions and balances.
servers:
  - url: '{baseUrl}/v1'
    description: Lean API
    variables:
      baseUrl:
        default: https://api.lean.xyz
        description: >-
          The Lean API base URL, without /v1. Same value as LEAN_API_URL in the
          guides.
security:
  - apiKey: []
paths:
  /conditional-sells/{id}:
    delete:
      tags:
        - Conditional sells
      summary: Cancel a conditional sell
      description: >-
        Stops a conditional sell: Lean cancels its resting leader sell and any
        follower sells still working. Shares already sold stay sold. Canceling
        works while trading is paused. The answer reads canceled.
      operationId: cancelConditionalSell
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 64
            example: 5b2f8c14-7d3e-4a91-8c06-e4f1a9d27b30
          required: true
          name: id
          in: path
      responses:
        '200':
          description: The conditional sell, canceled
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          id:
                            type: string
                            minLength: 1
                          status:
                            type: string
                            enum:
                              - active
                              - paused
                              - hedging
                              - canceled
                              - filled
                            description: >-
                              active: the leader is selling or waiting. paused:
                              selling stopped for pause_reason. hedging: the
                              leader is done and followers are still selling.
                              canceled or filled: ended.
                          pause_reason:
                            type: string
                            nullable: true
                            enum:
                              - user
                              - floor
                              - ceiling
                              - leader_unconfirmed
                              - leader_ended
                              - leader_account_changed
                              - leader_rejected
                            description: >-
                              Why a paused conditional sell stopped: floor when
                              a follower’s book holds too little at or above its
                              floor, user when it was paused in the app, or a
                              leader_ reason when the venue did not confirm,
                              ended or refused the leader order.
                          quantity:
                            type: string
                            pattern: ^\d+(?:\.\d+)?$
                          leader:
                            type: object
                            properties:
                              market_id:
                                type: string
                                nullable: true
                                minLength: 1
                              venue:
                                type: string
                                enum:
                                  - kalshi
                                  - polymarket
                                  - polymarket_us
                                  - hyperliquid
                              ticker:
                                type: string
                                minLength: 1
                              side:
                                type: string
                                enum:
                                  - 'yes'
                                  - 'no'
                              type:
                                type: string
                                enum:
                                  - limit
                                  - stop
                              limit_price:
                                type: string
                                description: >-
                                  The lowest price the leader sells at:
                                  limit_price for a limit leader, trigger_price
                                  minus slippage_limit for a stop.
                              trigger_price:
                                type: string
                                nullable: true
                              slippage_limit:
                                type: string
                                nullable: true
                              filled_quantity:
                                type: string
                                pattern: ^\d+(?:\.\d+)?$
                              avg_fill_price:
                                type: string
                                nullable: true
                            required:
                              - market_id
                              - venue
                              - ticker
                              - side
                              - type
                              - limit_price
                              - trigger_price
                              - slippage_limit
                              - filled_quantity
                              - avg_fill_price
                          followers:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  minLength: 1
                                market_id:
                                  type: string
                                  nullable: true
                                  minLength: 1
                                venue:
                                  type: string
                                  enum:
                                    - kalshi
                                    - polymarket
                                    - polymarket_us
                                    - hyperliquid
                                ticker:
                                  type: string
                                  minLength: 1
                                side:
                                  type: string
                                  enum:
                                    - 'yes'
                                    - 'no'
                                floor_price:
                                  type: string
                                state:
                                  type: string
                                  enum:
                                    - idle
                                    - selling
                                    - retrying
                                    - below_minimum
                                    - failed
                                    - done
                                  description: >-
                                    idle: nothing to sell yet. selling: a sell
                                    is working. retrying: a sell failed and
                                    another will be sent. below_minimum: the
                                    shares owed are under the venue minimum and
                                    wait for more leader fills. failed: out of
                                    retries, so the shares stay unsold. done:
                                    every share owed is sold.
                                dispatched_quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                filled_quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                avg_fill_price:
                                  type: string
                                  nullable: true
                                unhedged_quantity:
                                  type: string
                                  pattern: ^\d+(?:\.\d+)?$
                                  description: >-
                                    Shares the leader has sold that this
                                    follower has not sold yet.
                                failed_attempts:
                                  type: integer
                                  minimum: 0
                              required:
                                - id
                                - market_id
                                - venue
                                - ticker
                                - side
                                - floor_price
                                - state
                                - dispatched_quantity
                                - filled_quantity
                                - avg_fill_price
                                - unhedged_quantity
                                - failed_attempts
                          unhedged_quantity:
                            type: string
                            pattern: ^\d+(?:\.\d+)?$
                            description: >-
                              The most leader shares sold that any follower has
                              not sold yet.
                          reject_reason:
                            type: string
                            nullable: true
                            description: >-
                              Why the venue refused the first leader order,
                              which canceled the conditional sell.
                          created_at:
                            type: string
                            format: date-time
                          updated_at:
                            type: string
                            format: date-time
                          livemode:
                            type: boolean
                        required:
                          - id
                          - status
                          - pause_reason
                          - quantity
                          - leader
                          - followers
                          - unhedged_quantity
                          - reject_reason
                          - created_at
                          - updated_at
                          - livemode
                      meta:
                        type: object
                        properties:
                          timestampMs:
                            type: integer
                            minimum: 0
                          requestId:
                            type: string
                            minLength: 1
                          traceId:
                            type: string
                            minLength: 1
                          cachedAtMs:
                            type: integer
                            minimum: 0
                          source:
                            type: string
                            enum:
                              - cache
                              - database
                              - clickhouse
                              - upstream
                              - fallback
                              - internal
                        required:
                          - timestampMs
                          - requestId
                    required:
                      - success
                      - data
                      - meta
                  - $ref: '#/components/schemas/ApiError'
              example:
                success: true
                data:
                  id: 5b2f8c14-7d3e-4a91-8c06-e4f1a9d27b30
                  status: canceled
                  pause_reason: null
                  quantity: '25'
                  leader:
                    market_id: >-
                      mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                    venue: polymarket
                    ticker: >-
                      pm:0x2222222222222222222222222222222222222222222222222222222222222222
                    side: 'yes'
                    type: limit
                    limit_price: '0.62'
                    trigger_price: null
                    slippage_limit: null
                    filled_quantity: '0'
                    avg_fill_price: null
                  followers:
                    - id: 9e41c7a2-3b58-4f6d-a0e9-7c2d5b18f364
                      market_id: >-
                        mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwptb25leWxpbmU6Z2FtZTpERU4
                      venue: kalshi
                      ticker: KXNFLGAME-26OCT11DENLAC-DEN
                      side: 'yes'
                      floor_price: '0.55'
                      state: idle
                      dispatched_quantity: '0'
                      filled_quantity: '0'
                      avg_fill_price: null
                      unhedged_quantity: '0'
                      failed_attempts: 0
                  unhedged_quantity: '0'
                  reject_reason: null
                  created_at: '2026-11-17T15:00:00.000Z'
                  updated_at: '2026-11-17T15:00:00.000Z'
                  livemode: false
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Invalid request
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '401':
          description: Missing, invalid, expired or revoked API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid, expired or revoked API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '403':
          description: The key lacks the scope this route needs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: This API key lacks the scope this route needs
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '404':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Not found
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '409':
          description: The conditional sell has already ended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: CONFLICT
                  message: The conditional sell has already ended
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '429':
          description: API error
          headers:
            Retry-After:
              description: Seconds remaining in the upstream read cooldown, when available
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: RATE_LIMITED
                  message: Too many requests for this API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '500':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: INTERNAL_ERROR
                  message: An internal error occurred.
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
components:
  schemas:
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_ERROR
                - NOT_FOUND
                - UNAUTHORIZED
                - FORBIDDEN
                - CONFLICT
                - UPSTREAM_ERROR
                - RATE_LIMITED
                - INTERNAL_ERROR
                - FEATURE_DISABLED
                - CONDITIONAL_SELL_REJECTED
                - CONDITIONAL_SELL_ACTIVE
            message:
              type: string
              minLength: 1
            details:
              nullable: true
          required:
            - code
            - message
        meta:
          type: object
          properties:
            timestampMs:
              type: integer
              minimum: 0
            requestId:
              type: string
              minLength: 1
            traceId:
              type: string
              minLength: 1
            cachedAtMs:
              type: integer
              minimum: 0
            source:
              type: string
              enum:
                - cache
                - database
                - clickhouse
                - upstream
                - fallback
                - internal
          required:
            - timestampMs
            - requestId
      required:
        - success
        - error
        - meta
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A Lean API key, sent as `Authorization: Bearer <key>`. A test key
        (`lean_sk_test_...`) simulates orders and fills with no money; a live
        key (`lean_sk_live_...`) trades for real within the key's limits. Every
        successful response says which mode answered in `data.livemode`.

````

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