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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.sqd.dev/feedback

```json
{
  "path": "/en/api/hyperliquid-replica-cmds/finalized-stream",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Stream Finalized Blocks

> Returns only finalized blocks matching the query. Same request format as /stream but never returns unfinalized blocks, so there are no chain reorganizations to handle (no 409 responses).




## OpenAPI

````yaml /en/api/catalog/hyperliquid/openapi-replica-cmds.yaml post /finalized-stream
openapi: 3.1.0
info:
  title: SQD Portal API - Hyperliquid Replica Commands Dataset Endpoints
  description: >-
    API endpoints for interacting with Hyperliquid replica commands datasets
    under the SQD Portal. Captures all L1 blockchain actions (orders, cancels,
    transfers, etc.) with their exchange responses.
  version: 1.0.0
servers:
  - url: https://portal.sqd.dev/datasets/hyperliquid-replica-cmds
    description: SQD Portal's endpoint for Hyperliquid Replica Commands (Mainnet)
security: []
paths:
  /finalized-stream:
    post:
      summary: Stream Finalized Blocks
      description: >
        Returns only finalized blocks matching the query. Same request format as
        /stream but never returns unfinalized blocks, so there are no chain
        reorganizations to handle (no 409 responses).
      requestBody:
        description: Data query to filter and retrieve finalized blocks
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataQuery'
            examples:
              user-actions:
                summary: >-
                  Get trading actions for a specific user (orders, cancels,
                  etc.)
                value:
                  type: hyperliquidReplicaCmds
                  fromBlock: 880000000
                  toBlock: 880000002
                  fields:
                    block:
                      number: true
                      timestamp: true
                    action:
                      actionIndex: true
                      user: true
                      action: true
                      status: true
                      response: true
                      nonce: true
                  actions:
                    - user:
                        - '0x010461c14e146ac35fe42271bdc1134ee31c703a'
      responses:
        '200':
          description: >-
            A stream of finalized blocks in JSON lines format, optionally
            gzipped.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Block'
              examples:
                user-actions-response:
                  summary: User trading actions response
                  value:
                    - header:
                        number: 880000001
                        timestamp: 1710000000000
                      actions:
                        - actionIndex: 0
                          user: '0x010461c14e146ac35fe42271bdc1134ee31c703a'
                          action:
                            type: order
                            orders:
                              - a: 3
                                b: true
                                p: '67234.5'
                                s: '0.1'
                                r: false
                                t:
                                  limit:
                                    tif: Gtc
                          status: ok
                          response:
                            type: order
                            data:
                              statuses:
                                - resting:
                                    oid: 12345678
                          nonce: 1710000000000
        '204':
          description: >-
            Indicates that the requested block range is entirely above the range
            of blocks available in the dataset.
          content:
            text/plain:
              schema:
                type: string
        '400':
          description: >
            Possible causes: (1) request headers or body encoding are incorrect;
            (2) the query is invalid - the response will include an explanation;
            (3) fromBlock is below the dataset's start_block (see /metadata).
          content:
            text/plain:
              schema:
                type: string
        '404':
          description: Dataset not found
          content:
            text/plain:
              schema:
                type: string
        '409':
          description: Conflict due to a mismatched parent block hash.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictResponse'
        '429':
          description: Too many requests; rate limit exceeded.
          content:
            text/plain:
              schema:
                type: string
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying
        '500':
          description: Internal server error. Do not retry requests causing these.
          content:
            text/plain:
              schema:
                type: string
        '503':
          description: >-
            The server could not process the request at the moment. The client
            should retry the request later.
          content:
            text/plain:
              schema:
                type: string
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying
      x-codeSamples:
        - lang: shell
          label: Get user trading actions (orders, cancels, etc.)
          source: >
            curl --compressed -X POST
            'https://portal.sqd.dev/datasets/hyperliquid-replica-cmds/finalized-stream'
            \
              -H 'Content-Type: application/json' \
              -d '{
                "type": "hyperliquidReplicaCmds",
                "fromBlock": 880000000,
                "toBlock": 880000002,
                "fields": {
                  "block": {
                    "number": true,
                    "timestamp": true
                  },
                  "action": {
                    "actionIndex": true,
                    "user": true,
                    "action": true,
                    "status": true,
                    "response": true,
                    "nonce": true
                  }
                },
                "actions": [{
                  "user": ["0x010461c14e146ac35fe42271bdc1134ee31c703a"]
                }]
              }'
        - lang: python
          label: Get user trading actions (orders, cancels, etc.)
          source: |
            import requests

            response = requests.post(
                "https://portal.sqd.dev/datasets/hyperliquid-replica-cmds/finalized-stream",
                json={
                    "type": "hyperliquidReplicaCmds",
                    "fromBlock": 880000000,
                    "toBlock": 880000002,
                    "fields": {
                        "block": {
                            "number": True,
                            "timestamp": True
                        },
                        "action": {
                            "actionIndex": True,
                            "user": True,
                            "action": True,
                            "status": True,
                            "response": True,
                            "nonce": True
                        }
                    },
                    "actions": [{
                        "user": ["0x010461c14e146ac35fe42271bdc1134ee31c703a"]
                    }]
                }
            )
            data = response.json()
        - lang: javascript
          label: Get user trading actions (orders, cancels, etc.)
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/hyperliquid-replica-cmds/finalized-stream",
            {
                method: "POST",
                headers: { "Content-Type": "application/json" },
                body: JSON.stringify({
                    "type": "hyperliquidReplicaCmds",
                    "fromBlock": 880000000,
                    "toBlock": 880000002,
                    "fields": {
                        "block": {
                            "number": true,
                            "timestamp": true
                        },
                        "action": {
                            "actionIndex": true,
                            "user": true,
                            "action": true,
                            "status": true,
                            "response": true,
                            "nonce": true
                        }
                    },
                    "actions": [{
                        "user": ["0x010461c14e146ac35fe42271bdc1134ee31c703a"]
                    }]
                })
            });

            const data = await response.json();
components:
  schemas:
    DataQuery:
      type: object
      properties:
        type:
          type: string
          enum:
            - hyperliquidReplicaCmds
          default: hyperliquidReplicaCmds
          description: The type of data (fixed to hyperliquidReplicaCmds for this API).
        fromBlock:
          type: integer
          format: int64
          description: The block number to start fetching from (inclusive).
        toBlock:
          type: integer
          format: int64
          description: >-
            The block number to fetch up to (inclusive). Optional; if omitted,
            streams until dataset height or timeout.
        parentBlockHash:
          type: string
          description: Expected hash of the parent of the first requested block.
        includeAllBlocks:
          type: boolean
          description: If true, includes blocks with no matching data in the response.
          default: false
        fields:
          type: object
          description: Field selector for data items to retrieve.
          properties:
            block:
              type: object
              description: Field selector for block headers.
              properties:
                number:
                  type: boolean
                  description: Include the block number.
                hash:
                  type: boolean
                  description: Include the block hash.
                parentHash:
                  type: boolean
                  description: Include the parent block hash.
                round:
                  type: boolean
                  description: Include the HyperBFT consensus round number.
                parentRound:
                  type: boolean
                  description: Include the parent block's consensus round number.
                proposer:
                  type: boolean
                  description: Include the validator address that proposed this block.
                timestamp:
                  type: boolean
                  description: Include the block timestamp.
                hardfork:
                  type: boolean
                  description: Include hardfork activation details, if any.
              default:
                number: true
                hash: true
                parentHash: true
            action:
              type: object
              description: Field selector for actions.
              properties:
                actionIndex:
                  type: boolean
                  description: Include the action index within the block.
                user:
                  type: boolean
                  description: Include the wallet address that submitted the action.
                action:
                  type: boolean
                  description: Include the action payload (order, cancel, transfer, etc.).
                signature:
                  type: boolean
                  description: Include the EIP-712 or L1 action signature.
                nonce:
                  type: boolean
                  description: Include the action sequence nonce.
                vaultAddress:
                  type: boolean
                  description: >-
                    Include the vault address if the action was submitted on
                    behalf of a vault.
                status:
                  type: boolean
                  description: Include the exchange processing result (ok or err).
                response:
                  type: boolean
                  description: Include the exchange response payload.
        actions:
          type: array
          description: >
            Generic action data requests. An empty object matches all actions;
            an empty array matches no actions. To filter by specialized action
            subtypes (orders, cancels, batch modifies), use the dedicated
            request arrays instead.
          items:
            type: object
            properties:
              actionType:
                type: array
                items:
                  type: string
                description: >
                  Action type strings to filter by (e.g., "order", "cancel",
                  "cancelByCloid", "batchModify", "transfer", "withdraw",
                  "updateLeverage").
              user:
                type: array
                items:
                  type: string
                description: >-
                  Trader wallet addresses (0x-prefixed hex, lowercase) to filter
                  by.
              vaultAddress:
                type: array
                items:
                  type: string
                description: >-
                  Vault addresses (0x-prefixed hex, lowercase) to filter by.
                  Matches actions submitted on behalf of a vault.
              status:
                type: string
                enum:
                  - ok
                  - err
                description: >-
                  Filter by action outcome. "ok" for successfully processed
                  actions, "err" for rejected actions.
        orderActions:
          type: array
          description: >
            Order action requests. Filters actions that contain order placements
            matching the given criteria. An empty object matches all order
            actions; an empty array matches none.
          items:
            type: object
            properties:
              containsAsset:
                type: array
                items:
                  type: integer
                  format: uint32
                description: >-
                  Asset indices to filter by. Matches order actions containing
                  at least one order for any of the given assets.
              containsCloid:
                type: array
                items:
                  type: string
                description: >-
                  Client order IDs (0x-prefixed hex) to filter by. Matches order
                  actions containing at least one order with any of the given
                  cloids.
              user:
                type: array
                items:
                  type: string
                description: >-
                  Trader wallet addresses (0x-prefixed hex, lowercase) to filter
                  by.
              vaultAddress:
                type: array
                items:
                  type: string
                description: Vault addresses (0x-prefixed hex, lowercase) to filter by.
              status:
                type: string
                enum:
                  - ok
                  - err
                description: Filter by action outcome.
        cancelActions:
          type: array
          description: >
            Cancel action requests. Filters actions that contain order
            cancellations matching the given criteria. An empty object matches
            all cancel actions; an empty array matches none.
          items:
            type: object
            properties:
              containsAsset:
                type: array
                items:
                  type: integer
                  format: uint32
                description: >-
                  Asset indices to filter by. Matches cancel actions containing
                  at least one cancellation for any of the given assets.
              user:
                type: array
                items:
                  type: string
                description: >-
                  Trader wallet addresses (0x-prefixed hex, lowercase) to filter
                  by.
              vaultAddress:
                type: array
                items:
                  type: string
                description: Vault addresses (0x-prefixed hex, lowercase) to filter by.
              status:
                type: string
                enum:
                  - ok
                  - err
                description: Filter by action outcome.
        cancelByCloidActions:
          type: array
          description: >
            Cancel-by-client-order-ID action requests. Filters cancellation
            actions referencing specific client order IDs. An empty object
            matches all such actions; an empty array matches none.
          items:
            type: object
            properties:
              containsAsset:
                type: array
                items:
                  type: integer
                  format: uint32
                description: Asset indices to filter by.
              containsCloid:
                type: array
                items:
                  type: string
                description: Client order IDs (0x-prefixed hex) to filter by.
              user:
                type: array
                items:
                  type: string
                description: >-
                  Trader wallet addresses (0x-prefixed hex, lowercase) to filter
                  by.
              vaultAddress:
                type: array
                items:
                  type: string
                description: Vault addresses (0x-prefixed hex, lowercase) to filter by.
              status:
                type: string
                enum:
                  - ok
                  - err
                description: Filter by action outcome.
        batchModifyActions:
          type: array
          description: >
            Batch modify action requests. Filters actions that contain batch
            order modifications. An empty object matches all batch modify
            actions; an empty array matches none.
          items:
            type: object
            properties:
              containsAsset:
                type: array
                items:
                  type: integer
                  format: uint32
                description: Asset indices to filter by.
              containsCloid:
                type: array
                items:
                  type: string
                description: Client order IDs (0x-prefixed hex) to filter by.
              user:
                type: array
                items:
                  type: string
                description: >-
                  Trader wallet addresses (0x-prefixed hex, lowercase) to filter
                  by.
              vaultAddress:
                type: array
                items:
                  type: string
                description: Vault addresses (0x-prefixed hex, lowercase) to filter by.
              status:
                type: string
                enum:
                  - ok
                  - err
                description: Filter by action outcome.
      required:
        - type
        - fromBlock
    Block:
      type: object
      properties:
        header:
          type: object
          description: >-
            Block header data. Fields are conditionally returned based on the
            `fields.block` parameter.
          properties:
            number:
              type: integer
              format: uint64
              description: Block number.
            hash:
              type: string
              description: Block hash (0x-prefixed hex).
            parentHash:
              type: string
              description: Parent block hash (0x-prefixed hex).
            round:
              type: integer
              format: uint64
              description: >-
                HyperBFT consensus round number in which this block was
                proposed.
            parentRound:
              type: integer
              format: uint64
              description: Consensus round of the parent block.
            proposer:
              type: string
              description: Validator address that proposed this block (0x-prefixed hex).
            timestamp:
              type: integer
              format: uint64
              description: Block timestamp in milliseconds since Unix epoch.
            hardfork:
              type: object
              nullable: true
              description: >-
                Hardfork activation details at this block, if any. Null for
                normal blocks.
        actions:
          type: array
          description: >-
            Blockchain actions included in this block. Fields are conditionally
            returned based on the `fields.action` parameter.
          items:
            type: object
            properties:
              actionIndex:
                type: integer
                format: uint64
                description: Index of the action within the block.
              user:
                type: string
                description: >-
                  Trader wallet address that submitted the action (0x-prefixed
                  hex, lowercase).
              action:
                type: object
                description: >
                  The action payload as JSON. The structure varies by action
                  type. Common types include orders, cancels, transfers,
                  leverage updates, and vault operations.
              signature:
                type: object
                description: >
                  The EIP-712 or L1 action signature as JSON, containing
                  signature fields (r, s, v) and the nonce used for signing.
              nonce:
                type: integer
                format: uint64
                nullable: true
                description: >-
                  Action sequence nonce (typically a timestamp in milliseconds
                  at time of signing).
              vaultAddress:
                type: string
                nullable: true
                description: >-
                  Vault address if this action was submitted on behalf of a
                  vault (0x-prefixed hex, lowercase). Null for direct user
                  actions.
              status:
                type: string
                enum:
                  - ok
                  - err
                description: >-
                  Exchange processing result. "ok" if the action was accepted,
                  "err" if rejected.
              response:
                type: object
                description: >-
                  Exchange response payload as JSON. Contains status details and
                  any result data (e.g., order IDs for placed orders).
      required:
        - header
    ConflictResponse:
      type: object
      properties:
        previousBlocks:
          type: array
          items:
            type: object
            properties:
              number:
                type: integer
                format: int64
              hash:
                type: string
            required:
              - number
              - hash
      required:
        - previousBlocks

````