HTTPie Cheat Sheet
Command syntax, headers, auth, and JSON shorthand for making human-friendly HTTP requests from the terminal with HTTPie.
Basic Requests
GET, POST, and method shorthand with HTTPie's simplified syntax.
# GET request, pretty-printed JSON response by defaulthttps httpie.io/hello# POST with JSON body (key=value becomes JSON automatically)http POST api.example.com/orders sku=ABC123 quantity:=2# Explicit methodhttp PUT api.example.com/orders/42 status=shipped
Headers, Auth & Query Params
Common flags for authenticated, parameterized requests.
# Custom header + bearer tokenhttp api.example.com/orders "Authorization:Bearer $TOKEN" "X-Request-Id:abc123"# Basic authhttp -a user:pass api.example.com/secure# Query params (== for query string)http api.example.com/orders status==shipped limit==10# Save response to a file, follow redirectshttp --download --follow api.example.com/export.csv
Item Type Suffixes
The suffix determines how HTTPie encodes each key=value pair.
- key=value- string field in JSON body
- key:=value- raw JSON value (numbers, booleans, arrays, objects)
- key==value- URL query string parameter
- key:value- HTTP header
- [email protected]- upload file content as a form field
- [email protected]- read field value from a file's contents
Persistent Sessions
Store cookies, auth, and headers in a named session so you don't re-authenticate every call.
# Create a named session that persists cookies, auth and headers across callshttp --session=my-api -a user:pass POST api.example.com/login# Reuse the session on subsequent requests - no need to re-pass credentialshttp --session=my-api GET api.example.com/orders# Read-only session: use stored auth but don't persist new response statehttp --session-read-only=my-api GET api.example.com/orders
Config File & Default Options
Set persistent defaults so common flags don't need to be repeated on every call.
# ~/.config/httpie/config.json (default_options applied to every invocation)cat ~/.config/httpie/config.json# {# "default_options": ["--timeout=10", "--style=monokai"]# }# Wrap common invocations as shell aliasesalias hstage='http --default-scheme=https api-staging.example.com'# List installed plugins (e.g. httpie-jwt-auth, httpie-ntlm)python -m pip list | grep -i httpie
Status Checks & Streaming
Fail fast on error responses and read chunked/long-lived responses incrementally.
# Exit non-zero on 4xx/5xx instead of silently printing the error bodyhttp --check-status GET api.example.com/health; echo $?# Stream a chunked/long-lived response line by line as it arriveshttp --stream GET api.example.com/events# Pipe a raw local file as the request body, bypassing key=value parsingcat payload.json | http POST api.example.com/import Content-Type:application/json
Advanced Flags
Less common flags that matter once you're past basic requests.
- --verify=no- skip TLS certificate verification (local/dev only, never production)
- --cert / --cert-key- present a client certificate for mTLS-protected APIs
- --proxy- route a scheme through a proxy, e.g. https:socks5://localhost:9050
- -v / --verbose- print the full request (headers + body) alongside the response
- --print=Hh- control exactly what's printed: request/response Headers/body flags
- --timeout- abort a hanging request after N seconds
- -F / --form- send as multipart/form-data instead of JSON (required for file uploads)
Multipart Upload & JWT Workflow
Upload a file field and chain a login response into an authenticated follow-up request.
# Multipart form upload with a file fieldhttp -F POST api.example.com/upload [email protected] description='Q2 report'# JWT auth: fetch a token, then reuse it via a shell variableTOKEN=$(http POST api.example.com/auth/token \ username=alice password=secret | jq -r .access_token)http GET api.example.com/me "Authorization:Bearer $TOKEN"
Use `http --offline` to preview the exact request HTTPie would send (headers, body, URL) without actually making the call — invaluable for debugging complex `:=` JSON payloads before you fire them at a real API.