| name | httpie |
| description | Use this skill whenever the user wants to make HTTP requests, test APIs, call REST endpoints, debug web services, or interact with any HTTP/HTTPS API using the HTTPie CLI tool (`http` command). Trigger this skill for any request involving: sending GET/POST/PUT/PATCH/DELETE requests, testing API endpoints, sending JSON or form data, working with authentication (Bearer token, Basic auth), uploading files, downloading responses, managing sessions, inspecting request/response headers, or piping HTTP calls in shell scripts. Use this skill even when the user just says "call the API", "send a request", "hit this endpoint", or "test with httpie" � don't wait for explicit httpie mention.
|
HTTPie CLI Skill
HTTPie is a modern, human-friendly HTTP client for the command line. The main command is http (or https for HTTPS-only).
Installation
pip install httpie
brew install httpie
sudo apt install httpie
Verify: http --version
Request Syntax
http [METHOD] URL [REQUEST_ITEMS...]
- METHOD is optional: defaults to
GET when no data, POST when data is present
- URL: scheme defaults to
http://; use :3000 as shorthand for localhost:3000
Request Items � Key Separators
| Separator | Type | Example |
|---|
= | JSON string field (or form field with -f) | name=Jean |
:= | Raw JSON value (non-string) | active:=true, count:=42, tags:='["a","b"]' |
== | URL query parameter | search==httpie |
: | HTTP header | Authorization:Bearer TOKEN |
@ | File upload (form/multipart) | file@./report.pdf |
=@ | File content as string field | body=@./message.txt |
:=@ | File content as raw JSON | config:=@./config.json |
Common Examples
GET requests
http GET https://api.example.com/users
http GET https://api.example.com/users search==alice limit==10
http https://api.example.com/users
http :8080/health
POST with JSON (default)
http POST https://api.example.com/users \
name="Jean-Jacques" \
email="jj@example.com" \
active:=true \
roles:='["admin","user"]'
echo '{"name":"test"}' | http POST https://api.example.com/users
PUT / PATCH / DELETE
http PUT https://api.example.com/users/42 name="Updated"
http PATCH https://api.example.com/users/42 email="new@example.com"
http DELETE https://api.example.com/users/42
Form data (-f)
http -f POST https://api.example.com/login username=admin password=secret
File upload (multipart)
http -f POST https://api.example.com/upload file@./document.pdf title="My Doc"
Authentication
http -a username:password https://api.example.com/secure
http -A bearer -a TOKEN https://api.example.com/secure
http -a username https://api.example.com/secure
Headers
http GET https://api.example.com/data \
Accept:application/json \
X-Request-Id:abc-123 \
Authorization:"Bearer $(cat token.txt)"
Output Control
http -v GET https://api.example.com/users
http -h GET https://api.example.com/users
http -b GET https://api.example.com/users
http --print=Hb GET https://api.example.com/users
http --pretty=none GET https://api.example.com/users
http --check-status GET https://api.example.com/users
Download Files
http --download https://example.com/file.zip
http --download -o /tmp/output.zip https://example.com/file.zip
http --download --continue -o /tmp/output.zip https://example.com/file.zip
Sessions (Persist cookies & auth)
http --session=myapi POST https://api.example.com/login username=admin password=secret
http --session=myapi GET https://api.example.com/profile
http --session-read-only=myapi GET https://api.example.com/data
Useful Flags
--offline
--follow
--timeout=10
--proxy=http:http://proxy:8080
--verify=no
--cert=./cert.pem
--stream
--quiet
Scripting Patterns
Avoid stdin conflicts in scripts
When running HTTPie in a script or CI pipeline where stdin may not be a TTY, add --ignore-stdin to avoid the "body from stdin and key=value cannot be mixed" error:
http --ignore-stdin POST https://api.example.com/users name=test active:=true
Use in shell pipelines
TOKEN=$(http POST https://api.example.com/auth username=admin password=secret \
--pretty=none -b | jq -r '.token')
http GET https://api.example.com/profile "Authorization:Bearer $TOKEN"
Exit codes with --check-status
if http --check-status --quiet GET https://api.example.com/health; then
echo "API is up"
else
echo "API returned error"
fi
Offline dry-run (inspect before sending)
http --offline POST https://api.example.com/users name=test active:=true
HTTPie vs curl Equivalents
| Goal | HTTPie | curl |
|---|
| GET request | http GET url | curl url |
| POST JSON | http POST url key=val | curl -X POST -H 'Content-Type: application/json' -d '{"key":"val"}' url |
| Bearer auth | http -A bearer -a TOKEN url | curl -H 'Authorization: Bearer TOKEN' url |
| Show headers | http -h url | curl -I url |
| Verbose | http -v url | curl -v url |
Configuration
HTTPie config lives at ~/.config/httpie/config.json:
{
"default_options": ["--style=monokai", "--pretty=all", "--check-status"]
}
Tips
- Always quote values with spaces:
description='hello world'
- Escape colons in field names:
field\:name=value
- GCP/cloud APIs: use
http -A bearer -a "$(gcloud auth print-access-token)" ...
- Pipe JSON input:
cat payload.json | http POST https://api.example.com/endpoint
- Debug CI pipelines: use
--offline to validate request shape without actually calling the API
- Combine with
jq for powerful JSON manipulation in scripts