> ## 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.

# Lower this key's limits

> A key may lower its own per order and rolling 24 hour limits. Raising them needs a signed in session in the dashboard; a raise is refused with `details.reason` `LIMIT_RAISE_NOT_ALLOWED`.



## OpenAPI

````yaml api-reference/openapi.json POST /account/limits
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:
  /account/limits:
    post:
      tags:
        - Account
      summary: Lower this key's limits
      description: >-
        A key may lower its own per order and rolling 24 hour limits. Raising
        them needs a signed in session in the dashboard; a raise is refused with
        `details.reason` `LIMIT_RAISE_NOT_ALLOWED`.
      operationId: lowerKeyLimits
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                max_order_notional_usd:
                  type: string
                  description: Positive USD amount with at most 6 decimal places
                daily_notional_limit_usd:
                  type: string
                  description: Positive USD amount with at most 6 decimal places
              additionalProperties: false
            example:
              max_order_notional_usd: '50'
      responses:
        '200':
          description: Configuration after the change
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          scopes:
                            type: array
                            items:
                              type: string
                              enum:
                                - read
                                - trade
                                - route
                                - withdraw
                            description: What this key may do.
                          limits:
                            type: object
                            properties:
                              max_order_notional_usd:
                                type: string
                                pattern: ^\d+(?:\.\d+)?$
                              daily_notional_limit_usd:
                                type: string
                                pattern: ^\d+(?:\.\d+)?$
                              daily_notional_remaining_usd:
                                type: string
                                pattern: ^\d+(?:\.\d+)?$
                              key:
                                type: object
                                properties:
                                  max_order_notional_usd:
                                    type: string
                                    pattern: ^\d+(?:\.\d+)?$
                                  daily_notional_limit_usd:
                                    type: string
                                    pattern: ^\d+(?:\.\d+)?$
                                  daily_notional_used_usd:
                                    type: string
                                    pattern: ^\d+(?:\.\d+)?$
                                required:
                                  - max_order_notional_usd
                                  - daily_notional_limit_usd
                                  - daily_notional_used_usd
                              account:
                                type: object
                                properties:
                                  max_order_notional_usd:
                                    type: string
                                    pattern: ^\d+(?:\.\d+)?$
                                  daily_notional_limit_usd:
                                    type: string
                                    pattern: ^\d+(?:\.\d+)?$
                                  daily_notional_used_usd:
                                    type: string
                                    pattern: ^\d+(?:\.\d+)?$
                                required:
                                  - max_order_notional_usd
                                  - daily_notional_limit_usd
                                  - daily_notional_used_usd
                            required:
                              - max_order_notional_usd
                              - daily_notional_limit_usd
                              - daily_notional_remaining_usd
                              - key
                              - account
                          allowed_venues:
                            type: array
                            items:
                              type: string
                              enum:
                                - kalshi
                                - polymarket
                                - polymarket_us
                                - hyperliquid
                          max_slippage_bps:
                            type: integer
                            nullable: true
                            minimum: 0
                            maximum: 10000
                          paused:
                            type: object
                            properties:
                              global:
                                type: object
                                nullable: true
                                properties:
                                  reason:
                                    type: string
                                  source:
                                    type: string
                                    enum:
                                      - operator
                                      - dashboard
                                      - api_key
                                  since:
                                    type: string
                                    format: date-time
                                required:
                                  - reason
                                  - source
                                  - since
                              account:
                                type: object
                                nullable: true
                                properties:
                                  reason:
                                    type: string
                                  source:
                                    type: string
                                    enum:
                                      - operator
                                      - dashboard
                                      - api_key
                                  since:
                                    type: string
                                    format: date-time
                                required:
                                  - reason
                                  - source
                                  - since
                              key:
                                type: object
                                nullable: true
                                properties:
                                  reason:
                                    type: string
                                  source:
                                    type: string
                                    enum:
                                      - operator
                                      - dashboard
                                      - api_key
                                  since:
                                    type: string
                                    format: date-time
                                required:
                                  - reason
                                  - source
                                  - since
                            required:
                              - global
                              - account
                              - key
                          livemode:
                            type: boolean
                        required:
                          - scopes
                          - limits
                          - allowed_venues
                          - max_slippage_bps
                          - paused
                          - 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:
                  scopes:
                    - read
                    - trade
                  limits:
                    max_order_notional_usd: '50'
                    daily_notional_limit_usd: '500'
                    daily_notional_remaining_usd: '494.5'
                    key:
                      max_order_notional_usd: '50'
                      daily_notional_limit_usd: '1000'
                      daily_notional_used_usd: '5.5'
                    account:
                      max_order_notional_usd: '100'
                      daily_notional_limit_usd: '500'
                      daily_notional_used_usd: '5.5'
                  allowed_venues:
                    - polymarket
                    - hyperliquid
                  max_slippage_bps: 200
                  paused:
                    global: null
                    account: null
                    key: null
                  livemode: false
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: Invalid amounts, or a daily limit below the limit per order
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Invalid amounts, or a daily limit below the limit per order
                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
        '422':
          description: The change would raise a limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: The change would raise a limit
                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.