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

# List unclaimed outputs

> List swap outputs and position proceeds the authenticated wallet can still claim.



## OpenAPI

````yaml openapi.json GET /unclaimed
openapi: 3.1.0
info:
  title: Shield Swap API
  description: >-
    Shield Swap REST API for pools, positions, swaps, routes, quotes, settlement
    status, and transaction input schemas. Transactions target the configured
    shield_swap program and `token_registry.aleo`.


    ## Numeric wire format


    Exact financial values are JSON strings, not JSON numbers. Unsigned decimal
    inputs use ASCII digits and an optional `.` fraction, for example
    `"1234.50"`; base-unit integers use ASCII digits only. Grouping separators,
    localized decimal commas, signs, exponent notation, whitespace, Unicode
    digits, and redundant leading zeros are not accepted for those inputs.
    Signed response metrics may include a leading `-`. Clients should localize
    only for display and convert user input back to this canonical form before
    sending it.


    ## Authentication


    Most endpoints require credentials from an invited wallet. Public routes are
    `/health`, `/ready`, `/metrics`, `/auth/*`, `/protocol/state`,
    `/compliance*`, `GET /tokens*`, `GET /pools`, `GET /pools/stats`, and `GET
    /pools/{key}`.


    Browsers use HTTP-only session cookies issued by `/auth/verify`. Access
    sessions last 15 minutes and are renewed through `/auth/refresh`.
    Programmatic clients use a long-lived token from `POST /api-tokens` as
    `Authorization: Bearer ss_…`. API tokens cover data and trading routes and
    can request WebSocket tickets. Token management, code redemption, and admin
    routes require a browser session.


    ## WebSocket feed


    The live feed runs on the separate websocket gateway at `GET /ws`.


    1. Request a ticket from `GET /auth/ws-ticket` using a browser session or
    API token.

    2. Open the socket and send the `authenticate` frame within 5 seconds.

    3. Subscribe to each required room.

    4. Before the 60-second ticket expires, request a new ticket and send
    another `authenticate` frame.


    The socket accepts WebSocket tickets only. Session JWTs and API tokens are
    rejected.


    ```json

    {"action": "authenticate", "token": "<ticket from /auth/ws-ticket>"}

    {"action": "subscribe", "room": "trades:<pool_key>"}

    {"action": "unsubscribe", "room": "<room>"}

    {"action": "synchronize"}

    ```


    After reconnecting, resend subscriptions and then send `synchronize`. The
    gateway replies `{"control": "synchronized"}` when those subscriptions are
    active. Refetch any REST data that depends on the stream after receiving the
    reply.


    Each connection allows 32 rooms, 240 client frames per minute, and 2 KB per
    frame. A client may subscribe only to the balance room for its ticket
    subject.


    Rooms:

    - `pool_launches`: newly created pools

    - `pool_stats:<pool_key>`: price & liquidity updates

    - `ohlcv:<pool_key>`: candle updates

    - `trades:<pool_key>`: swaps / mints / burns

    - `balances:<address>`: balance-change hints for an address


    - `protocol_config`: revisioned protocol-configuration invalidations


    Server messages are either events (`{"type": <event>, "data": { … }}`) or
    control messages (`{"control": <value>}`). Event types are `PoolLaunch`,
    `PoolStats`, `Ohlcv`, `Trade`, `BalanceChange`, and `ProtocolConfigChanged`.
    Its data contains `revision`, `observed_block`, and the changed
    `scope`/`key` pairs. Financial fields use the numeric format described
    above.


    Treat `ProtocolConfigChanged` as an invalidation, not as the new
    configuration. Fetch `GET /protocol/state?minimum_revision=<revision>`;
    retry a `503 protocol_revision_pending` after the advertised `Retry-After`;
    and discard or requote any `/route` result whose `protocol_revision` is
    older. Subscribe to `pool_stats:<pool_key>` separately when live price and
    liquidity updates matter.


    The gateway currently sends `synchronized` and `resync_required` controls.
    `resync_required` means the stream may have missed updates, so refetch
    affected data over REST. Ignore unknown control values.


    Event delivery is at most once. Treat REST as the source of truth. During a
    deployment the gateway may close the socket with code 1012 (service
    restart); reconnect and restore the subscriptions.
  contact:
    name: Shield Swap
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.swap.shield.fi
    description: Shield Swap mainnet API
security: []
tags:
  - name: schema
    description: On-chain function input schemas for trading / liquidity / token operations
  - name: auth
    description: Wallet sign-in, sessions, logout, and WebSocket tickets
  - name: access
    description: Invite access redemption and administration
  - name: api-tokens
    description: >-
      Long-lived API tokens for programmatic access; send as `Authorization:
      Bearer ss_…` on any gated endpoint
  - name: referral
    description: Referral redemption and administration
  - name: pools
    description: Pool metadata, stats, trades, OHLCV
  - name: positions
    description: LP positions
  - name: swaps
    description: Historical swaps
  - name: tokens
    description: Token registry
  - name: balances
    description: On-chain token balances
  - name: compliance
    description: Token/pair allowlist, pause, and pool-creation gating state
  - name: protocol
    description: Fee tiers and tick spacings
  - name: route
    description: Swap routing
  - name: debug
    description: On-chain introspection helpers
  - name: airdrop
    description: >-
      Faucet: sends ALEO, USDCx, and ETH to a user address as records, once per
      address per 15 min
  - name: unclaimed
    description: Pending swap outputs and position fees
paths:
  /unclaimed:
    get:
      tags:
        - unclaimed
      summary: List unclaimed outputs
      description: >-
        Returns everything the user can still claim:
          - Swaps with `claimed_at IS NULL` (user can drive `claim_swap_output`).
          - Positions with `tokens_owed0 > 0` or `tokens_owed1 > 0`
            (post-`decrease_liquidity` accumulations; user calls `collect`).

        The indexer is the source of truth: it stamps `claimed_at` for every
        claim

        variant, and the `swaps` row already carries every field the claim tx
        needs.

        So we do zero on-chain mapping reads here: that earlier per-swap RPC
        loop

        was both slow (N sequential reads) and wrong (reads went through a
        balancer

        hitting nodes at different heights, so freshly-claimed swaps flapped
        back).
      operationId: get_unclaimed
      responses:
        '200':
          description: Pending swap and liquidity claims
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnclaimedResponseDoc'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDoc'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDoc'
      security:
        - bearer_auth: []
components:
  schemas:
    UnclaimedResponseDoc:
      type: object
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/UnclaimedPayloadDoc'
    ErrorResponseDoc:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        ref:
          type:
            - string
            - 'null'
    UnclaimedPayloadDoc:
      type: object
      required:
        - pending_swaps
        - positions_with_owed
      properties:
        pending_swaps:
          type: array
          items:
            $ref: '#/components/schemas/PendingSwapDoc'
        positions_with_owed:
          type: array
          items:
            $ref: '#/components/schemas/PositionWithOwedDoc'
    PendingSwapDoc:
      type: object
      required:
        - swap_id
        - swap_tx_hash
        - is_private
        - is_multi_hop
        - output
      properties:
        is_multi_hop:
          type: boolean
        is_private:
          type: boolean
        output:
          $ref: '#/components/schemas/PendingSwapOutputDoc'
        swap_id:
          type: string
        swap_tx_hash:
          type: string
        token_in_info:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TokenDoc'
        token_out_info:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TokenDoc'
    PositionWithOwedDoc:
      type: object
      required:
        - token_id
        - pool
        - tick_lower
        - tick_upper
        - tokens_owed0
        - tokens_owed1
        - is_private
        - is_frozen
      properties:
        frozen_at:
          type:
            - string
            - 'null'
        is_frozen:
          type: boolean
        is_private:
          type: boolean
        last_transaction_hash:
          type:
            - string
            - 'null'
        pool:
          type: string
        tick_lower:
          type: integer
          format: int32
        tick_upper:
          type: integer
          format: int32
        token0_info:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TokenDoc'
        token1_info:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TokenDoc'
        token_id:
          type: string
        tokens_owed0:
          type: string
        tokens_owed1:
          type: string
    PendingSwapOutputDoc:
      type: object
      required:
        - recipient
        - token_in
        - token_out
        - amount_out
        - amount_remaining
      properties:
        amount_out:
          type: string
        amount_remaining:
          type: string
        recipient:
          type: string
        token_in:
          type: string
        token_out:
          type: string
    TokenDoc:
      type: object
      required:
        - id
        - address
        - name
        - symbol
        - decimals
      properties:
        address:
          type: string
        amm_token_program:
          type:
            - string
            - 'null'
          description: >-
            Program for the token representation used by the AMM; the wrapper
            program for wrapped assets.
        decimals:
          type: integer
          format: int32
        id:
          type: string
        image:
          type:
            - string
            - 'null'
        name:
          type: string
        symbol:
          type: string
        underlying_program:
          type:
            - string
            - 'null'
        underlying_token_id:
          type:
            - string
            - 'null'
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Session JWT (browsers receive it as an httpOnly cookie from `POST
        /auth/verify`; 15 min, silently renewed via `POST /auth/refresh`), or a
        long-lived API token (`ss_…`) minted at `POST /api-tokens`. API tokens
        work on data and trading endpoints and can request WebSocket tickets;
        token management and admin endpoints accept session JWTs only.

````