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": {
        "difficulty": "0x0",
        "extraData": "0x",
        "gasLimit": "0xbc87657",
        "gasUsed": "0x3daa0",
        "hash": "0x8f9ecad637559914862de6821bd352d6ac7744d130085d4c5b3d821786aab3ac",
        "l1BlockNumber": "0xe2733e",
        "logsBloom": "0x00080000000000000080000000000010000000000000000000020000000000000000000000000080000000000000004400000000000004000000000000800000000000000000008000000000000000000000000000000000200000000000000000080000000000000000000000000000000000000000000000040000000000080000000000004008004000000000000000800000000000000000000000000000000000000000000000000000040000000000000000004000000000000004000000000000000000000000000000000000000000004000000000000000000000000008000000000010000400000000020000000000000000000000000020000000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0xc5043f",
        "parentHash": "0xf1b5d6a7a45df869b2eef85541584c69bbeb7a58f77e557d4898de2b464d5715",
        "receiptsRoot": "0x17f8ad0067aff1dbb35d5100b1f131838564b3e980e2b8a2674b8d5362d12e97",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x367",
        "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "timestamp": "0x628dde24",
        "totalDifficulty": "0x0",
        "transactions": [
            {
                "blockHash": "0x8f9ecad637559914862de6821bd352d6ac7744d130085d4c5b3d821786aab3ac",
                "blockNumber": "0xc5043f",
                "from": "0x1eedcd7c2334463c51b4af75c96b983be7ed4d39",
                "gas": "0xd5d2f",
                "gasPrice": "0x14c30896",
                "hash": "0x39229c9c973b7675086e4404c30fd23b4130bdb33cef8f799ac0450e2489ba08",
                "input": "0x0a0e28d400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000046a0000000000000000000000000000000000000000000000000000000000000469000000000000000000000000000000000000000000000000000000000000046b0000000000000000000000000000000000000000000000000000000000005ea2",
                "nonce": "0x324",
                "to": "0x737eaf14061fe68f04ff4ca8205acf538555fcc8",
                "transactionIndex": "0x0",
                "value": "0x0",
                "type": "0x78",
                "v": "0x14985",
                "r": "0x64445cd16ea28f39f5b94d3730147f4f0fde0dd549adfc9c80c8948a3679e878",
                "s": "0x39851deff11a344c3fd67c022bcaf9711a5c8eae60f81d47a977253df9e95e39"
            }
        ],
        "transactionsRoot": "0xc4b4888ec249430e95f700432d21a3042e5dd2572e68771dc61f73e1fbbd9900",
        "uncles": []
    }
}