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

# Risk History

> Read paginated liquidation, ADL, and risk-vault events.

Read paginated liquidation, ADL, and risk-vault events. This is an unsigned `POST /account` query with
`type: "riskHistory"`, not a separate endpoint.

## Query target

Use a master, sub-account, or physical isolated-account public key.

Preserve event identity and coverage metadata when reconciling risk events. Current margin and positions are available through [Account Snapshot](https://docs.bulk.trade/api-reference/account/snapshot.md).

## Pagination

Rows are newest-first. Start with optional inclusive `startSlot` and `endSlot`
bounds and `limit` (1–5000; default 5000). Continue with `page.nextCursor`,
keeping `user` and `type` unchanged; you may change `limit` but must omit slot
bounds. Stop when `hasMore` is false. Newer events need a new first-page request.

HTTP `206` can carry partial or unknown coverage. Neither an empty page nor
`hasMore: false` proves complete history. On `409`, preserve the coverage gap;
on `410`, restart and deduplicate; on `503`, back off and retry. See the shared
[history rules](https://docs.bulk.trade/api-reference/getAccount.md#history-queries) for errors and coverage.


## OpenAPI

````yaml api-reference/account/openapi-risk-history.yaml POST /account
openapi: 3.0.3
info:
  title: Bulk Trade API - Risk History
  version: 1.0.0
servers:
  - url: https://mainnet-api1.bulk.trade/api/v1
    description: Mainnet
  - url: https://exchange-api.bulk.trade/api/v1
    description: Testnet
security: []
paths:
  /account:
    post:
      summary: Risk History
      description: >-
        Read paginated liquidation, ADL, and risk-vault events. No signature
        required. Use a master, sub-account, or physical isolated-account public
        key. First-page slot bounds are inclusive. A continuation keeps type and
        user, uses the returned cursor, and cannot include slot bounds.
      operationId: queryAccountRiskHistory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - type
                - user
              not:
                anyOf:
                  - required:
                      - cursor
                      - startSlot
                  - required:
                      - cursor
                      - endSlot
              properties:
                type:
                  type: string
                  enum:
                    - riskHistory
                  default: riskHistory
                user:
                  type: string
                  description: >-
                    Paste the account public key (base58). No account is
                    selected for you.
                limit:
                  type: integer
                  minimum: 1
                  maximum: 5000
                  default: 5000
                  description: Optional page size for history queries
                  example: 2
                startSlot:
                  type: integer
                  format: int64
                  minimum: 0
                  description: >-
                    Optional inclusive lower slot bound for the first history
                    page
                endSlot:
                  type: integer
                  format: int64
                  minimum: 0
                  description: >-
                    Optional inclusive upper slot bound for the first history
                    page
                cursor:
                  type: string
                  description: >-
                    Opaque history continuation; cannot be combined with slot
                    bounds
            example:
              type: riskHistory
              user: ''
              limit: 2
      responses:
        '200':
          description: >-
            Typed history page; inspect page coverage independently of
            pagination; illustrative example, not live data for the supplied
            account
          content:
            application/json:
              example:
                data: []
                page:
                  nextCursor: null
                  hasMore: false
                  asOfSlot: 13000
                  startSlot: 12000
                  endSlot: 13000
                  coverage: complete
              schema:
                type: object
                required:
                  - data
                  - page
                properties:
                  data:
                    type: array
                    items:
                      allOf:
                        - type: object
                          description: >-
                            Typed liquidation, ADL, or risk-vault row returned
                            by paginated account history
                          required:
                            - owner
                            - symbol
                            - isBuy
                            - amount
                            - price
                            - eventType
                            - iso
                            - slot
                            - timestamp
                            - sequence
                          properties:
                            owner:
                              type: string
                              description: >-
                                Account pubkey on which the event was recorded
                                (base58)
                            symbol:
                              type: string
                            isBuy:
                              type: boolean
                              description: Queried account side
                            amount:
                              type: number
                            price:
                              type: number
                            eventType:
                              type: string
                              enum:
                                - liquidation
                                - adl
                                - risk_vault
                            marginPrior:
                              type: number
                              description: >-
                                Optional margin balance before the event;
                                omitted when unavailable
                            marginAfter:
                              type: number
                              description: >-
                                Optional margin balance after the event; omitted
                                when unavailable
                            reason:
                              type: string
                              description: >-
                                Optional human-readable reason; omitted when
                                unavailable
                            iso:
                              type: boolean
                            isoPubkey:
                              type: string
                              description: >-
                                Present only when `iso=true`; isolated-lane
                                account pubkey (base58)
                            slot:
                              type: integer
                              format: int64
                            timestamp:
                              type: integer
                              format: int64
                              description: Event timestamp (nanoseconds)
                            sequence:
                              type: integer
                              format: int64
                        - type: object
                          required:
                            - owner
                            - symbol
                            - isBuy
                            - amount
                            - price
                            - eventType
                            - iso
                            - slot
                            - timestamp
                            - sequence
                  page:
                    type: object
                    required:
                      - nextCursor
                      - hasMore
                      - asOfSlot
                      - startSlot
                      - endSlot
                      - coverage
                    properties:
                      nextCursor:
                        type: string
                        nullable: true
                        description: >-
                          Opaque exclusive continuation; null exactly when
                          hasMore is false
                      hasMore:
                        type: boolean
                      asOfSlot:
                        type: integer
                        format: int64
                        minimum: 0
                      startSlot:
                        type: integer
                        format: int64
                        minimum: 0
                      endSlot:
                        type: integer
                        format: int64
                        minimum: 0
                      coverage:
                        type: string
                        enum:
                          - complete
                          - partial
                          - unknown
                        description: >-
                          Coverage of the effective inclusive range. Backfill
                          proof is fixed at its inclusive cutoff and is not
                          advanced by newer live rows.
                      minAvailableSlot:
                        type: integer
                        format: int64
                        minimum: 0
                        description: >-
                          Earliest authoritative slot for this direct or
                          aggregate history scope; primary and parent-alias
                          retention floors are independent. Omitted when
                          unknown.
        '206':
          description: >-
            Incomplete history page when partial reads are enabled; inspect page
            coverage
          headers:
            X-Bulk-History-Status:
              description: Coverage status
              schema:
                type: string
                enum:
                  - partial
                  - unknown
            X-Bulk-History-Min-Available-Slot:
              description: Earliest authoritative available slot; omitted when unknown
              schema:
                type: integer
                format: int64
                minimum: 0
          content:
            application/json:
              schema:
                $ref: ab1bec4e-5adb-4bec-9020-59c8fa352718
        '400':
          description: >-
            Invalid current-state request or malformed history query, limit,
            slot range, or cursor
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        enum:
                          - INVALID_HISTORY_QUERY
                          - INVALID_HISTORY_LIMIT
                          - INVALID_SLOT_RANGE
                          - CURSOR_INVALID
                          - ACCOUNT_NOT_FOUND
                          - HISTORY_NOT_COVERED
                          - CURSOR_EXPIRED
                          - HISTORY_STATE_NOT_READY
                          - HISTORY_BUSY
                          - HISTORY_STORAGE_ERROR
                      message:
                        type: string
        '404':
          description: >-
            The current-state account or history scope was not found. History
            requests return the structured error envelope when a JSON body is
            present.
          content:
            application/json:
              schema:
                $ref: ee727732-d1b9-46f0-b643-3dc36e8eae99
        '408':
          description: >-
            Response timeout (60 seconds for orders, 5 seconds for current-state
            snapshot requests). An order may still execute; reconcile before
            submitting a replacement.
        '409':
          description: Strict coverage cannot satisfy the requested history range
          content:
            application/json:
              schema:
                $ref: ee727732-d1b9-46f0-b643-3dc36e8eae99
        '410':
          description: >-
            History scope, coverage, backfill, or retention changed after cursor
            issuance
          content:
            application/json:
              schema:
                $ref: ee727732-d1b9-46f0-b643-3dc36e8eae99
        '429':
          description: >-
            Request or action rate limit reached. Back off before retrying; the
            body may be plain text or empty.
        '500':
          description: >-
            Current-state request failure or history storage/decoding failure.
            History requests return the structured error envelope when a JSON
            body is present.
          content:
            application/json:
              schema:
                $ref: ee727732-d1b9-46f0-b643-3dc36e8eae99
        '503':
          description: >-
            History state is not ready, bounded read capacity is saturated, or
            the API is locked
          content:
            application/json:
              schema:
                oneOf:
                  - dbc0400f-4660-475a-812c-abff2991b4fb
                  - type: object
                    required:
                      - code
                      - error
                    properties:
                      code:
                        type: string
                        enum:
                          - API_LOCKED
                      error:
                        type: string
      security: []

````

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