Skip to main content

Make requests

The Polygon PoS network supports API requests using HTTP, and supports all Ethereum JSON-RPCs. Infura also provides access to archive data for API calls that require access to data older than 128 blocks.

Additional Polygon-specific JSON-RPC APIs are also available.

Call a JSON-RPC method

Use HTTPS to call a JSON-RPC method. In this example we use curl to make the HTTPS request.

Note: Ensure that you replace YOUR-API-KEY with an API key from your Infura dashboard.

$ curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \
"https://polygon-mainnet.infura.io/v3/YOUR-API-KEY"

The result should look similar to the following:

$ {"jsonrpc":"2.0","id":1,"result":"0x17c3d14"}