Updated on 2023-12-06 GMT+08:00

Using cURL to Send HTTP API Requests

Request example

curl https://your-http-endpoint/v1/<API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getBlockByNumber","params":["0xc5043f",false],"id":1,"jsonrpc":"2.0"}'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "number": "0xc5043f",
        "hash": "0x6c2a069ee47f1fcb83a64c8f3193944199545e91928097d4bc79265f62135040",
        "transactions": [
            "0xd3cee91cc3f05d9228bf2ae99629af0bef22ced9c00fabb7d90be3b1dd029f0b",
            "0xc00960955a51f1d6ea2c10ef0a8fc8b102566d31280e7b22180fe63a9040f178",
            "0x609751af0720d9d12be04ddf7e0aa84c2cc68dcfb7de935325df92bf981a4ccb",
            "0xbbbae84c142947dc8b592d8a69d6cd64249f0514b1736e4f8ae15846171350bc"
        ],
        "difficulty": "0x12",
        "extraData": "0xd78301091883626f7288676f312e31352e35856c696e7578000000000000000002f70172f7f490653665c9bfac0666147c8af1f50000000000000000000000000000000000000001127685d6dd6683085da4b6a041efcef1681e5c9c00000000000000000000000000000000000000021ca971963bdb4ba2bf337c90660674acff5beb3f00000000000000000000000000000000000000044f856f79f54592a48c8a1a1fafa1b0a3ac053f9900000000000000000000000000000000000000045973918275c01f50555d44e92c9d9b353cadad5400000000000000000000000000000000000000016776786c6590dcd66b2018db5425749f6334ae69000000000000000000000000000000000000000172f93a2740e00112d5f2cef404c0aa16fae21fa400000000000000000000000000000000000000047b5000af8ab69fd59eb0d4f5762bff57c9c04385000000000000000000000000000000000000000d7c7379531b2aee82e4ca06d4175d13b9cbeafd4900000000000000000000000000000000000000037fcd58c2d53d980b247f1612fdba93e9a76193e600000000000000000000000000000000000000028e9700392f9246a6c5b32ee3ecef586f156ed683000000000000000000000000000000000000000198c27cc3f0301b6272049dc3f972e2f5427806290000000000000000000000000000000000000001b702f1c9154ac9c08da247a8e30ee6f2f3373f410000000000000000000000000000000000000001b8bb158b93c94ed35c1970d610d1e2b34e26652c0000000000000000000000000000000000000003c35649ae99be820c7b200a0add09b96d7032d2320000000000000000000000000000000000000001c6869257205e20c2a43cb31345db534aecb49f6e0000000000000000000000000000000000000001e77bbfd8ed65720f187efdd109e38d75eaca73850000000000000000000000000000000000000004f84c74dea96df0ec22e11e7c33996c73fcc2d8220000000000000000000000000000000000000003191dfbf8a52b5a55b94a6c3a3ffe34a7a8bc395cf1ec37b25f3aa2b585b21cd8375a82941671d5a907a52146f1f3bfd756b4b797b844ac9b91c899b887651ff700",
        "gasLimit": "0x1312d00",
        "gasUsed": "0xc6aec",
        "logsBloom": "0x20208000000400080000000080000040000005000800004200204000000000400000000004000000000008000000000000008000000000000000000080240040000000000000000000010008800000a000000000004000810001000000000010600000000200000002080000000086001000000000000000a000001024000000400000000000000000020000a00080000025c800000200080000004000000000220000000000000000000008040202000000000020000200000000000000004000000402000000000001000000001000040000000000081010100000000000000811001001080000080800400000000080100100000080000000000000500000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "parentHash": "0x3d36f634935155891ebcda31688b3b9eda26a339cd7d0ac0b1d22f1d6f0e1ef7",
        "receiptsRoot": "0x1db35a47efd801643c885906c30dc81430218228690bd7dc23952f9cc2e163d8",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0xdb8",
        "stateRoot": "0xfe50dacb41e2de9119bca1ee4f2345c8dc2da79b9171b6f61d858fba40f4cabe",
        "timestamp": "0x606b7a3a",
        "totalDifficulty": "0x6e6d156",
        "transactionsRoot": "0x89889dccc152914e70a3675868d7784a1a9dbdfb1be7f6943f873ca9d07942a7",
        "uncles": []
    }
}