HTTP Client CLI
In addition to the IntelliJ IDEA plugin, the HTTP Client is also available as a CLI tool. It allows you to run HTTP requests from a terminal, without the IDE, or include HTTP request testing in your CI workflow. The HTTP Client CLI does not require you to have the Ultimate license.
Install HTTP Client CLI
You can get the HTTP Client CLI in the following ways:
To get the HTTP Client CLI as a Docker image, pull the image:
docker pull jetbrains/intellij-http-clientCheck the version in the image:
docker run --rm -i -t -v $PWD:/workdir jetbrains/intellij-http-client --versionTo get a ZIP archive, download it from our site or use cURL:
curl -f -L -o ijhttp.zip "http://jb.gg/ijhttp/latest"Check the installed version:
./ijhttp --versionOn macOS, you can also install it using Homebrew:
brew install ijhttpCheck the installed version:
ijhttp --version
Run HTTP request
Create an .http request file. Your file can contain multiple HTTP, WebSocket, and GraphQL requests if you want to run all of them at once.
Run HTTP Client CLI:
Pass the file name to the
./ijhttpcommand, for example:./ijhttp myrequest.httpRun a container with the
.httpfile:docker run --rm -i -t -v $PWD:/workdir jetbrains/intellij-http-client run.httpThis command creates a bind mount between your current working directory on the host machine (
$PWD) and theworkdirdirectory in the container.
The command output contains information about the requests that have been sent, test statuses, and environment variables.

Change log level
By default, the HTTP Client CLI outputs only the information about the requests that have been sent and the environment variables. You can change the log level by using the -L option.
Use
-L HEADERSto log information on the request and response headers.Or use
-L VERBOSEto log information on the request and response headers and body.
Save response to file
If you want to save an HTTP response to a separate file, add
>>or>>!in your.httpfile (see also Redirect the response). For example:GET http://example.org/get >> myFolder/myFile.jsonIf you want to save output from HTTP Client CLI, use standard terminal commands, such as
>. For example:./ijhttp rest-api.http > yourFile.txtThe level of detail in the saved HTTP Client CLI output depends on the specified log level.
Resolve localhost in Docker
If you have a server running on your host machine, and you run HTTP requests in the Docker container, you may need to resolve localhost to the localhost of your host machine.
Use the
-Doption, for example:docker run --rm -i -t -v $PWD:/workdir jetbrains/intellij-http-client -D run.http
This way, requests intended for localhost will be sent to the localhost of your host machine.
Environment variables
Just like in the IntelliJ IDEA HTTP Client, you can use environment variables in your HTTP requests. You use variables from HTTP environment files, or you can pass variable values directly in the CLI command.
Use public environment variables
Use the
--env-fileoption to specify a path to the variable file and--envto specify the name of an environment. For example:./ijhttp --env-file http-client.env.json --env dev rest-api.httpAlternatively, pass the variable value in the
-Voption. If you want to pass multiple variables, repeat the-Voption:ijhttp -V host=localhost:8080 -V planet=tatooine rest-api.http
You can combine both options:
Use private environment variables
Use the
--private-env-fileoption to specify a path to the variable file and--envto specify the name of an environment. For example:./ijhttp --private-env-file http-client.private.env.json --env dev rest-api.httpYou can also pass the variable value in the
-Poption. If you want to pass multiple variables, repeat the-Poption:ijhttp -P password=mypassword123 -P user=johndoe rest-api.http
You can combine both options:
Test requests
Just like in the HTTP Client plugin, your .http file may contain a response handler script written in JavaScript ES6. You can use it to test HTTP requests with the client.assert method.
Use response handler script
In your
.httpfile, skip one line from the request and write your response handler script enclosed in> {% ... %}. For example:GET http://httpbin.org/get > {% client.test("Test status code", function() { client.assert(response.status === 200, "Response status is not 200"); }); %}
You can also include a test from a separate file. The path to the file can be either absolute or relative to your .http file:
Save test report in JUnit XML format
The HTTP Client can provide output in the JUnit XML format.
Add the
--reportargument to theijhttpcommand, for example:./ijhttp test.http --report
The HTTP Client CLI saves the report in the report.xml file under the reports directory.