# HTTP Client CLI

In addition to the IntelliJ IDEA plugin, the HTTP Client is also available [as a CLI tool](https://www.jetbrains.com.cn/en-us/ijhttp/download). 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.

> **Tip:**
> [SSL configuration](http-client-in-product-code-editor.html#ssl_certificate) and [OAuth 2.0 authorization](oauth-2-0-authorization.html) are currently not supported in the HTTP Client CLI. You can track the progress of these features in their respective tasks: [IJPL-69643](https://youtrack.jetbrains.com/issue/IJPL-69643/HttpClient-add-certificate-support-in-CLIrunner) and [IJPL-69639](https://youtrack.jetbrains.com/issue/IJPL-69639/HTTP-Client-CLI-support-OAuth2-password-and-client-credentials-grant-types).

Procedure: 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](https://hub.docker.com/r/jetbrains/intellij-http-client), pull the image:

```SHELL
docker pull jetbrains/intellij-http-client
```

Check the version in the image: `docker run --rm -i -t -v $PWD:/workdir jetbrains/intellij-http-client --version`

* To get a ZIP archive, [download it from our site](https://www.jetbrains.com.cn/en-us/ijhttp/download) or use cURL:

```SHELL
curl -f -L -o ijhttp.zip "https://jb.gg/ijhttp/latest"
```

> **Tip:**
> The ZIP distribution requires JDK 25 or newer to be installed.

Check the installed version: `./ijhttp --version`

* On macOS, you can also install it using Homebrew:

```SHELL
brew install ijhttp
```

Check the installed version: `ijhttp --version`

Procedure: Run HTTP request

1. [Create an .http request file](http-client-in-product-code-editor.html#composing-http-requests). Your file can contain multiple HTTP, WebSocket, and GraphQL requests if you want to run all of them at once.

2. Run HTTP Client CLI:

On host machine:

Pass the file name to the `./ijhttp` command, for example:

`./ijhttp myrequest.http`

In Docker:

Run a container with the `.http` file:

`docker run --rm -i -t -v $PWD:/workdir jetbrains/intellij-http-client run.http`

This command creates a bind mount between your current working directory on the host machine (`$PWD`) and the `workdir` directory in the container.

> **Tip:**
> Note that `/workdir` is required in this command: All `.http` files will be run inside this directory in the container.

The command output contains information about the requests that have been sent, test statuses, and [environment variables](#environment-variables).

![Run HTTP Client CLI](https://resources.jetbrains.com.cn/help/img/idea/2026.2/http_client_cli.animated.gif)

Procedure: 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 HEADERS` to log information on the request and response headers.

* Or use `-L VERBOSE` to log information on the request and response headers and body.

Procedure: Save response to file

* If you want to save an HTTP response to a separate file, add `>>` or `>>!` in your `.http` file (see also [Redirect the response](exploring-http-syntax.html#response-redirect)). For example:

```HTTP_REQUEST_FULL
GET https://example.org/get

>> myFolder/myFile.json
```

* If you want to save output from HTTP Client CLI, use standard terminal commands, such as `>`. For example:

`./ijhttp rest-api.http > yourFile.txt`

The level of detail in the saved HTTP Client CLI output depends on the specified [log level](#change-log-level).

Procedure: 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 `-D` option, for example:

`docker run --rm -i -t -v $PWD:/workdir jetbrains/intellij-http-client -D run.http`

> **Tip:**
> If you use Docker-for-Linux 20.10.0+, you should also add the `--add-host host.docker.internal:host-gateway` option to the command:
>
>
>
>
> ```
> docker run --rm -i -t -v $PWD:/workdir --add-host host.docker.internal:host-gateway 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](http-client-variables.html) in your HTTP requests. You use variables from HTTP environment files, or you can pass variable values directly in the CLI command.

Procedure: Use public environment variables

* Use the `--env-file` option to specify a path to the variable file and `--env` to specify the name of an environment. For example:

`./ijhttp --env-file http-client.env.json --env dev rest-api.http`

* Alternatively, pass the variable value in the `-V` option. If you want to pass multiple variables, repeat the `-V` option:

`ijhttp -V host=localhost:8080 -V planet=tatooine rest-api.http`

You can combine both options:

```
./ijhttp --env-file http-client.env.json --env dev -V host=localhost:8080 rest-api.http
```

Procedure: Use private environment variables

* Use the `--private-env-file` option to specify a path to the variable file and `--env` to specify the name of an environment. For example:

`./ijhttp --private-env-file http-client.private.env.json --env dev rest-api.http`

* You can also pass the variable value in the `-P` option. If you want to pass multiple variables, repeat the `-P` option:

`ijhttp -P password=mypassword123 -P user=johndoe rest-api.http`

You can combine both options:

```
./ijhttp --private-env-file http-client.private.env.json --env dev -P password=mypassword123 rest-api.http
```

## Test requests

Just like in the HTTP Client plugin, your `.http` file may contain a [response handler script](exploring-http-syntax.html#response-handling) written in JavaScript ES6. You can use it to test HTTP requests with the [client.assert](http-client-reference.html) method.

Procedure: Use response handler script

* In your `.http` file, skip one line from the request and write your response handler script enclosed in `> {% ... %}`. For example:

```JAVASCRIPT
GET https://httpbin.org/get

> {%
    client.test("Test status code", function() {
        client.assert(response.status === 200, "Response status is not 200");
    });
%}
```

> **Note:**
> Use IntelliJ IDEA to get syntax highlighting and completion for the response handler script.

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:

```
GET https://httpbin.org/get

> /path/to/responseHandler.js
```

Procedure: Save test report in JUnit XML format

The HTTP Client can provide output in the JUnit XML format.

* Add the `--report` argument to the `ijhttp` command, for example:

`./ijhttp test.http --report`

The HTTP Client CLI saves the report in the `report.xml` file under the `reports` directory.

