TL;DR — Quick Summary
xh is a friendly HTTP client for testing APIs. Colorized output, JSON shortcuts, headers, auth — a modern alternative to curl and HTTPie, written in Rust.
xh makes API testing enjoyable. Colorized JSON, easy headers, intuitive data — no more wrestling with curl syntax.
Installation
# macOS
brew install xh
# Arch Linux
sudo pacman -S xh
# Cargo
cargo install xh
Usage
# GET request (default method)
xh httpbin.org/get
xh api.github.com/users/octocat
# POST JSON (= for strings, := for non-strings)
xh POST api.example.com name=Ada age:=36 active:=true
# PUT
xh PUT api.example.com/users/1 name=Ada
# DELETE
xh DELETE api.example.com/users/1
# Custom headers
xh api.example.com Authorization:'Bearer token123' Accept:application/json
# Basic auth
xh -a user:password api.example.com
# Form data
xh -f POST api.example.com name=Ada file@photo.jpg
# Raw JSON body
xh POST api.example.com < data.json
echo '{"name":"Ada"}' | xh POST api.example.com
# Query string parameters
xh api.example.com q==search page==1
# Headers only
xh -h api.example.com
# Download
xh --download https://example.com/file.zip
# HTTPS only (via xhs alias)
xhs api.example.com
# Verbose mode
xh -v POST api.example.com name=Ada
# Save/load sessions
xh --session=myapi api.example.com Authorization:'Bearer token'
xh --session=myapi api.example.com/users # Token reused
Comparison
| Feature | xh | curl | HTTPie | wget |
|---|---|---|---|---|
| JSON by default | Yes | No | Yes | No |
| Colorized | Yes | No | Yes | No |
| Easy headers | Yes | -H flag | Yes | No |
| Auth shortcut | Yes | -u flag | Yes | No |
| Speed | Fastest | Fast | Slow (Python) | Fast |
| Sessions | Yes | No | Yes | No |
Summary
- xh sends HTTP requests with colorized output and JSON by default
- Intuitive syntax: key=value for strings, key:=value for non-strings
- Easy auth, headers, query params — no escaping needed
- Drop-in HTTPie replacement, written in Rust for speed
- Sessions, download mode, HTTPS-only alias (xhs)