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

# Swap history

> List your past swaps with status and date filters, pagination, totals, and per-swap commission attribution for reconciliation.



## OpenAPI

````yaml api-reference/openapi.json GET /swap
openapi: 3.1.0
info:
  title: LightSwap API
  description: >-
    Backend REST API for approved LightSwap integrations to quote, create, and
    track swaps.
  version: 1.0.0
servers:
  - url: https://lightswap.me/api/partner/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Assets
    description: Supported asset discovery.
  - name: Address
    description: Destination address validation.
  - name: Quotes
    description: Short-lived quotes.
  - name: Swaps
    description: Swap creation and status tracking.
paths:
  /swap:
    get:
      tags:
        - Swaps
      summary: List swaps
      description: >-
        Returns the partner's swaps newest first with pagination and per-swap
        commission attribution, for reconciliation. `total` is the full count
        matching the filters. Statuses are read from LightSwap's state, which is
        synchronized roughly every minute; use `GET /swap/{id}` to force a live
        refresh of a single swap. The `expired` status filter matches swaps
        whose deposit window has passed without a deposit.
      operationId: listSwaps
      parameters:
        - name: limit
          in: query
          required: false
          description: Maximum number of swaps to return, from 1 to 100.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
            example: 50
        - name: offset
          in: query
          required: false
          description: Number of matching swaps to skip, for pagination.
          schema:
            type: integer
            minimum: 0
            default: 0
            example: 0
        - name: status
          in: query
          required: false
          description: >-
            Comma-separated swap statuses to include, for example
            `completed,refunded`.
          schema:
            type: string
            example: completed,refunded
        - name: createdFrom
          in: query
          required: false
          description: Only swaps created at or after this ISO 8601 date-time.
          schema:
            type: string
            format: date-time
            example: '2026-04-01T00:00:00.000Z'
        - name: createdTo
          in: query
          required: false
          description: Only swaps created at or before this ISO 8601 date-time.
          schema:
            type: string
            format: date-time
            example: '2026-05-01T00:00:00.000Z'
      responses:
        '200':
          description: Partner swaps matching the filters.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapListResponse'
              examples:
                listSwaps:
                  summary: First page of partner swaps
                  value:
                    swaps:
                      - id: AB12CD34EF56
                        externalId: order-123
                        status: completed
                        errorMessage: null
                        from:
                          decimals: 8
                          network: bitcoin
                          token: BTC
                          amount: '0.01'
                        to:
                          decimals: 6
                          network: tron
                          token: USDT
                          estimatedAmount: '100'
                        deposit:
                          address: bc1qdeposit
                          memo: null
                          amount: '0.01'
                          network: bitcoin
                          token: BTC
                          deadline: '2026-04-19T14:00:30.000Z'
                        payout:
                          address: TNDzfERDpxLDS2w1q6yaFC7pzqaSQ3Bg3r
                          memo: null
                          network: tron
                          token: USDT
                          estimatedAmount: '100'
                        quote:
                          id: pq_aaaaaaaaaaaaaaaaaaaaaaaa
                          rate: '10000'
                          estimatedTimeSeconds: 900
                        commission:
                          bps: 50
                          rewardAmountUsdc: '4.25'
                          rewardStatus: available
                        createdAt: '2026-04-19T10:00:30.000Z'
                        updatedAt: '2026-04-19T10:05:30.000Z'
                        customerId: u_123
                    total: 42
                    limit: 50
                    offset: 0
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/InactiveAccess'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  headers:
    RequestId:
      description: >-
        Request ID generated by LightSwap or echoed from the `x-request-id`
        request header.
      schema:
        type: string
        example: req_123
    RetryAfter:
      description: Seconds to wait before retrying a rate-limited request.
      schema:
        type: integer
        example: 30
  schemas:
    SwapListResponse:
      type: object
      required:
        - swaps
        - total
        - limit
        - offset
      properties:
        swaps:
          type: array
          items:
            $ref: '#/components/schemas/SwapListItem'
        total:
          type: integer
          description: >-
            Total number of the partner's swaps matching the filters, for
            reconciliation.
          example: 42
        limit:
          type: integer
          example: 50
        offset:
          type: integer
          example: 0
    SwapListItem:
      allOf:
        - $ref: '#/components/schemas/SwapResponse'
        - type: object
          required:
            - commission
          properties:
            commission:
              $ref: '#/components/schemas/SwapCommission'
    ErrorResponse:
      type: object
      required:
        - error
        - requestId
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
        requestId:
          type: string
          example: req_123
    SwapResponse:
      type: object
      required:
        - id
        - externalId
        - status
        - errorMessage
        - from
        - to
        - deposit
        - payout
        - quote
        - createdAt
        - updatedAt
        - customerId
      properties:
        id:
          type: string
          pattern: ^[A-Z0-9]{12}$
          example: AB12CD34EF56
        externalId:
          type:
            - string
            - 'null'
          example: order-123
        status:
          $ref: '#/components/schemas/SwapStatus'
        errorMessage:
          type:
            - string
            - 'null'
        from:
          $ref: '#/components/schemas/SwapAssetFrom'
        to:
          $ref: '#/components/schemas/SwapAssetTo'
        deposit:
          $ref: '#/components/schemas/DepositDetails'
        payout:
          $ref: '#/components/schemas/PayoutDetails'
        quote:
          $ref: '#/components/schemas/SwapQuoteSummary'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        customerId:
          type:
            - string
            - 'null'
          example: u_123
    SwapCommission:
      type: object
      required:
        - bps
        - rewardAmountUsdc
        - rewardStatus
      description: >-
        Partner commission attribution for the swap. Reward fields are null
        until the swap completes and the commission reward is accrued.
      properties:
        bps:
          type:
            - integer
            - 'null'
          description: Commission rate applied to this swap, in basis points.
          example: 50
        rewardAmountUsdc:
          type:
            - string
            - 'null'
          description: >-
            Accrued commission reward amount in USDC. Null until the swap
            reaches the completed status.
          example: '4.25'
        rewardStatus:
          type:
            - string
            - 'null'
          enum:
            - available
            - claiming
            - claimed
            - null
          description: >-
            Reward payout state: available (accrued, claimable), claiming
            (payout in progress), claimed (paid out). Null until the swap
            completes.
          example: available
    ErrorBody:
      type: object
      required:
        - code
        - message
        - details
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          example: Quote has expired.
        details:
          type: object
          additionalProperties: true
          example: {}
    SwapStatus:
      type: string
      enum:
        - waiting_deposit
        - deposit_detected
        - underpaid
        - processing
        - completed
        - refunded
        - failed
        - expired
    SwapAssetFrom:
      type: object
      required:
        - decimals
        - network
        - token
        - amount
      properties:
        decimals:
          type: integer
        network:
          type: string
        token:
          type: string
        amount:
          type: string
    SwapAssetTo:
      type: object
      required:
        - decimals
        - network
        - token
        - estimatedAmount
      properties:
        decimals:
          type: integer
        network:
          type: string
        token:
          type: string
        estimatedAmount:
          type: string
    DepositDetails:
      type: object
      required:
        - address
        - memo
        - amount
        - network
        - token
        - deadline
      properties:
        address:
          type: string
        memo:
          type:
            - string
            - 'null'
        amount:
          type: string
        network:
          type: string
        token:
          type: string
        deadline:
          type: string
          format: date-time
    PayoutDetails:
      type: object
      required:
        - address
        - memo
        - network
        - token
        - estimatedAmount
      properties:
        address:
          type: string
        memo:
          type:
            - string
            - 'null'
          description: >-
            The destination memo supplied at quote or swap time, or `null` when
            no memo was supplied.
        network:
          type: string
        token:
          type: string
        estimatedAmount:
          type: string
    SwapQuoteSummary:
      type: object
      required:
        - id
        - rate
        - estimatedTimeSeconds
      properties:
        id:
          type:
            - string
            - 'null'
          example: pq_aaaaaaaaaaaaaaaaaaaaaaaa
        rate:
          type:
            - string
            - 'null'
          example: '10000'
        estimatedTimeSeconds:
          type: integer
          minimum: 0
          example: 900
    ErrorCode:
      type: string
      enum:
        - inactive_partner
        - internal_error
        - invalid_api_key
        - provider_unavailable
        - quote_already_used
        - quote_expired
        - quote_not_found
        - rate_limited
        - swap_not_found
        - unsupported_asset
        - unsupported_memo
        - unsupported_pair
        - validation_error
  responses:
    BadRequest:
      description: >-
        The request is invalid: validation failed, the asset or pair is
        unsupported, the memo cannot be carried, or the quote expired.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            validationError:
              value:
                error:
                  code: validation_error
                  message: quoteId is invalid.
                  details: {}
                requestId: req_123
            unsupportedMemo:
              value:
                error:
                  code: unsupported_memo
                  message: Destination memo is not supported for this network or pair.
                  details: {}
                requestId: req_123
    Unauthorized:
      description: The API key is missing or invalid.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalidKey:
              value:
                error:
                  code: invalid_api_key
                  message: API key is invalid.
                  details: {}
                requestId: req_123
    InactiveAccess:
      description: API access is disabled.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: The request exceeded the configured API rate limit.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            rateLimited:
              value:
                error:
                  code: rate_limited
                  message: Too many API requests. Please wait a moment and try again.
                  details: {}
                requestId: req_123
    InternalError:
      description: The request failed on the server.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key. Keep this key on your backend.

````