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

# Convert to pUSD

> Turns the whole balance of source_asset in the account’s Polymarket wallet into the same amount of pUSD, the cash Polymarket trades with. GET /conversions shows what can be converted. usdc_e is converted in one transaction: settled once it confirms, submitted while it is on its way. usdc is sent through Polymarket’s bridge, so it is submitted and its pUSD arrives a few minutes later; a balance under the bridge’s minimum is refused with details.reason BELOW_MINIMUM. One conversion runs at a time per account; another while one is settling is refused with details.reason CONVERSION_IN_PROGRESS. A live conversion needs trading enabled for the account in the Lean app and is submitted once. A test key holds nothing to convert, so it is refused with details.reason NOTHING_TO_CONVERT and nothing changes.



## OpenAPI

````yaml api-reference/openapi.json POST /conversions
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:
  /conversions:
    post:
      tags:
        - Account
      summary: Convert USDC to pUSD
      description: >-
        Turns the whole balance of source_asset in the account’s Polymarket
        wallet into the same amount of pUSD, the cash Polymarket trades with.
        GET /conversions shows what can be converted. usdc_e is converted in one
        transaction: settled once it confirms, submitted while it is on its way.
        usdc is sent through Polymarket’s bridge, so it is submitted and its
        pUSD arrives a few minutes later; a balance under the bridge’s minimum
        is refused with details.reason BELOW_MINIMUM. One conversion runs at a
        time per account; another while one is settling is refused with
        details.reason CONVERSION_IN_PROGRESS. A live conversion needs trading
        enabled for the account in the Lean app and is submitted once. A test
        key holds nothing to convert, so it is refused with details.reason
        NOTHING_TO_CONVERT and nothing changes.
      operationId: convertToPusd
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                source_asset:
                  type: string
                  enum:
                    - usdc
                    - usdc_e
                  description: >-
                    The asset to convert. Its whole balance in the account’s
                    Polymarket wallet becomes pUSD.
              required:
                - source_asset
              additionalProperties: false
            example:
              source_asset: usdc_e
      responses:
        '200':
          description: The conversion
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          venue:
                            type: string
                            enum:
                              - polymarket
                          source_asset:
                            type: string
                            enum:
                              - usdc
                              - usdc_e
                            description: >-
                              usdc is native Polygon USDC, usdc_e is bridged
                              USDC.e.
                          amount_usd:
                            type: string
                            pattern: ^\d+(?:\.\d+)?$
                            description: >-
                              The amount converted, which arrives as the same
                              amount of pUSD.
                          status:
                            type: string
                            enum:
                              - settled
                              - submitted
                              - failed
                            description: >-
                              settled once the pUSD has arrived, submitted while
                              it is on its way and may still fail, failed when
                              the conversion was refused and nothing moved. A
                              usdc conversion is always submitted at first,
                              because its pUSD arrives a few minutes later.
                          transaction_id:
                            type: string
                            nullable: true
                            minLength: 1
                            description: >-
                              The venue’s id for the conversion transaction.
                              Null when the venue never accepted it.
                          failure_reason:
                            type: string
                            nullable: true
                            description: >-
                              Why a failed conversion moved nothing. Null unless
                              status is failed.
                          livemode:
                            type: boolean
                        required:
                          - venue
                          - source_asset
                          - amount_usd
                          - status
                          - transaction_id
                          - failure_reason
                          - 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:
                  venue: polymarket
                  source_asset: usdc_e
                  amount_usd: '125.5'
                  status: settled
                  transaction_id: 0198f0d2-7c4e-7a51-9b3d-2e6f8a1c4d70
                  failure_reason: null
                  livemode: true
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: The request is invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: The request is invalid
                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 trade scope, or details.reason is
            ACCOUNT_NOT_DELEGATED
          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
        '409':
          description: >-
            The Polymarket wallet is not set up, or details.reason is
            CONVERSION_IN_PROGRESS
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: CONFLICT
                  message: The request conflicts with the current state
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '422':
          description: >-
            details.reason is NOTHING_TO_CONVERT, BELOW_MINIMUM, or
            VENUE_NOT_ALLOWED when the account may not trade Polymarket
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Refused by a limit; nothing was changed
                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
        '503':
          description: >-
            Trading is paused for this key or its trading account, or the venue
            is unavailable and nothing was submitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: FEATURE_DISABLED
                  message: A required service is temporarily unavailable.
                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.