Documentation
Documentation
https://aptos.dev/en/build/apis/fullnode-rest-api
APIReference
https://api.mainnet.aptoslabs.com/v1/spec
Authentication
https://geomi.dev/docs/api-keys
openapi: 3.0.0
info:
title: Aptos Node Accounts Blocks API
description: The Aptos Node API is a RESTful API for client applications to interact with the Aptos blockchain.
version: 1.2.0
contact:
name: Aptos Labs
url: https://github.com/aptos-labs/aptos-core
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: /v1
tags:
- name: Blocks
description: Access to blocks
paths:
/blocks/by_height/{block_height}:
get:
tags:
- Blocks
summary: Get blocks by height
description: 'This endpoint allows you to get the transactions in a block
and the corresponding block information.
Transactions are limited by max default transactions size. If not all transactions
are present, the user will need to query for the rest of the transactions via the
get transactions API.
If the block is pruned, it will return a 410'
parameters:
- name: block_height
schema:
type: integer
format: uint64
in: path
description: Block height to lookup. Starts at 0
required: true
deprecated: false
explode: true
- name: with_transactions
schema:
type: boolean
in: query
description: 'If set to true, include all transactions in the block
If not provided, no transactions will be retrieved'
required: false
deprecated: false
explode: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Block'
application/x-bcs:
schema:
type: array
items:
type: integer
format: uint8
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
required: true
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-CURSOR:
description: 'Cursor to be used for endpoints that support cursor-based
pagination. Pass this to the `start` field of the endpoint
on the next call to get the next page of results.'
deprecated: false
schema:
type: string
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'403':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'404':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'410':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'500':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'503':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
operationId: get_block_by_height
/blocks/by_version/{version}:
get:
tags:
- Blocks
summary: Get blocks by version
description: 'This endpoint allows you to get the transactions in a block
and the corresponding block information given a version in the block.
Transactions are limited by max default transactions size. If not all transactions
are present, the user will need to query for the rest of the transactions via the
get transactions API.
If the block has been pruned, it will return a 410'
parameters:
- name: version
schema:
type: integer
format: uint64
in: path
description: Ledger version to lookup block information for.
required: true
deprecated: false
explode: true
- name: with_transactions
schema:
type: boolean
in: query
description: 'If set to true, include all transactions in the block
If not provided, no transactions will be retrieved'
required: false
deprecated: false
explode: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Block'
application/x-bcs:
schema:
type: array
items:
type: integer
format: uint8
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
required: true
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
required: true
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-CURSOR:
description: 'Cursor to be used for endpoints that support cursor-based
pagination. Pass this to the `start` field of the endpoint
on the next call to get the next page of results.'
deprecated: false
schema:
type: string
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'400':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'403':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'404':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'410':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'500':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST-BLOCK-HEIGHT:
description: Oldest non-pruned block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-GAS-USED:
description: The cost of the call in terms of gas
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-TXN-ENCRYPTION-KEY:
description: Per-epoch transaction encryption key (hex-encoded)
deprecated: false
schema:
type: string
'503':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/AptosError'
headers:
X-APTOS-CHAIN-ID:
description: Chain ID of the current chain
deprecated: false
schema:
type: integer
format: uint8
X-APTOS-LEDGER-VERSION:
description: Current ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-OLDEST-VERSION:
description: Oldest non-pruned ledger version of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-LEDGER-TIMESTAMPUSEC:
description: Current timestamp of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-EPOCH:
description: Current epoch of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-BLOCK-HEIGHT:
description: Current block height of the chain
deprecated: false
schema:
type: integer
format: uint64
X-APTOS-OLDEST
# --- truncated at 32 KB (112 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/aptos/refs/heads/main/openapi/aptos-blocks-api-openapi.yml