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/usershttp POST <url> — Send a POST request.
http POST https://api.example.com/usershttp PUT <url> — Send a PUT request.
http PUT https://api.example.com/users/1http DELETE <url> — Send a DELETE request.
http DELETE https://api.example.com/users/1http PATCH <url> — Send a PATCH request.
http PATCH https://api.example.com/users/1http HEAD <url> — Send a HEAD request (headers only).
http HEAD https://example.comData & JSON
http POST <url> <key>=<value> — Send JSON data (string values).
http POST https://api.example.com/users name=John email=john@example.comhttp POST <url> <key>:=<value> — Send raw JSON values (numbers, booleans, arrays).
http POST https://api.example.com/users name=John age:=30 active:=truehttp POST <url> < <file> — Send request body from a file.
http POST https://api.example.com/users < data.jsonhttp --json POST <url> <key>=<value> — Explicitly send as JSON (default for data).
http --json POST https://api.example.com/users name=Johnhttp --form POST <url> <key>=<value> — Send as form data (application/x-www-form-urlencoded).
http --form POST https://example.com/login user=admin password=secrethttp --multipart POST <url> file@<path> — Upload a file (multipart form data).
http --multipart POST https://api.example.com/upload file@photo.jpgHeaders & Auth
http <url> <Header>:<value> — Set a custom header.
http https://api.example.com/data Accept:application/xml X-API-Key:abc123http -a <user>:<pass> <url> — HTTP Basic Authentication.
http -a admin:secret https://api.example.com/adminhttp -A bearer -a <token> <url> — Bearer token authentication.
http -A bearer -a eyJhbG... https://api.example.com/mehttp <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/usershttp -h <url> — Show response headers only.
http -h https://example.comhttp -b <url> — Show response body only.
http -b https://api.example.com/usershttp -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/usershttp -d <url> — Download mode: save response body to file.
http -d https://example.com/file.ziphttp -o <file> <url> — Save response body to a specific file.
http -o data.json https://api.example.com/exportSessions & Config
http --session=<name> <url> — Use a named session (persists cookies, auth, headers).
http --session=mysession -a admin:secret https://api.example.com/loginhttp --session=<name> <url> — Reuse a session (cookies/auth from previous request).
http --session=mysession https://api.example.com/dashboardhttp --follow <url> — Follow redirects (not followed by default).
http --follow https://example.com/old-pagehttp --verify=no <url> — Skip SSL certificate verification.
http --verify=no https://self-signed.example.comhttp --timeout=<seconds> <url> — Set request timeout.
http --timeout=30 https://slow-api.example.comCommon Patterns
http --pretty=all <url> — Force colorized and formatted output.
http --pretty=all https://api.example.com/usershttp --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=Johnhttps <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
- HTTPie – official documentation – reference and manual
- HTTPie – GitHub – source code and releases