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

# Portfolio

> Consolidated portfolio: balance, stats, status counts, and summary.



## OpenAPI

````yaml GET /v1/portfolio
openapi: 3.0.3
info:
  title: Totalis RFQ API
  version: 2.1.0
  description: >-
    Public REST surface for the Totalis parlay RFQ platform — a decentralized
    request-for-quote marketplace for parlay bets across Kalshi and Polymarket,
    with on-chain Solana vault settlement.


    **Wire format**: snake_case JSON. All successful responses are wrapped in `{
    "data": ... }`; list endpoints add `meta` with cursor-based pagination.
    Errors use a `{ "error": { code, message, details? } }` envelope.


    **Authentication**: programmatic clients send `X-API-Key`; the web dashboard
    uses Privy JWTs (`Authorization: Bearer ...`). Any authenticated user can
    both place parlays and quote as a market maker — there is no separate MM
    role. Admin endpoints are out of scope for this public reference.


    **Rate limiting**: 100 req/min anonymous, 300 req/min authenticated.
    Responses include `X-RateLimit-*` headers. Request body limit: 256KB.


    **Pagination**: list endpoints use opaque cursor pagination. Pass
    `meta.cursor` from the previous response as `?cursor=...` to fetch the next
    page; do not parse or construct cursors client-side.
servers:
  - url: https://api.totalis.trade
    description: Production
security:
  - ApiKey: []
tags:
  - name: Markets
    description: Cached Kalshi and Polymarket market data.
  - name: User
    description: User profile, wallet, and devnet helpers.
  - name: API Keys
    description: Manage programmatic access keys for the authenticated user.
paths:
  /v1/portfolio:
    get:
      tags:
        - User
      summary: Consolidated portfolio (balance, stats, counts, summary)
      description: >
        Returns the user's full portfolio in a single batched query: vault
        balance,

        trading stats, RFQ status counts, and active-bet summary. Balance is
        null

        when the user has no vault (never traded).
      operationId: getUserPortfolio
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PortfolioData'
      security:
        - PrivyJWT: []
        - ApiKey: []
components:
  schemas:
    PortfolioData:
      type: object
      description: Consolidated portfolio response from GET /v1/portfolio.
      properties:
        balance:
          nullable: true
          description: Null when user has no vault (never traded)
          allOf:
            - $ref: '#/components/schemas/PortfolioBalance'
        stats:
          $ref: '#/components/schemas/UserStats'
        counts:
          $ref: '#/components/schemas/RfqCounts'
        summary:
          $ref: '#/components/schemas/PortfolioSummary'
    PortfolioBalance:
      type: object
      description: |
        Caller's vault balance (DB-cached, no RPC). Null only when the
        caller has no vault row at all. For dual-role accounts the
        bettor-side vault is preferred and the maker-side row is used
        as a fallback (same rules as `GET /v1/vault`).
      properties:
        gross_balance:
          type: number
        locked_collateral:
          type: number
        free_balance:
          type: number
        vault_pda:
          type: string
        vault_token_account:
          type: string
    UserStats:
      type: object
      properties:
        total_parlays:
          type: integer
        wins:
          type: integer
        losses:
          type: integer
        total_wagered:
          type: number
        realized_pnl:
          type: number
        updated_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Null when the user has never settled a trade (no rfq.user_stats row
            yet).
    RfqCounts:
      type: object
      properties:
        open:
          type: integer
        quoted:
          type: integer
        accepted:
          type: integer
        confirmed:
          type: integer
        executed:
          type: integer
          description: >-
            Positions on-chain but not yet resolved. Distinct from total_settled
            — settled means market resolution + payout distributed.
        total_settled:
          type: integer
        total_cancelled:
          type: integer
        total_expired:
          type: integer
        total_failed:
          type: integer
          description: >-
            Parlays where the vault position errored on-chain. Derived from
            vault_positions.status = 'error'.
    PortfolioSummary:
      type: object
      description: Derived portfolio-level aggregates from active positions.
      properties:
        active_count:
          type: integer
          description: Number of active (non-terminal) RFQs
        active_bet_total:
          type: number
          description: Sum of bet_amount across active RFQs
        portfolio_value:
          type: number
          description: >-
            Gross vault balance (deposited USDC). Does not include unrealized
            P&L.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Programmatic API key. Sent as `X-API-Key: <key>`. Generate one from the
        Totalis dashboard. The same header is accepted on the WebSocket auth
        message.
    PrivyJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Privy JWT issued to the web dashboard. Sent as `Authorization: Bearer
        <jwt>`. The Privy session signer underpins all wallet-signed actions.

````