Skip to main content


The Client Uniform Resource Locator (curl) command line tool sends API requests via URLs and returns responses.

Requests to Infura APIs commonly use curl.


We recommend the resource Everything curl.

Install curl

Your operating system may include curl, or you may need to download and install it.

curl commands

Many Infura requests take the form:

curl \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}'

The code snippet above is an API call to Infura's Ethereum mainnet endpoint.

It requests the latest block number using the method eth_blockNumber.

curl analysis

Let's step through each line of the code snippet to understand what's happening.

The first line uses the curl command to send a request to the URL

curl command

curl \

Replace YOUR-API-KEY with a specific API key.

-X flag

The -X flag specifies a common HTTP method.


-H flag

The -H or --header flag specifies header information.

The example specifies the Content-Type to be application/json which means the requested resource is a JavaScript Object Notation (JSON) object.

-H "Content-Type: application/json" \

-d flag

The -d or --data flag specifies more information sent along with the curl request.

In the example, the data object is a list of key value pairs in JSON format. This follows the JSON RPC 2.0 specification which requires the four specific keys seen here.

The method , params , and id values are modifiable.

The jsonrpc value is required by the specification.

-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}'

Running curl

Enter curl code in a terminal window, or a command line tool from your computer's operating system and click return.


curl returns a response object if the request is successful.