> ## 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.

# Get P&L

> Your cumulative trading P&L over one range, for the account your Portfolio shows; a window's change is its last point minus its first.

Requires a key for your account with `account:read`.



## OpenAPI

````yaml /hyperliquid/openapi.json get /v1/me/pnl
openapi: 3.1.1
info:
  title: Totalis Hyperliquid API
  description: >-
    REST API for Totalis singles and parlays on Hyperliquid HIP-4 outcome
    markets, for client integrations and external market makers.


    Authenticate with a scoped API key created in the Totalis app, sent as
    `Authorization: Bearer <key>`. Public market reads need no key.
    Balance-affecting commands also carry the wallet or maker signature the
    HyperEVM contract verifies.


    Amounts are base-10 strings in native USDC atomic units, large identifiers
    are decimal strings, and every command `POST` requires an `Idempotency-Key`
    header.


    Every error is `{error: {code, message, retry, request_id,
    field_violations}}`. `code` is stable; each operation lists the codes it
    returns per status. `retry` is `NEVER` (stop), `BACKOFF` (resend the same
    request with the same `Idempotency-Key` after `Retry-After` seconds) or
    `REFRESH` (re-read state, then send a new request with a new key).
    `field_violations` names invalid inputs by JSON pointer, such as
    `/legs/0/side`.
  version: 142.0.0-core-funding-dropped
servers:
  - url: https://hip4-api.totalis.trade
    description: Production public edge
security: []
tags:
  - name: Markets
    description: HIP-4 markets, their sides and price history. No API key needed.
  - name: RFQs & Quotes
    description: >-
      RFQs and the quotes that answer them: what a taker calls, then what a
      maker calls.
  - name: Positions
    description: Positions the account holds, or its maker backs.
  - name: Account
    description: >-
      The account a key acts for: identity, balances, activity, operations and
      withdrawals.
  - name: Makers
    description: 'The rest of a maker''s setup after Making: capital and collateral.'
  - name: Deployment
    description: The contract deployment every signature is made against.
  - name: WebSocket
    description: The authenticated WebSocket for account and maker updates.
paths:
  /v1/me/pnl:
    get:
      tags:
        - Account
      summary: Get P&L
      description: >-
        Your cumulative trading P&L over one range, for the account your
        Portfolio shows; a window's change is its last point minus its first.


        Requires a key for your account with `account:read`.
      operationId: getAccountPnl
      parameters:
        - $ref: '#/components/parameters/PnlRangeQueryOptional'
        - name: Origin
          in: header
          required: false
          schema:
            type: string
          description: Required for browser sessions; API keys do not require an Origin.
          example: https://totalis.trade
      responses:
        '200':
          description: >-
            Your P&L series with one freshness status; points are cumulative
            atomic USDC strings, or null where a held share had no known value.
            No shared caching.
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControl'
            Vary:
              $ref: '#/components/headers/Vary'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PnL'
              example:
                range: 1D
                tracked_since: '2026-09-08T00:00:00Z'
                points:
                  - at: '2026-09-16T12:03:20Z'
                    pnl: '1250000'
                  - at: '2026-09-16T12:15:00Z'
                    pnl: '1250000'
                  - at: '2026-09-17T12:00:00Z'
                    pnl: null
                  - at: '2026-09-17T12:03:20Z'
                    pnl: '1360000'
                context:
                  as_of: '2026-09-17T12:03:20Z'
                  status: CURRENT
        '400':
          description: >-
            - `INVALID_QUERY` (retry `NEVER`): A query parameter is malformed,
            out of range or not accepted by this operation. `field_violations`
            names it.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
        '401':
          description: >-
            - `UNAUTHENTICATED` (retry `NEVER`): The credential is missing,
            invalid, expired or revoked.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
        '403':
          description: >-
            - `FORBIDDEN` (retry `NEVER`): The credential is valid but lacks the
            scope, permission or role this operation needs.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
        '429':
          description: >-
            - `RATE_LIMITED` (retry `BACKOFF`): The request quota for this
            credential or route is exhausted.
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
        '503':
          description: >-
            P&L is temporarily unavailable; resend after `Retry-After`.


            - `AUTHORIZATION_UNAVAILABLE` (retry `BACKOFF`): Identity or
            credential authority storage is unavailable.

            - `SOURCE_UNAVAILABLE` (retry `BACKOFF`): The account-read or stream
            source is unavailable.

            - `CONTRACT_UNAVAILABLE` (retry `BACKOFF`): This producer is
            disabled in this environment.
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
      security:
        - apiKey:
            - account:read
components:
  parameters:
    PnlRangeQueryOptional:
      name: range
      in: query
      required: false
      description: 'Window of the series: 1D, 1W, 1M (default) or ALL since tracking began.'
      example: 1D
      schema:
        type: string
        enum:
          - 1D
          - 1W
          - 1M
          - ALL
        default: 1M
  headers:
    CacheControl:
      description: Always `no-store`; account data must not be cached.
      schema:
        const: no-store
    Vary:
      schema:
        type: string
      description: >-
        The response varies by the Authorization header, so shared caches must
        not reuse it across credentials.
    RetryAfter:
      description: Seconds to wait before resending the same request
      schema:
        type: integer
        minimum: 1
  schemas:
    PnL:
      type: object
      additionalProperties: false
      required:
        - range
        - tracked_since
        - points
        - context
      description: >-
        Cumulative trading P&L of the account Portfolio shows, computed on read:
        Core trading plus Combos closed in the deployment's vault. Points are
        cumulative since tracked_since, not rebased: a window's change is its
        last point minus its first. Deposits, withdrawals and moves between Core
        and the vault never move it.
      properties:
        range:
          type: string
          enum:
            - 1D
            - 1W
            - 1M
            - ALL
          description: The requested range, echoed.
        tracked_since:
          oneOf:
            - $ref: '#/components/schemas/Timestamp'
            - type: 'null'
          description: >-
            Start of the account's recorded Core history; P&L is cumulative from
            here. It does not prove that history is complete: a fill gap, an
            unbridged cash gap or holdings the history cannot reproduce make the
            read UNAVAILABLE with tracked_since still set. Null while the wallet
            is not yet observed, with no points and a STALE context.
        points:
          type: array
          maxItems: 400
          description: >-
            Ascending instants: the window start (never before tracked_since),
            every round UTC step boundary inside it (1D every 15 minutes, 1W
            every hour, 1M every 6 hours, ALL an adaptive step of at most 200
            points), then the read time valued at live marks.
          items:
            type: object
            additionalProperties: false
            required:
              - at
              - pnl
            properties:
              at:
                $ref: '#/components/schemas/Timestamp'
                description: Point time.
              pnl:
                oneOf:
                  - $ref: '#/components/schemas/SignedAmount'
                  - type: 'null'
                description: >-
                  Cumulative P&L from tracked_since up to at, in atomic USDC (6
                  decimals, "1000000" = 1 USDC), rounded once, half away from
                  zero. Null when a share held at at has no known value, when at
                  precedes the first known value of shares held at tracked_since
                  (every earlier point is null), or when the read is
                  UNAVAILABLE; null is never zero.
        context:
          $ref: '#/components/schemas/ReadContext'
          description: >-
            Freshness of this read. as_of is the valuation instant, the last
            point's at: it values the covered history at that instant's marks,
            and STALE says a source lags. UNAVAILABLE nulls every point.
    Error:
      additionalProperties: false
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: The one error this request failed with.
      required:
        - error
      type: object
    Timestamp:
      type: string
      format: date-time
    SignedAmount:
      type: string
      pattern: ^(0|-?[1-9][0-9]{0,77})$
    ReadContext:
      type: object
      additionalProperties: false
      required:
        - as_of
        - status
      properties:
        as_of:
          $ref: '#/components/schemas/Timestamp'
          description: RFC3339 observation time of the oldest source this read used.
        status:
          type: string
          enum:
            - CURRENT
            - STALE
            - UNAVAILABLE
          description: >-
            Freshness of the whole read. CURRENT: every source is fresh and
            reconciled. STALE: a source lags or has not reconciled, such as a
            catching-up projection, a pending reorg rescan or a period not fully
            covered; amounts may be displayed with their age but never authorize
            an action. UNAVAILABLE: a required source could not be read, so the
            amounts it backs are null.
      description: >-
        Freshness of the read. Pages of one list share the snapshot bound into
        their cursor.
    ErrorDetail:
      additionalProperties: false
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
          description: Stable registered code; branch on this, not on message or status.
        field_violations:
          description: >-
            Each invalid input by JSON pointer; empty when the error is not
            about a specific input.
          items:
            $ref: '#/components/schemas/FieldViolation'
          type: array
        message:
          description: Human-readable; may change without notice.
          minLength: 1
          type: string
        request_id:
          description: >-
            UUIDv7 of this request, also returned in the X-Request-ID header.
            Quote it when reporting a problem.
          format: uuid
          pattern: >-
            ^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          type: string
        retry:
          $ref: '#/components/schemas/Retry'
          description: What the caller should do next; fixed by the registry for each code.
      required:
        - code
        - message
        - retry
        - request_id
        - field_violations
      type: object
    ErrorCode:
      description: >-
        Stable HTTP error code. Each code has one HTTP status and one retry
        value.
      enum:
        - INVALID_REQUEST
        - INVALID_QUERY
        - INVALID_CURSOR
        - INVALID_IDEMPOTENCY_KEY
        - ORIGIN_REQUIRED
        - SUBPROTOCOL_REQUIRED
        - UNSUPPORTED_BROWSE_CONTRACT
        - UNAUTHENTICATED
        - FORBIDDEN
        - ORIGIN_NOT_ALLOWED
        - ACCESS_REQUIRED
        - NOT_FOUND
        - IDENTITY_NOT_FOUND
        - QUOTE_NOT_FOUND
        - INVITE_CODE_NOT_FOUND
        - IDEMPOTENCY_KEY_REUSED
        - STATE_CONFLICT
        - INVITE_CODE_EXHAUSTED
        - STALE_CURSOR
        - CURSOR_EXPIRED
        - CURSOR_RESET
        - RECURRING_DEFINITION_CONFLICT
        - EMBEDDED_WALLET_CONFLICT
        - SECRET_UNAVAILABLE
        - ROTATION_IN_PROGRESS
        - TELEMETRY_CONFLICT
        - RFQ_NOT_CANCELLABLE
        - RFQ_NOT_OPEN
        - RFQ_GENERATION_STALE
        - RFQ_GENERATION_IN_FLIGHT
        - QUOTE_EXPIRED
        - QUOTE_CANCELLED
        - QUOTE_REPLACED
        - QUOTE_SIGNER_CHANGED
        - QUOTE_CAPACITY_EXCEEDED
        - CORE_ACCOUNT_NOT_READY
        - CORE_EXIT_ABANDONED
        - CORE_MOVE_IN_FLIGHT
        - USERNAME_TAKEN
        - USERNAME_ALREADY_SET
        - INVALID_SIGNATURE
        - WALLET_CONTRACT_UNSUPPORTED
        - WRONG_AUTHORITY
        - KEY_LIMIT_REACHED
        - HYPERCORE_WALLET_UNQUALIFIED
        - HYPERCORE_ACCOUNT_NOT_MAIN
        - HYPERCORE_INSUFFICIENT_BALANCE
        - USERNAME_NOT_ALLOWED
        - RATE_LIMITED
        - CONNECTION_LIMIT
        - RFQ_INTENT_LIMIT
        - QUOTE_EXPOSURE_LIMIT
        - DEPENDENCY_STALE
        - AUTHORIZATION_UNAVAILABLE
        - SOURCE_UNAVAILABLE
        - CONTRACT_UNAVAILABLE
        - MARKET_DATA_UNAVAILABLE
        - BROWSE_UNAVAILABLE
        - FINANCIAL_ACTIONS_DISABLED
        - CORE_EXIT_UNAVAILABLE
        - COLLATERAL_REDUCTION_UNAVAILABLE
        - SPONSORSHIP_UNAVAILABLE
        - CONTRACT_SIGNATURE_OVERLOADED
        - QUOTE_EXPOSURE_STALE
        - COMBO_AUTOMATIC_DISABLED
        - EMBEDDED_WALLET_UNAVAILABLE
        - CONNECTION_DRAIN
      type: string
    FieldViolation:
      additionalProperties: false
      properties:
        code:
          description: >-
            REQUIRED: the input is missing. INVALID: it is present but malformed
            or out of range. UNEXPECTED: the input is not accepted here.
          enum:
            - REQUIRED
            - INVALID
            - UNEXPECTED
          type: string
        field:
          description: >-
            JSON pointer into the body, or into the query parameters as one flat
            object for requests without a body, for example /legs/0/stake or
            /limit.
          pattern: ^(/([^~/]|~[01])*)+$
          type: string
      required:
        - field
        - code
      type: object
    Retry:
      description: >-
        NEVER: stop. BACKOFF: resend the same request with the same
        Idempotency-Key after Retry-After. REFRESH: re-read state, then send a
        new request with a new Idempotency-Key.
      enum:
        - NEVER
        - BACKOFF
        - REFRESH
      type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Scoped API key from the Totalis app settings. Each key acts for one
        account, yours or a maker's, and holds only scopes that account can use.
        Each operation lists the scopes it requires.

````

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