The HTTPie command replaces curl for most of my API testing work. It sends requests with a syntax you can actually remember, colors the output, and formats JSON without piping anything anywhere. Curl is everywhere and it always will be, but typing -H "Content-Type: application/json" for the hundredth time gets old. HTTPie assumes JSON by default, so the same request takes half the keystrokes.
The project sits at over 38,000 stars on GitHub and ships in the default repos of every major distro. Below are ten examples I use in day-to-day API work, from a first GET request to sessions, file downloads, and form uploads.
Installing HTTPie on Linux
Grab it from your package manager:
# Debian / Ubuntu
sudo apt install httpie
# Fedora
sudo dnf install httpie
# Arch
sudo pacman -S httpie
Distro packages sometimes lag behind. If you want the current release, install it with pipx instead: pipx install httpie. Check what landed with http --version. Either way you get two binaries, http for plain requests and https for TLS ones, and both accept the same flags and operators.
1. Send Your First httpie Command
The most basic httpie command is just the binary name and a URL:
http httpbin.org/get
No scheme needed. HTTPie assumes http:// unless you use the https binary or spell it out. The response comes back with syntax-highlighted headers and pretty-printed JSON. Compare that with curl, where you get a raw blob unless you bolt on | jq at the end.
2. POST JSON Without the Ceremony
This is where the httpie command earns its keep. Key=value pairs after the URL become a JSON body automatically:
http POST httpbin.org/post name=marin role=admin active:=true
That sends {"name": "marin", "role": "admin", "active": true} with the right Content-Type header already set. Note the := operator on the last field. Plain = produces a string, while := passes raw JSON, so you use it for booleans, numbers, arrays, and nested objects.
3. Set Custom Headers
Headers use a colon separator, right in line with how they look on the wire:
http GET httpbin.org/headers X-API-Token:secret123 User-Agent:my-script/1.0
Nothing to quote, no flags to remember. Query parameters get their own operator too. Write search==linux page==2 and HTTPie encodes them into the URL for you.
4. Handle Authentication with the httpie Command
Basic auth takes the -a flag:
http -a user:password GET httpbin.org/basic-auth/user/password
Leave the password off and the httpie command prompts for it, which keeps credentials out of your shell history. For bearer tokens, use -A bearer -a your-token-here. I use this daily against APIs that hand out JWTs, and it beats pasting an Authorization header every time.
5. Save Time with Sessions
Sessions store headers, cookies, and auth between requests:
http --session=./api.json -a user:pass GET httpbin.org/cookies/set?token=abc
http --session=./api.json GET httpbin.org/cookies
The second request replays the cookie without you touching it. The session lives in a plain JSON file you can read and edit. For a login-once, poke-around-for-an-hour workflow, this feature alone justifies the switch.
6. Inspect Exactly What You Sent
When an API rejects a request and you have no idea why, print the outgoing traffic:
http -v POST httpbin.org/post name=test
The -v flag shows the full exchange, request headers and body included. Add --offline and HTTPie builds the request and prints it without sending anything. That combination has saved me from debugging phantom problems that turned out to be a typo in a field name.
7. Download Files with the httpie Command
The -d flag switches the httpie command into download mode:
http -d https://github.com/httpie/cli/archive/refs/heads/master.tar.gz
You get a progress bar, the filename comes from the server, and interrupted transfers resume with -c. It will not replace a dedicated downloader for big jobs, but for grabbing a release tarball mid-session it does fine.
8. Upload Forms and Files
Web forms use the -f flag, and file uploads use the @ operator:
http -f POST httpbin.org/post title="Test report" report@~/reports/scan.txt
That builds a multipart/form-data request, the same thing a browser sends when you submit a form with an attachment. Piping works as well. cat data.json | http POST httpbin.org/post sends the file as the raw request body.
9. Follow Redirects and Check Status Codes
Redirects are opt-in with --follow:
http --follow --all GET httpbin.org/redirect/3
The --all flag prints every intermediate response, which is the fastest way I know to trace a redirect chain. In scripts, add --check-status so a 4xx or 5xx response sets a non-zero exit code you can act on.
10. Script It Quietly
For cron jobs and shell scripts, trim the output down to the body:
http --print=b GET httpbin.org/get
The --print flag takes any mix of H, B, h, and b for request headers, request body, response headers, and response body. Pair the output with jq to filter the JSON, or render saved responses with bat for highlighted paging. Timeouts matter in scripts too, so set one with --timeout=10.
When Not to Use the httpie Command
Curl still wins in two places. Portability is the first. Curl is preinstalled on nearly every system you will ever ssh into, while HTTPie usually needs a package install and pulls in a Python runtime. The second is protocol coverage, since curl speaks FTP, SMTP, IMAP, and a few dozen other protocols HTTPie has no interest in.
Raw speed matters in tight loops as well. Python startup time makes an httpie command noticeably slower than curl when you fire hundreds of requests from a script. For that job, use curl or a load-testing tool.
Where to Go Next
Everyday API testing is where the httpie command fits best. The syntax matches the way you think about a request, JSON handling costs nothing, and sessions remove the repetitive parts. My habit now: HTTPie interactively, curl in scripts that ship to other machines.
The official HTTPie docs cover plugins, proxies, and TLS options this article skipped. The source and issue tracker live in the httpie/cli repository on GitHub. Run http --help once, then just start typing requests. It sticks fast.