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

# Get your balance on every venue

> Your balance on every venue. `venues` always holds kalshi, polymarket, limitless and predictfun.

- Each venue has a `status`: ok, not_connected, unavailable or unsupported, with a `reason` for the last three.
- `held` (each address read, its kinds and amounts as integer base units plus their exact decimal) appears only when ok.
- There is no cross-venue total.
- A venue over its budget reads unavailable with reason venue_busy, while the route still answers 200.

**Errors**

| Status | Code | When |
|---|---|---|
| 503 | `dependency_unavailable` | Our store is unavailable. |

Any route can also answer 401, 403, 429, 500 or 503 `dependency_unavailable`, described on the Errors page.



## OpenAPI

````yaml /openapi.json get /public/v1/account/balances
openapi: 3.1.0
info:
  description: >-
    Prediction-market data across Polymarket, Kalshi, Limitless and predict.fun
    over REST, plus order placement and account reads on your own venue
    accounts. Every request sends three headers, `X-Client-Id`, `X-Api-Key` and
    `X-Api-Secret`; try any endpoint from its page.
  title: TrendlineLabs Public API
  version: '1'
servers:
  - description: Production
    url: https://systems.trendlinelabs.ai
security: []
tags:
  - description: 'Read back the key you are calling with: its scopes, tier and rate limit.'
    name: Your key
  - description: Events group markets across venues; each carries a `universal_id`.
    name: Events
  - description: One market's order book, price history and trades on one venue.
    name: Markets
  - description: Current prices for a set of markets in one call.
    name: Prices
  - description: Live cross-venue price gaps on the same market.
    name: Opportunities
  - description: Place, read and cancel orders on your own venue accounts.
    name: Trading
  - description: Your own balances, positions, orders and fills on each connected venue.
    name: Account
paths:
  /public/v1/account/balances:
    get:
      tags:
        - Account
      summary: Get your balance on every venue
      description: >-
        Your balance on every venue. `venues` always holds kalshi, polymarket,
        limitless and predictfun.


        - Each venue has a `status`: ok, not_connected, unavailable or
        unsupported, with a `reason` for the last three.

        - `held` (each address read, its kinds and amounts as integer base units
        plus their exact decimal) appears only when ok.

        - There is no cross-venue total.

        - A venue over its budget reads unavailable with reason venue_busy,
        while the route still answers 200.


        **Errors**


        | Status | Code | When |

        |---|---|---|

        | 503 | `dependency_unavailable` | Our store is unavailable. |


        Any route can also answer 401, 403, 429, 500 or 503
        `dependency_unavailable`, described on the Errors page.
      operationId: getAccountBalances
      responses:
        '200':
          content:
            application/json:
              example:
                as_of_ms: 1791266400000
                venues:
                  kalshi:
                    held:
                      - address: null
                        amounts:
                          - amount: '123.45'
                            amount_base_units: '12345'
                            asset: USD
                            chain: null
                            decimals: 2
                            source: kalshi
                        kinds:
                          - account
                    status: ok
                  limitless:
                    reason: timeout
                    status: unavailable
                  polymarket:
                    held:
                      - address: '0x5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c'
                        amounts:
                          - amount: '0.920000'
                            amount_base_units: '920000'
                            asset: pUSD
                            chain: polygon
                            decimals: 6
                            source: onchain
                          - amount: '0.080000'
                            amount_base_units: '80000'
                            asset: USDC.e
                            chain: polygon
                            decimals: 6
                            source: onchain
                        kinds:
                          - deposit_wallet
                      - address: '0x6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d'
                        amounts:
                          - amount: '0.000000'
                            amount_base_units: '0'
                            asset: pUSD
                            chain: polygon
                            decimals: 6
                            source: onchain
                          - amount: '0.000000'
                            amount_base_units: '0'
                            asset: USDC.e
                            chain: polygon
                            decimals: 6
                            source: onchain
                        kinds:
                          - safe
                      - address: '0x3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a'
                        amounts:
                          - amount: '0.000000'
                            amount_base_units: '0'
                            asset: pUSD
                            chain: polygon
                            decimals: 6
                            source: onchain
                          - amount: '0.000000'
                            amount_base_units: '0'
                            asset: USDC.e
                            chain: polygon
                            decimals: 6
                            source: onchain
                        kinds:
                          - eoa
                    status: ok
                    wallet: '0x3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a'
                  predictfun:
                    held:
                      - address: '0x4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b'
                        amounts:
                          - amount: '4.210000000000000000'
                            amount_base_units: '4210000000000000000'
                            asset: USDT
                            chain: bnb
                            decimals: 18
                            source: onchain
                        kinds:
                          - wallet
                    status: ok
                    wallet: '0x4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b'
              schema:
                $ref: '#/components/schemas/PublicAccountBalances'
          description: Successful Response
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            unauthorized: missing or partial credential headers, parts that do
            not belong together, or a key that is unknown, revoked or expired.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            WWW-Authenticate:
              description: ApiKey realm="public-api"
              schema:
                type: string
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            insufficient_scope: the key lacks the scope this route needs;
            ip_not_allowed: the request came from an address outside the key's
            allowlist; tier_required: the key owner's plan does not include API
            access; access_not_granted: API access is free but granted on
            request; request it on https://trendlinelabs.ai/developer.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            invalid_request: a parameter is missing, unknown, malformed or out
            of bounds, or a cursor does not match.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            rate_limited: too many requests, or too many failed authentications;
            wait Retry-After seconds.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Retry-After:
              description: seconds to wait before retrying
              schema:
                type: integer
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            internal_error: an unexpected failure on our side; quote the request
            id. The body may instead be text/plain with no envelope and no
            X-RateLimit-* headers when a failure escapes the route's own
            handling.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            dependency_unavailable: one of our own stores could not be read;
            retry later.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Server-Timing:
              description: >-
                app;dur=<milliseconds, one decimal>: the time from the API
                receiving the request to starting this answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
      security:
        - ApiKey: []
          ApiSecret: []
          ClientId: []
      x-codeSamples:
        - label: cURL
          lang: bash
          source: >
            #!/bin/sh

            # getAccountBalances: Get your balance on every venue. Needs
            TRENDLINE_CLIENT_ID, TRENDLINE_API_KEY and TRENDLINE_API_SECRET;
            TRENDLINE_API_BASE overrides the base.

            curl -sS
            "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/account/balances"
            \
              -H "X-Client-Id: $TRENDLINE_CLIENT_ID" \
              -H "X-Api-Key: $TRENDLINE_API_KEY" \
              -H "X-Api-Secret: $TRENDLINE_API_SECRET"
        - label: Python
          lang: python
          source: >
            """getAccountBalances: Get your balance on every venue. Needs
            TRENDLINE_CLIENT_ID, TRENDLINE_API_KEY and TRENDLINE_API_SECRET;
            TRENDLINE_API_BASE overrides the base."""

            import os


            import requests


            BASE = os.environ.get("TRENDLINE_API_BASE",
            "https://systems.trendlinelabs.ai")

            HEADERS = {"X-Client-Id": os.environ["TRENDLINE_CLIENT_ID"],
            "X-Api-Key": os.environ["TRENDLINE_API_KEY"],
                       "X-Api-Secret": os.environ["TRENDLINE_API_SECRET"]}

            r = requests.get(f"{BASE}/public/v1/account/balances", params={},
            headers=HEADERS, timeout=10)

            r.raise_for_status()

            print(r.json())
        - label: JavaScript
          lang: javascript
          source: >
            // getAccountBalances: Get your balance on every venue. Needs
            TRENDLINE_CLIENT_ID, TRENDLINE_API_KEY and TRENDLINE_API_SECRET;
            TRENDLINE_API_BASE overrides the base.

            const BASE = process.env.TRENDLINE_API_BASE ??
            "https://systems.trendlinelabs.ai";

            const HEADERS = { "X-Client-Id": process.env.TRENDLINE_CLIENT_ID,
            "X-Api-Key": process.env.TRENDLINE_API_KEY,
              "X-Api-Secret": process.env.TRENDLINE_API_SECRET };
            const r = await fetch(`${BASE}/public/v1/account/balances`, {
            headers: HEADERS });

            console.log(r.status, await r.json());
components:
  schemas:
    PublicAccountBalances:
      properties:
        as_of_ms:
          description: when the balances were read, unix milliseconds
          title: As Of Ms
          type: integer
        venues:
          $ref: '#/components/schemas/PublicAccountVenues'
          description: every venue, always all four, each with its status
      required:
        - venues
        - as_of_ms
      title: PublicAccountBalances
      type: object
    PublicError:
      properties:
        error:
          $ref: '#/components/schemas/PublicErrorBody'
          description: the refusal
      required:
        - error
      title: PublicError
      type: object
    PublicAccountVenues:
      properties:
        kalshi:
          $ref: '#/components/schemas/PublicVenueBalance'
          description: your Kalshi balance
        limitless:
          $ref: '#/components/schemas/PublicVenueBalance'
          description: your Limitless balance
        polymarket:
          $ref: '#/components/schemas/PublicVenueBalance'
          description: your Polymarket balance
        predictfun:
          $ref: '#/components/schemas/PublicVenueBalance'
          description: your predict.fun balance
      required:
        - kalshi
        - polymarket
        - limitless
        - predictfun
      title: PublicAccountVenues
      type: object
    PublicErrorBody:
      properties:
        code:
          description: >-
            a machine-readable code from x-known-codes; a new code may be added,
            so handle an unknown one by its status
          title: Code
          type: string
          x-known-codes:
            - access_not_granted
            - dependency_unavailable
            - geo_blocked
            - idempotency_conflict
            - insufficient_scope
            - internal_error
            - invalid_request
            - ip_not_allowed
            - jurisdiction_refused
            - limit_exceeded
            - market_closed
            - not_found
            - order_not_cancellable
            - order_not_found
            - price_off_tick
            - rate_limited
            - request_in_progress
            - tier_required
            - trade_not_granted
            - trading_halted
            - trading_tier_required
            - unauthorized
            - upstream_unavailable
            - venue_auth_failed
            - venue_busy
            - venue_leg_unverified
            - venue_not_connected
            - venue_not_listed
            - venue_rejected
            - venue_unavailable
            - venue_unsupported
        message:
          description: a human-readable explanation; never parse it
          title: Message
          type: string
        request_id:
          description: >-
            this request's id, also sent as the X-Request-Id header; quote it
            when asking for help
          title: Request Id
          type: string
      required:
        - code
        - message
        - request_id
      title: PublicErrorBody
      type: object
    PublicVenueBalance:
      properties:
        held:
          anyOf:
            - items:
                $ref: '#/components/schemas/PublicHeld'
              type: array
            - type: 'null'
          description: >-
            each address read, with its amounts; present only when `status` is
            ok
          title: Held
        reason:
          anyOf:
            - enum:
                - no_credential
                - no_wallet
                - no_clob_credentials
                - no_profile
                - profile_held_elsewhere
                - empty_answer_unverified
                - timeout
                - venue_error
                - venue_rate_limited
                - bad_response
                - credential_store
                - too_many_rows
                - venue_busy
                - venue_auth_failed
                - venue_disabled
                - not_built
              type: string
            - type: 'null'
          description: why the venue is not ok; null when ok
          title: Reason
        status:
          description: ok, not_connected, unavailable or unsupported
          enum:
            - ok
            - not_connected
            - unavailable
            - unsupported
          title: Status
          type: string
        wallet:
          anyOf:
            - type: string
            - type: 'null'
          description: the wallet the venue is read for, when it has one
          title: Wallet
      required:
        - status
      title: PublicVenueBalance
      type: object
    PublicHeld:
      properties:
        address:
          anyOf:
            - type: string
            - type: 'null'
          description: the funder address read; null for Kalshi
          title: Address
        amounts:
          description: the amounts held at this address
          items:
            $ref: '#/components/schemas/PublicAmount'
          title: Amounts
          type: array
        kinds:
          description: >-
            what the address is: account, wallet, deposit_wallet, safe,
            gamma_proxy or eoa
          items:
            enum:
              - account
              - wallet
              - deposit_wallet
              - safe
              - gamma_proxy
              - eoa
            type: string
          minItems: 1
          title: Kinds
          type: array
      required:
        - address
        - kinds
        - amounts
      title: PublicHeld
      type: object
    PublicAmount:
      properties:
        amount:
          description: exactly `amount_base_units` x 10^-decimals, as a decimal string
          title: Amount
          type: string
        amount_base_units:
          description: an integer string in the asset's base units
          pattern: ^[0-9]+$
          title: Amount Base Units
          type: string
        asset:
          description: the asset held, for example USD, USDC, pUSD or USDC.e
          title: Asset
          type: string
        chain:
          anyOf:
            - type: string
            - type: 'null'
          description: the chain the asset is on; null off-chain
          title: Chain
        decimals:
          description: decimal places between `amount_base_units` and `amount`
          minimum: 0
          title: Decimals
          type: integer
        source:
          description: where the amount was read
          title: Source
          type: string
      required:
        - asset
        - decimals
        - amount_base_units
        - amount
        - source
      title: PublicAmount
      type: object
  securitySchemes:
    ApiKey:
      description: the key's id; public
      in: header
      name: X-Api-Key
      type: apiKey
    ApiSecret:
      description: >-
        the key's secret (tl_live_…), shown once at creation; never log or share
        it
      in: header
      name: X-Api-Secret
      type: apiKey
    ClientId:
      description: the key's own client id (cli_…), different for every key; public
      in: header
      name: X-Client-Id
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.