curl is powerful but cryptic. curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}'... HTTPie makes the same request as http POST api.example.com name=test. Human-readable syntax, colorized output, JSON by default.
API Testing Made Beautiful
Syntax-highlighted JSON, intuitive syntax, sessions for auth, and sensible defaults. The HTTP client that respects developers.
HTTPie in Action
See the difference between curl and HTTPie. Same request, dramatically better experience:
HTTPie provides colorized output, intuitive syntax, and sensible defaults compared to curl
Key Features
Intuitive Syntax
Natural language-like commands. http POST url key=value just works. No manual escaping.
Colorized Output
Syntax highlighting for JSON, headers, and status codes. Spot errors instantly.
JSON by Default
Content-Type set automatically. Request bodies serialized to JSON. Response formatted nicely.
Sessions Support
Save auth tokens, cookies, and headers. Reuse across requests without repeating.
Practical Examples
Install HTTPie:
# Install on macOS
brew install httpie
# Install on Linux/pip
pip install httpie
Basic HTTP methods:
# GET request (method optional for GET)
http api.example.com/users
http GET api.example.com/users/42
# POST with JSON body (key=value for strings, key:=value for non-strings)
http POST api.example.com/users \
name="John Doe" \
email="john@example.com" \
age:=30 \
active:=true
# PUT to update
http PUT api.example.com/users/42 name="Jane Doe"
# DELETE
http DELETE api.example.com/users/42
Headers and authentication:
# Custom headers (use : for headers)
http api.example.com/data \
Authorization:"Bearer eyJhbGciOiJIUzI1NiIs..." \
X-Custom-Header:"some-value"
# Basic auth (shorthand)
http -a username:password api.example.com/protected
# Bearer token auth
http -A bearer -a token123 api.example.com/data
File operations:
# Upload file
http POST api.example.com/upload file@./photo.jpg
# Download file with progress
http --download example.com/large-file.zip
Why Developers Love It
-
✓
No Memorization Required - Syntax is self-explanatory.
key=valuefor data,Key:valuefor headers. - ✓ Readable Responses - Formatted JSON with syntax highlighting. No need to pipe through jq.
- ✓ Sensible Defaults - JSON Content-Type, follow redirects, formatted output - all out of the box.
- ✓ Session Persistence - Save auth cookies, reuse headers across requests with named sessions.
-
✓
curl Compatible - Use
--curlflag to generate equivalent curl commands.
Cheatsheet
curl vs HTTPie syntax comparison:
| Task | curl | HTTPie |
|---|---|---|
| GET request | curl https://api.com/data |
http api.com/data |
| POST JSON | curl -X POST -H "Content-Type: application/json" -d '{"key":"val"}' |
http POST api.com key=val |
| Custom header | curl -H "X-Token: abc" |
http api.com X-Token:abc |
| Basic auth | curl -u user:pass |
http -a user:pass |
| File upload | curl -F "file=@photo.jpg" |
http -f POST api.com file@photo.jpg |
| Download | curl -O url/file.zip |
http --download url/file.zip |
| Follow redirects | curl -L url |
http --follow url |
| Verbose | curl -v url |
http --verbose url |
Pro Tips
Advanced HTTPie features for power users:
Named Sessions
Save auth tokens and cookies to reuse across requests:
# Login and save session
http --session=myapi POST api.com/login user=me pass=secret
# Use session for subsequent requests
http --session=myapi api.com/protected
Output Control
# Headers only
http --headers api.com/data
# Body only (for piping)
http --body api.com/data
# Both headers and body
http --print=hb api.com/data
Generate curl Commands
# Show equivalent curl command
http --curl POST api.com/users name=test
Perfect for sharing with teammates who use curl.
JSON from File
# Send JSON file as body
http POST api.com/data < payload.json
# Or use stdin
echo '{"key":"value"}' | http POST api.com/data
Query Parameters
# Use == for query params
http api.com/search q==term page==1 limit==20
# Equivalent to: api.com/search?q=term&page=1&limit=20
Getting Started
-
1
Install HTTPie
Use
brew install httpieon Mac orpip install httpieelsewhere. -
2
Make Your First Request
Try
http httpbin.org/getto see colorized JSON output. -
3
Test POST Requests
Try
http POST httpbin.org/post name=testto see JSON body handling. -
4
Explore More
Run
http --helpor visit the docs for sessions, auth, and more.
Try HTTPie Now
Make API testing enjoyable. Intuitive syntax, beautiful output, sensible defaults.
Get HTTPie