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

# List the user's balance journal, newest first.



## OpenAPI

````yaml /openapi.yaml get /custody/get-ledger
openapi: 3.1.0
info:
  title: Symbiosis API
  description: >-
    The Symbiosis REST API.


    ## Authentication


    Endpoints accept one of two credentials:


    - **Session token**: `Authorization: Bearer <token>`, from `POST
    /auth/login`.

    - **API key (HMAC)**: three headers on every request:
      - `APIKEY`: the API key id, from `POST /auth/api-keys`.
      - `X-Hmac-Timestamp`: current Unix time in milliseconds.
      - `X-Hmac-Signature`: Base64-encoded HMAC-SHA256 of
        `timestamp_ms "\n" METHOD "\n" PATH_AND_QUERY "\n" BODY`, keyed with the API key
        secret. `PATH_AND_QUERY` is the full request target including the query string.

    ## Wire formats


    Token amounts (`U256`) serialize in responses as 0x-prefixed hex strings;
    requests accept decimal strings, 0x-prefixed hex strings, or JSON numbers.
    Asset ids and addresses are 0x-prefixed hex strings. Prices are integers
    scaled by 1e6.


    ## Request ids


    Every response carries an `x-request-id` header: a server-minted UUID that
    keys our logs. Include it when reporting a problem. The server never adopts
    an id you send; an inbound `x-request-id` is logged alongside ours, so a
    request that never got a response can still be found.


    ## Identifiers and uniqueness


    For integrators mirroring this API into their own storage:


    - **Globally unique, never reused**: `user_id`, `api_key_id`, `request_id`,
    `quote_id`, `match_id`, `withdrawal_id`, `job_id`, audit event `id`. The
    ledger's `entry_id` is also strictly increasing: a safe dedupe key and
    cursor.

    - **Unique per user**: `client_withdrawal_id`, the caller-chosen idempotency
    key. Replaying the same id and terms returns the original withdrawal; the
    same id with different terms returns 409.

    - **Composite keys**: an outcome token is `(venue, asset_id)`, never
    `asset_id` alone; balances are keyed by `(user, venue, asset_id)`, with USDC
    held separately.

    - **Not unique**: a ledger `ref_id` (every entry the same record caused
    shares it) and a withdrawal's `transaction_hash` (it can change if the job
    is re-signed; key on `job_id`).
  version: 0.1.0
servers:
  - url: https://api.symbiosis.markets
security: []
tags:
  - name: auth
    description: Accounts, sessions, API keys, and websocket tickets.
  - name: custody
    description: Deposit addresses, balances, and withdrawals.
  - name: rfq
    description: Quote requests, quotes, and matching.
paths:
  /custody/get-ledger:
    get:
      tags:
        - custody
      summary: List the user's balance journal, newest first.
      operationId: get_ledger
      parameters:
        - in: query
          name: account
          description: Only entries on this sub-account.
          schema:
            description: Only entries on this sub-account.
            anyOf:
              - $ref: '#/components/schemas/LedgerAccount'
              - type: 'null'
          style: form
        - in: query
          name: asset_id
          description: Only entries against this market asset.
          schema:
            description: Only entries against this market asset.
            type:
              - string
              - 'null'
          style: form
        - in: query
          name: direction
          description: Only credits, or only debits.
          schema:
            description: Only credits, or only debits.
            anyOf:
              - $ref: '#/components/schemas/LedgerDirection'
              - type: 'null'
          style: form
        - in: query
          name: from
          description: Only entries at or after this instant.
          schema:
            description: Only entries at or after this instant.
            type:
              - string
              - 'null'
            format: date-time
          style: form
        - in: query
          name: last_cursor
          description: The last cursor, emitted by the previous response.
          schema:
            description: The last cursor, emitted by the previous response.
            type:
              - string
              - 'null'
          style: form
        - in: query
          name: limit
          description: The maximum number of items to return.
          schema:
            description: The maximum number of items to return.
            type:
              - integer
              - 'null'
            format: uint32
            minimum: 0
          style: form
        - in: query
          name: max_amount
          description: Maximum absolute delta, in native token units, as a decimal string.
          schema:
            description: >-
              Maximum absolute delta, in native token units, as a decimal
              string.
            type:
              - string
              - 'null'
          style: form
        - in: query
          name: min_amount
          description: Minimum absolute delta, in native token units, as a decimal string.
          schema:
            description: >-
              Minimum absolute delta, in native token units, as a decimal
              string.
            type:
              - string
              - 'null'
          style: form
        - in: query
          name: reasons
          description: Comma-separated list of reasons
          schema:
            description: Comma-separated list of reasons
            type:
              - string
              - 'null'
            default: null
          style: form
        - in: query
          name: to
          description: Only entries at or before this instant.
          schema:
            description: Only entries at or before this instant.
            type:
              - string
              - 'null'
            format: date-time
          style: form
        - in: query
          name: usdc
          description: >-
            `true` keeps only USDC entries; `false` keeps only market-asset
            entries.
          schema:
            description: >-
              `true` keeps only USDC entries; `false` keeps only market-asset
              entries.
            type:
              - boolean
              - 'null'
          style: form
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_for_LedgerEntry'
        '401':
          description: Invalid, missing, or mis-signed credentials.
        '403':
          description: Authenticated, but the credential lacks the required scope.
      security:
        - SessionBearer: []
        - ApiKeyHmac: []
          HmacTimestamp: []
          HmacSignature: []
components:
  schemas:
    LedgerAccount:
      type: string
      enum:
        - available
        - pending
    LedgerDirection:
      type: string
      enum:
        - credit
        - debit
    Page_for_LedgerEntry:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/LedgerEntry'
        next_cursor:
          type:
            - string
            - 'null'
      required:
        - items
    LedgerEntry:
      description: One row of the append-only balance journal, newest first.
      type: object
      properties:
        account:
          $ref: '#/components/schemas/LedgerAccount'
        asset_id:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        delta:
          description: Signed delta in native token units, as a decimal string.
          allOf:
            - $ref: '#/components/schemas/SignedTokenAmount'
        entry_id:
          description: >-
            Unique and strictly increasing. A safe dedupe key and pagination
            cursor.
          type: integer
          format: int64
        reason:
          $ref: '#/components/schemas/LedgerReason'
        ref_id:
          description: >-
            The record behind the movement: an order, quote, match, or
            withdrawal UUID,
             or the 0x-prefixed deposit transaction id. Not unique: every entry the same
             record caused shares it.
          type: string
        venue:
          description: '`None` (with `asset_id`) for entries against the USDC balance.'
          anyOf:
            - $ref: '#/components/schemas/Venue'
            - type: 'null'
      required:
        - entry_id
        - account
        - delta
        - reason
        - ref_id
        - created_at
    SignedTokenAmount:
      description: |-
        A signed balance movement in native token units, as a decimal string.

         Same scale as `TokenAmount` (USDC: 6 decimals), but signed and decimal rather
         than hex: "-16000000000" is a 16,000 USDC debit.
      type: string
    LedgerReason:
      type: string
      enum:
        - deposit
        - withdrawal
        - reserve_rfq
        - reserve_trade
        - release
        - trade
        - fee
    Venue:
      description: The supported markets of the system.
      type: string
      enum:
        - polymarket
        - kalshi
        - limitless
  securitySchemes:
    SessionBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Session token from `POST /auth/login`.
    ApiKeyHmac:
      type: apiKey
      in: header
      name: APIKEY
      description: API key id, from `POST /auth/api-keys`.
    HmacTimestamp:
      type: apiKey
      in: header
      name: X-Hmac-Timestamp
      description: Unix milliseconds used in the signed message.
    HmacSignature:
      type: apiKey
      in: header
      name: X-Hmac-Signature
      description: >-
        Base64 HMAC-SHA256 over `timestamp_ms \n METHOD \n PATH_AND_QUERY \n
        BODY`. See the API description for the signing scheme.

````