HTTPie — Modern HTTP Client for the Command Line

Practical guide to HTTPie — HTTP requests, JSON data, sessions and authentication on the command line, with intuitive syntax and examples for every use case.

HTTPie is the modern, developer-friendly alternative to curl: instead of cryptic flags, you write HTTP requests in an intuitive syntax that reads almost like natural language. JSON data travels as simple key=value pairs without extra headers, output is automatically colourised and pretty-printed, and sessions persist cookies and auth across requests. Whether you need a quick API test, Bearer token authentication, or repeatable debug steps – HTTPie makes HTTP noticeably more approachable.

Basic Requests

http <url> — Send a GET request (default method).

http https://api.example.com/users

http POST <url> — Send a POST request.

http POST https://api.example.com/users

http PUT <url> — Send a PUT request.

http PUT https://api.example.com/users/1

http DELETE <url> — Send a DELETE request.

http DELETE https://api.example.com/users/1

http PATCH <url> — Send a PATCH request.

http PATCH https://api.example.com/users/1

http HEAD <url> — Send a HEAD request (headers only).

http HEAD https://example.com

Data & JSON

http POST <url> <key>=<value> — Send JSON data (string values).

http POST https://api.example.com/users name=John email=john@example.com

http POST <url> <key>:=<value> — Send raw JSON values (numbers, booleans, arrays).

http POST https://api.example.com/users name=John age:=30 active:=true

http POST <url> < <file> — Send request body from a file.

http POST https://api.example.com/users < data.json

http --json POST <url> <key>=<value> — Explicitly send as JSON (default for data).

http --json POST https://api.example.com/users name=John

http --form POST <url> <key>=<value> — Send as form data (application/x-www-form-urlencoded).

http --form POST https://example.com/login user=admin password=secret

http --multipart POST <url> file@<path> — Upload a file (multipart form data).

http --multipart POST https://api.example.com/upload file@photo.jpg

Headers & Auth

http <url> <Header>:<value> — Set a custom header.

http https://api.example.com/data Accept:application/xml X-API-Key:abc123

http -a <user>:<pass> <url> — HTTP Basic Authentication.

http -a admin:secret https://api.example.com/admin

http -A bearer -a <token> <url> — Bearer token authentication.

http -A bearer -a eyJhbG... https://api.example.com/me

http <url> Authorization:'Bearer <token>' — Set Authorization header manually.

http https://api.example.com/me Authorization:'Bearer eyJhbG...'

Output Control

http -v <url> — Verbose: show request headers, body, response headers, and body.

http -v https://api.example.com/users

http -h <url> — Show response headers only.

http -h https://example.com

http -b <url> — Show response body only.

http -b https://api.example.com/users

http -p HBhb <url> — Select output parts: H=request headers, B=request body, h=response headers, b=response body.

http -p Hh https://api.example.com/users

http -d <url> — Download mode: save response body to file.

http -d https://example.com/file.zip

http -o <file> <url> — Save response body to a specific file.

http -o data.json https://api.example.com/export

Sessions & Config

http --session=<name> <url> — Use a named session (persists cookies, auth, headers).

http --session=mysession -a admin:secret https://api.example.com/login

http --session=<name> <url> — Reuse a session (cookies/auth from previous request).

http --session=mysession https://api.example.com/dashboard

http --follow <url> — Follow redirects (not followed by default).

http --follow https://example.com/old-page

http --verify=no <url> — Skip SSL certificate verification.

http --verify=no https://self-signed.example.com

http --timeout=<seconds> <url> — Set request timeout.

http --timeout=30 https://slow-api.example.com

Common Patterns

http --pretty=all <url> — Force colorized and formatted output.

http --pretty=all https://api.example.com/users

http --print=b <url> | jq '<filter>' — Pipe JSON response to jq for processing.

http --print=b https://api.example.com/users | jq '.[].name'

http --offline POST <url> <data> — Build and print request without sending (for debugging).

http --offline POST https://api.example.com/users name=John

https <url> — Shorthand for http with HTTPS scheme.

https api.example.com/users

Conclusion

HTTPie shines wherever you want readable, expressive HTTP requests – especially during API debugging and development workflows. For scripting or environments where curl is already available, curl remains the safe default. Both tools complement each other, and knowing both means you have the right instrument for every situation.

Further Reading

  • curl – HTTP requests on the command line, available on virtually every system
  • wget – download files and entire sites
  • ab – benchmark an HTTP server with concurrent requests (Apache Benchmark)