| name | cli-httpie |
| description | Covers effective use of HTTPie (http/https commands) for making HTTP requests from the terminal. Activates when the user asks about HTTPie, testing REST APIs from the command line, sending JSON bodies, managing auth tokens, or debugging HTTP requests interactively.
|
HTTPie — Human-Friendly HTTP Client
Repo: https://github.com/httpie/cli
Modern, user-friendly HTTP client for the terminal. Designed for interacting
with REST APIs, web services, and HTTP servers. Produces colorized, formatted
output by default. Uses an intuitive syntax for JSON bodies, headers, query
params, and auth — no --data-urlencode or -H "Content-Type: application/json" required.
When to Activate
Manual triggers:
- "How do I use HTTPie?"
- "Test this REST API from the terminal"
- "Send a POST with a JSON body"
- "Make an authenticated API call"
Auto-detect triggers:
- User wants to send HTTP requests from the terminal and prefers readable syntax
- User needs session persistence or cookie handling for API workflows
- User is debugging HTTP headers, status codes, or request/response bodies
- User wants to pipe API responses to jq for processing
- User needs to upload files or submit forms from the terminal
Key Commands
Installation and Basics
brew install httpie
pip install httpie
apt install httpie
http GET https://api.example.com/users
https api.example.com/users
http POST api.example.com/users
http PATCH api.example.com/users/1
http PUT api.example.com/users/1
http DELETE api.example.com/users/1
http HEAD api.example.com
http OPTIONS api.example.com
Item Types (the core syntax)
http POST api.example.com/users name=Alice age:=30 active:=true
http POST api.example.com/items \
name="My Item" \
price:=9.99 \
tags:='["sale","new"]' \
metadata:='{"color":"red"}' \
Authorization:"Bearer $TOKEN" \
page==1 \
limit==50
GET with Query Parameters
http GET api.example.com/search q==hello lang==en page==2
https httpbin.org/get foo==bar baz==qux
POST with JSON Body
http POST api.example.com/users \
name="Alice" \
email="alice@example.com" \
age:=28 \
roles:='["admin","user"]'
http POST api.example.com/data < payload.json
echo '{"name":"Alice"}' | http POST api.example.com/users
http POST api.example.com/data Content-Type:application/json @payload.json
Headers
http GET api.example.com \
Authorization:"Bearer $TOKEN" \
Accept:application/json \
X-Request-ID:abc123
http --headers GET api.example.com
Output Control
http --print=HhBb api.example.com
http --print=b api.example.com
http --headers api.example.com
http --body api.example.com
http -v api.example.com
http --quiet api.example.com
http --stream api.example.com
http -o output.json api.example.com
http --download api.example.com/file.zip
Authentication
http -a username:password api.example.com
http api.example.com Authorization:"Bearer $TOKEN"
http --auth-type=digest -a user:pass api.example.com
http api.example.com X-API-Key:$API_KEY
http api.example.com apikey==$API_KEY
Sessions (Persistent Cookies + Auth)
http --session=myapi POST api.example.com/login username=me password=secret
http --session=myapi GET api.example.com/protected-endpoint
http --session=/tmp/mysession.json GET api.example.com
http --session=github Authorization:"Bearer $GH_TOKEN" GET api.github.com/user
http --session=github GET api.github.com/repos
Forms and File Uploads
http --form POST api.example.com/login username=me password=secret
http --multipart POST api.example.com/upload photo@/path/to/photo.jpg
http --multipart POST api.example.com/batch \
file1@/tmp/a.csv \
file2@/tmp/b.csv
http --multipart POST api.example.com/submit \
name="My Upload" \
attachment@./report.pdf
Downloads
http --download api.example.com/archive.tar.gz
http --download -o custom-name.tar.gz api.example.com/archive.tar.gz
http --download api.example.com/file.zip --continue
Advanced Patterns
Session Persistence with Auth Tokens
TOKEN=$(http POST api.example.com/auth/login \
username=me password=secret \
| jq -r '.token')
http --session=myapp \
Authorization:"Bearer $TOKEN" \
GET api.example.com/profile
http --session=myapp GET api.example.com/dashboard
http --session=myapp POST api.example.com/posts title="Hello"
Piping with jq
http GET api.example.com/users | jq '.[] | .email'
http GET api.example.com/users | jq '[.[] | select(.active)] | map(.name)'
http POST api.example.com/items name="Widget" price:=9.99 \
| jq '{id: .id, created: .created_at}'
USER_ID=$(http POST api.example.com/users name="Alice" | jq -r '.id')
http POST api.example.com/users/$USER_ID/activate
SSL and Proxy
http --verify=no GET https://localhost:8443/api
http --verify=/path/to/ca-bundle.crt GET https://internal.corp/api
http --cert=client.crt --cert-key=client.key GET https://api.example.com
http --proxy=http:http://proxy:8080 GET api.example.com
http --proxy=all:socks5://localhost:1080 GET api.example.com
Debugging
http -v POST api.example.com/data name=test
http --print=Hh api.example.com
http --print=b api.example.com
http --offline POST api.example.com/data name=Alice
http --follow GET api.example.com/redirect
http --no-follow GET api.example.com/redirect
http --meta api.example.com
Environment Variables with .env Files
http GET $API_URL/users Authorization:"Bearer $TOKEN"
Default Options (Config)
{
"default_options": [
"--session=default",
"--timeout=30"
]
}
Streaming and SSE
http --stream GET api.example.com/events
http --stream GET api.example.com/logs/tail | grep ERROR
Practical Examples
API Development Workflow
http POST localhost:8080/api/users name="Test User" email="test@example.com"
http GET localhost:8080/health
http GET localhost:8080/items page==1 per_page==10
http GET localhost:8080/items page==2 per_page==10
GitHub API via HTTPie
TOKEN=$(gh auth token)
http GET api.github.com/user/repos \
Authorization:"Bearer $TOKEN" \
per_page==5 \
| jq '.[].full_name'
http POST api.github.com/repos/owner/repo/issues \
Authorization:"Bearer $TOKEN" \
title="Bug report" \
body="Steps to reproduce..."
Upload and Process a File
http --multipart POST api.example.com/import data@report.csv \
| jq '{imported: .count, errors: .errors}'
One-liner OAuth Flow Debug
http -v POST oauth.example.com/token \
--form \
grant_type=authorization_code \
code=$AUTH_CODE \
client_id=$CLIENT_ID \
client_secret=$CLIENT_SECRET \
redirect_uri=https://myapp.com/callback
Chaining with Other Skills
- jq (cli-jq): HTTPie pipes beautifully to jq — use
http GET url | jq '.field' as the standard API exploration pattern
- gh (cli-gh): Use
gh auth token to get a GitHub token, then pass it to HTTPie for raw GitHub API calls beyond what gh supports
- yq (cli-yq): For APIs returning YAML (rare but possible), pipe HTTPie output to yq for processing
- fzf (cli-fzf): Combine HTTPie + jq to get a list of resources, then fzf for interactive selection before a follow-up request