xh is a free, open source api development & testing project written in Rust and released under MIT. It has 8,165 GitHub stars, 152 forks and 37 open issues, and was last pushed 4 days ago. On this registry it ranks #28 of 186 tracked projects in API Development & Testing, with 5 head-to-head comparisons available. It gained 55 stars over the last 30 tracked days.

What is xh?

xh is a friendly and fast command-line HTTP client written in Rust that reimplements as much of HTTPie's design as possible with a focus on improved performance, and it is built for developers and API testers who send HTTP requests from a terminal.

What it is

xh is an open-source terminal HTTP client implemented in Rust and distributed under the MIT licence. It lives in the command-line developer tooling ecosystem, alongside package managers and shells, and it works by taking a URL with an optional HTTP method plus optional key-value pairs of request data, then printing a formatted request and response to the terminal. The README states that it reimplements as much as possible of HTTPie's excellent design, with a focus on improved performance.

The concrete problem it solves is that developers need to send HTTP requests, inspect headers, bodies, and metadata, and do so quickly from a shell without leaving the terminal or writing throwaway scripts. xh replaces HTTPie as the day-to-day request tool for users who want the same familiar command shape but care about speed. Rather than inventing a new syntax, it keeps the request-item model where a URL and key-value pairs form the request, so existing habits carry over.

Key capabilities

  • Serializes command-line data as a JSON object by default with -j, --json, and supports -f, --form for form fields, --multipart to force multipart/form-data even without files, and --raw to pass request data without extra processing.
  • Controls output processing with --pretty (values: all, colors, format, none) and --format-options, and selects coloring style with -s, --style (values: auto, solarized, monokai, fruity).
  • Shapes what gets printed using -p, --print, with shortcuts -h/--headers, -b/--body, and -m/--meta, and shows the whole request and response with -v, --verbose.
  • Follows redirects with --follow, exposes intermediary requests and responses via --all, and applies a separate print specification to them with -P, --history-print.
  • Streams response bodies with -S, --stream, requests Deflate-compressed content with -x, --compress, and saves results with -o, --output FILE or -d, --download.
  • Overrides terminal rendering with --response-charset and --response-mime for coloring and formatting purposes, and suppresses output entirely with -q, --quiet.
  • Prints full error stack traces and debug log messages with --debug.

Who uses it and how

  • Developers on Linux, macOS, and Windows who install through native package managers such as Homebrew, MacPorts, Scoop, Chocolatey, Winget, Pacman, Apt, Copr, Nixpkgs, Flox, or Hermit.
  • Rust developers who install with cargo install xh --locked, which requires Rust 1.85 or later.
  • Android users who run it under Termux with pkg install xh, or install it as a Magisk/KernelSU module through mmrl install xhhttp using the MMRL CLI.
  • Scripts and pipelines that need clean output, using -q, --quiet to suppress stdout and stderr and -o, --output to write to a file instead.
  • Interactive API testing sessions where -v, --all, and -P, --history-print are used to inspect the full request-and-response exchange, including redirect chains.

Getting started

Install via a package manager for the platform, such as brew install xh, scoop install xh, pacman -S xh, or apt install xh, or use the install scripts: curl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | sh on Linux and macOS, and iwr -useb https://raw.githubusercontent.com/ducaale/xh/master/install.ps1 | iex on Windows. Pre-built binaries for Linux, macOS, and Windows are also published on the release page.

How it compares

The only comparable tool named in the project's own material is HTTPie, whose design xh deliberately reimplements as closely as possible. The difference the project itself states is focus on improved performance, and unlike a hosted request service, xh is a local Rust binary under the MIT licence that runs entirely on the user's machine. Beyond that single named reference, the facts do not supply other tools to contrast against.

When to use it — and when not to

Choose xh when the workflow lives in a shell and the goal is fast request-and-response inspection with HTTPie-style syntax, especially on platforms where a package manager entry exists. Do not choose it if a graphical interface or a hosted collaboration platform is required, since it is a terminal binary with no such surface described. Two honest limitations stand out: because it reimplements HTTPie's design "as much as possible" rather than completely, exact behavioural parity is not guaranteed, and native Debian and Ubuntu packages are only available since Debian 13 and Ubuntu 25.04, where they are built with native-tls only.

project readme (upstream, from github) — read inline

xh

Version info Packaging status

xh is a friendly and fast tool for sending HTTP requests. It reimplements as much as possible of HTTPie's excellent design, with a focus on improved performance.

asciicast

Installation

via cURL (Linux & macOS)

curl -sfL https://raw.githubusercontent.com/ducaale/xh/master/install.sh | sh

via Powershell (Windows)

iwr -useb https://raw.githubusercontent.com/ducaale/xh/master/install.ps1 | iex

via a package manager

OS Method Command
Any Cargo* cargo install xh --locked
Any Huber huber install xh
Any Mise mise use xh --global
Android (Termux) pkg pkg install xh
Android (Magisk/KernelSU) MMRL** mmrl install xhhttp
Alpine Linux apk*** apk add xh
Arch Linux Pacman pacman -S xh
Debian & Ubuntu Apt**** sudo apt install xh
Fedora Copr***** sudo dnf install xh
FreeBSD FreshPorts pkg install xh
NetBSD pkgsrc pkgin install xh
Linux & macOS Nixpkgs nix-env -iA nixpkgs.xh
Linux & macOS Flox flox install xh
Linux & macOS Homebrew brew install xh
Linux & macOS Hermit hermit install xh
macOS MacPorts sudo port install xh
Windows Scoop scoop install xh
Windows Chocolatey choco install xh
Windows Winget winget add ducaale.xh

* Make sure that you have Rust 1.85 or later installed

** You will need to install the MMRL CLI

*** Built with native-tls only.

**** Available since Debian 13 and Ubuntu 25.04. Built with native-tls only.

***** Enable COPR repo via sudo dnf copr enable ducaale/xh

via pre-built binaries

The release page contains prebuilt binaries for Linux, macOS and Windows.

Usage

Usage: xh [OPTIONS] <[METHOD] URL> [REQUEST_ITEM]...

Arguments:
  <[METHOD] URL>     The request URL, preceded by an optional HTTP method
  [REQUEST_ITEM]...  Optional key-value pairs to be included in the request.

Options:
  -j, --json                             (default) Serialize data items from the command line as a JSON object
  -f, --form                             Serialize data items from the command line as form fields
      --multipart                        Like --form, but force a multipart/form-data request even without files
      --raw <RAW>                        Pass raw request data without extra processing
      --pretty <STYLE>                   Controls output processing [possible values: all, colors, format, none]
      --format-options <FORMAT_OPTIONS>  Set output formatting options
  -s, --style <THEME>                    Output coloring style [possible values: auto, solarized, monokai, fruity]
      --response-charset <ENCODING>      Override the response encoding for terminal display purposes
      --response-mime <MIME_TYPE>        Override the response mime type for coloring and formatting for the terminal
  -p, --print <FORMAT>                   String specifying what the output should contain
  -h, --headers                          Print only the response headers. Shortcut for --print=h
  -b, --body                             Print only the response body. Shortcut for --print=b
  -m, --meta                             Print only the response metadata. Shortcut for --print=m
  -v, --verbose...                       Print the whole request as well as the response
      --debug                            Print full error stack traces and debug log messages
      --all                              Show any intermediary requests/responses while following redirects with --follow
  -P, --history-print <FORMAT>           The same as --print but applies only to intermediary requests/responses
  -q, --quiet...                         Do not print to stdout or stderr
  -S, --stream                           Always stream the response body
  -x, --compress...                      Content compressed (encoded) with Deflate algorithm
  -o, --output <FILE>                    Save output to FILE instead of stdout
  -d, --download                         Download the body to a file instead of printing it
  -c, --continue                         Resume an interrupted download. Requires --download and --output
      --session <FILE>                   Create, or reuse and update a session
      --session-read-only <FILE>         Create or read a session without updating it from the request/response exchange
  -A, --auth-type <AUTH_TYPE>            Specify the auth mechanism [possible values: basic, bearer, digest]
  -a, --auth <USER[:PASS] | TOKEN>       Authenticate as USER with PASS (-A basic|digest) or with TOKEN (-A bearer)
      --ignore-netrc                     Do not use credentials from .netrc
      --offline                          Construct HTTP requests without sending them anywhere
      --check-status                     (default) Exit with an error status code if the server replies with an error
  -F, --follow                           Do follow redirects
      --max-redirects <NUM>              Number of redirects to follow. Only respected if --follow is used
      --timeout <SEC>                    Connection timeout of the request
      --proxy <PROTOCOL:URL>             Use a proxy for a protocol. For example: --proxy https:http://proxy.host:8080
      --verify <VERIFY>                  If "no", skip SSL verification. If a file path, use it as a CA bundle
      --cert <FILE>                      Use a client side certificate for SSL
      --cert-key <FILE>                  A private key file to use with --cert
      --ssl <VERSION>                    Force a particular TLS version [possible values: auto, tls1, tls1.1, tls1.2, tls1.3]
      --https                            Make HTTPS requests if not specified in the URL
      --http-version <VERSION>           HTTP version to use [possible values: 1.0, 1.1, 2, 2-prior-knowledge, 3-prior-knowledge]
      --resolve <HOST:ADDRESS>           Override DNS resolution for specific domain to a custom IP
      --interface <NAME>                 Bind to a network interface or local IP address
  -4, --ipv4                             Resolve hostname to ipv4 addresses only
  -6, --ipv6                             Resolve hostname to ipv6 addresses only
      --unix-socket <FILE>               Connect using a Unix domain socket
  -I, --ignore-stdin                     Do not attempt to read stdin
      --curl                             Print a translation to a curl command
      --curl-long                        Use the long versions of curl's flags
      --generate <KIND>                  Generate shell completions or man pages
      --help                             Print help
  -V, --version                          Print version

Each option can be reset with a --no-OPTION argument.

Run xh help or man xh for more detailed information.

Request Items

xh uses HTTPie's request-item syntax to set headers, request body, query string, etc.

  • =/:= for setting the request body's JSON or form fields (= for strings and := for other JSON types).
  • == for adding query strings.
  • @ for including files in multipart requests e.g picture@hello.jpg or picture@hello.jpg;type=image/jpeg;filename=goodbye.jpg.
  • : for adding or removing headers e.g connection:keep-alive or connection:.
  • ; for including headers with empty values e.g header-without-value;.

An @ prefix can be used to read a value from a file. For example: x-api-key:@api-key.txt.

The request body can also be read from standard input, or from a file using @filename.

To construct a complex JSON object, a JSON path can be used as a key e.g app[container][0][id]=090-5. For more information on this syntax, refer to https://httpie.io/docs/cli/nested-json.

Shorthand form for URLs

Similar to HTTPie, specifying the scheme portion of the request URL is optional, and a leading colon works as shorthand for localhost. :8000 is equivalent to localhost:8000, and :/path is equivalent to localhost/path.

URLs can have a leading :// which allows quickly converting a URL into a valid xh or HTTPie command. For example http://httpbin.org/json becomes http ://httpbin.org/json.

xh http://localhost:3000/users # resolves to http://localhost:3000/users
xh localhost:3000/users        # resolves to http://localhost:3000/users
xh :3000/users                 # resolves to http://localhost:3000/users
xh :/users                     # resolves to http://localhost:80/users
xh example.com                 # resolves to http://example.com
xh ://example.com              # resolves to http://example.com

Making HTTPS requests by default

xh will default to HTTPS scheme if the binary name is one of xhs, https, or xhttps. If you have installed xh via a package manager, both xh and xhs should be available by default. Otherwise, you need to create one like this:

cd /path/to/xh && ln -s ./xh ./xhs
xh httpbin.org/get  # resolves to http://httpbin.org/get
xhs httpbin.org/get # resolves to https://httpbin.org/get

Strict compatibility mode

If xh is invoked as http or https (by renaming the binary), or if the XH_HTTPIE_COMPAT_MODE environment variable is set, it will run in HTTPie compatibility mode. The only current difference is that --check-status is not enabled by default.

Examples

# Send a GET request
xh httpbin.org/json

# Send a POST request with body {"name": "ahmed", "age": 24}
xh httpbin.org/post name=ahmed age:=24

# Send a GET request with querystring id=5&sort=true
xh get httpbin.org/json id==5 sort==true

# Send a GET request and include a header named x-api-key with value 12345
xh get httpbin.org/json x-api-key:12345

# Send a POST request with body read from stdin.
echo "[1, 2, 3]" | xh post httpbin.org/post

# Send a PUT request and pipe the result to less
xh put httpbin.org/put id:=49 age:=25 | less

# Download and save to res.json
xh -d httpbin.org/json -o res.json

# Make a request with a custom user agent
xh httpbin.org/get user-agent:foobar

How xh compares to HTTPie

Advantages

  • Improved startup speed.
  • Available as a single statically linked binary that's easy to install and carry around.
  • HTTP/2 support.
  • Builtin translation to curl commands with the --curl flag.
  • Short, cheatsheet-style output from --help. (For longer output, pass help.)

Disadvantages

  • Not all of HTTPie's features are implemented. (#4)
  • No plugin system.
  • General immaturity. HTTPie is old and well-tested.
  • Worse documentation.

Similar or related Projects

  • curlie - frontend to cURL that adds the ease of use of httpie
  • httpie-go - httpie-like HTTP client written in Go
  • curl2httpie - convert command arguments between cURL and HTTPie

Frequently asked questions

Is xh free to use?

xh is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does xh do?

Friendly and fast tool for sending HTTP requests

What is xh written in?

xh is primarily written in Rust. Its source is publicly available at https://github.com/ducaale/xh, and it has 8,165 GitHub stars.