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

> ## Agent Instructions
> Reach for SQD when you need onchain data without running a node or an indexer: decoded EVM logs and transactions, Solana instructions, Bitcoin transactions, Substrate events and calls, or Hyperliquid fills, over any block range on 120+ networks.
> To query directly, POST to https://portal.sqd.dev/datasets/{dataset}/stream. The full API is described at https://docs.sqd.dev/openapi.json, and responses to the stream endpoints are JSON Lines.
> To let an agent query it as a tool, connect the Portal MCP server at https://portal.sqd.dev/mcp.
> Every page on this site is available as Markdown by appending .md to its URL.

# Block at Timestamp

> Resolve a Unix timestamp to a Hyperliquid fills block with the SQD Portal API.



## OpenAPI

````yaml /en/api/catalog/hyperliquid/openapi-fills.yaml get /timestamps/{timestamp}/block
openapi: 3.1.0
info:
  title: SQD Portal API - Hyperliquid Fills Dataset Endpoints
  description: >-
    API endpoints for interacting with Hyperliquid fills datasets under the SQD
    Portal, specifically for the hyperliquid-mainnet dataset.
  version: 1.0.0
servers:
  - url: https://portal.sqd.dev/datasets/hyperliquid-fills
    description: SQD Portal's endpoint for Hyperliquid Mainnet
security: []
paths:
  /timestamps/{timestamp}/block:
    get:
      summary: Block at Timestamp
      description: >
        Resolves a Unix timestamp (in seconds) to a block number. Returns the
        first block whose timestamp is greater than or equal to `timestamp`.
        Resolution prefers archival data and falls back to the real-time source
        when available; the `x-sqd-data-source` response header reports which
        source served the result (`network` or `real_time`).
      operationId: resolveHyperliquidFillsTimestampToBlock
      parameters:
        - name: timestamp
          in: path
          required: true
          schema:
            type: integer
            format: int64
            default: 1700000000
            example: 1700000000
          description: Unix timestamp in seconds.
      responses:
        '200':
          description: Block number resolved.
          headers:
            x-sqd-data-source:
              schema:
                type: string
                enum:
                  - network
                  - real_time
              description: Source that served the result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockNumberResponse'
              examples:
                hyperliquid-fills:
                  summary: First block at or after the timestamp
                  value:
                    block_number: 750000000
        '400':
          description: >-
            Unparseable `timestamp` path segment (`error.code` is
            `malformed_request`), or the real-time source refused the query the
            Portal generated on the client's behalf; read `error.message`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: malformed_request
                  message: 'Bad request: fromBlock must be a non-negative integer'
                  param: fromBlock
        '404':
          description: >-
            No block at or after the given timestamp yet (`error.code` is
            `not_found`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: invalid_request_error
                  code: not_found
                  message: No block at or after the given timestamp
        '429':
          description: >-
            Rate limited (`error.type` is `rate_limit_error`). Retry after the
            interval in the Retry-After header; it is always present and counts
            seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '500':
          description: >-
            Internal server error (`error.type` is `api_error`). Do not retry;
            report the error together with its request_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: Internal server error
                  request_id: 0198c3f1-...
        '502':
          description: >-
            A data source the Portal depends on is unavailable (`error.code` is
            `upstream_unavailable`) - retry later. A proxied upstream failure
            keeps the upstream's own 5xx status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: upstream_unavailable
                  message: Upstream data source is unavailable, please try again later
                  request_id: 0198c3f1-...
        '503':
          description: >-
            Service temporarily unavailable (`error.type` is
            `availability_error`, typically `no_workers` or `retries_exhausted`)
            - retry later. May carry Retry-After; honor it when present
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: availability_error
                  code: no_workers
                  message: No workers available for dataset
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
        '529':
          description: >-
            Overloaded (`error.code` is `overloaded`) - the Portal or a data
            source is at capacity. Retry after the interval in the Retry-After
            header; it is always present and counts seconds
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  type: rate_limit_error
                  code: overloaded
                  message: Service is overloaded, please try again later
                  request_id: 0198c3f1-...
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying (at least 1)
      x-codeSamples:
        - lang: shell
          label: Resolve timestamp to block
          source: >
            curl
            'https://portal.sqd.dev/datasets/hyperliquid-fills/timestamps/1700000000/block'
        - lang: python
          label: Resolve timestamp to block
          source: |
            import requests

            response = requests.get(
                "https://portal.sqd.dev/datasets/hyperliquid-fills/timestamps/1700000000/block"
            )
            block_number = response.json()["block_number"]
        - lang: javascript
          label: Resolve timestamp to block
          source: >
            const response = await
            fetch("https://portal.sqd.dev/datasets/hyperliquid-fills/timestamps/1700000000/block");

            const { block_number } = await response.json();
components:
  schemas:
    BlockNumberResponse:
      type: object
      properties:
        block_number:
          type: integer
          format: int64
          description: >-
            Number of the first block whose timestamp is greater than or equal
            to the requested timestamp.
          example: 18000000
      required:
        - block_number
    ErrorResponse:
      type: object
      description: Error body shared by every failing response.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      example:
        error:
          type: invalid_request_error
          code: unknown_dataset
          message: 'Unknown dataset: no-such-chain'
    ErrorDetail:
      type: object
      description: >-
        Machine-readable error detail. Branch on `type`; match on `code` for one
        specific case.
      properties:
        type:
          type: string
          description: >-
            Coarse category to branch on. One of `invalid_request_error`,
            `authentication_error`, `permission_error`, `rate_limit_error`,
            `availability_error`, or `api_error`. The two credential types
            answer 403 and appear only on a Portal that requires an API key.
            Treat an unknown `code` according to its `type`.
          example: invalid_request_error
        code:
          type: string
          description: >-
            Specific cause, stable across releases. Match on this rather than on
            `message`.
          example: base_block_mismatch
        message:
          type: string
          description: >-
            Human-readable detail. Prose, not stable; do not parse or match on
            it.
        param:
          type: string
          description: The request parameter at fault, when the error is about one.
        request_id:
          type: string
          description: >-
            Echo of the `x-request-id` response header, included in the body on
            5xx errors. Quote it when reporting a problem.
      required:
        - type
        - code
        - message

````

## Related topics

- [Block at Timestamp](/en/api/solana/timestamp-block.md)
- [Hyperliquid](/en/data/hyperliquid/hyperliquid-fills.md)
- [Hyperliquid Replica Commands](/en/data/hyperliquid/hyperliquid-replica-cmds.md)
- [Bitcoin](/en/data/bitcoin/bitcoin-mainnet.md)


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