API ReferenceBlocks APIGet block by heightVersion: 2.0Get block by heightMainnetTestnetGEThttps://mainnet-aptos-api.moralis.io/blocks/:block_heightGet block by specific block height.PATH PARAMSblock_heightnumberrequiredBlock height to lookup. Starts at 0QUERY PARAMSwith_transactionsbooleanIf set to true, include all transactions in the blockfalsetrueResponses200 Returns block by heightobjectAPI KEYTest Live APINode.jsPythoncURLGoPHPimport Moralis from 'moralis';try { await Moralis.start({ apiKey: "YOUR_API_KEY" }); const response = await Moralis.AptosApi.blocks.getBlockByHeight({}); console.log(response);} catch (e) { console.error(e);}from moralis import aptos_apiapi_key = "YOUR_API_KEY"params = {}result = aptos_api.blocks.get_block_by_height( api_key=api_key, params=params,)print(result)curl --request GET \ --url 'https://mainnet-aptos-api.moralis.io/blocks/%3Ablock_height' \ --header 'accept: application/json' \ --header 'X-API-Key: YOUR_API_KEY' package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://mainnet-aptos-api.moralis.io/blocks/%3Ablock_height" req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Accept", "application/json") req.Header.Add("X-API-Key", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}<?php// Dependencies to install:// $ composer require guzzlehttp/guzzlerequire_once('vendor/autoload.php');$client = new \GuzzleHttp\Client();$response = $client->request('GET', 'https://mainnet-aptos-api.moralis.io/blocks/%3Ablock_height', [ 'headers' => [ 'Accept' => 'application/json', 'X-API-Key' => 'YOUR_API_KEY', ],]);echo $response->getBody();Response Example200 Returns block by height{ "block_height": "32425224034", "block_hash": "32425224034", "block_timestamp": "32425224034", "first_version": "32425224034", "last_version": "32425224034", "transactions": [ { "hash": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1", "sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1", "sequence_number": "32425224034", "max_gas_amount": "32425224034", "gas_unit_price": "32425224034", "expiration_timestamp_secs": "32425224034", "payload": { "type": "", "function": "", "type_arguments": [ "" ], "arguments": [ "" ] }, "signature": { "type": "", "signature": "", "public_key": "" } } ]}