Skip to content

HTTPie

100 commands

A human-friendly HTTP client with intuitive syntax, JSON support and coloured output — great for exploring APIs.

  • HTTP
  • APIs
  • JSON

Install HTTPie

sudo apt install httpie

Basic HTTP Request8

http https://api.example.com/health

Sends a basic GET request to the specified URL using default settings.

http GET https://api.example.com/users

Explicitly specifies the GET method for clarity when fetching resources.

http POST https://api.example.com/users name="John Doe"

Sends a POST request with a JSON body containing a string field.

http PUT https://api.example.com/users/1 active:=true

Sends a PUT request using non-string JSON data types like booleans.

http DELETE https://api.example.com/users/1

Sends a DELETE request to remove a resource.

http PATCH https://api.example.com/users/1 email="new@example.com"

Sends a PATCH request to partially update a resource.

http HEAD https://api.example.com/large-file.zip

Retrieves only the headers of a resource without downloading the body.

http OPTIONS https://api.example.com/users

Queries the supported HTTP methods for a specific endpoint.

URL Parameters2

http https://api.example.com/search q==httpie page==1

Appends URL query parameters automatically using the double equals syntax.

http https://api.example.com/filter tags==api tags==testing

Sends multiple values for the same query parameter key.

Link

Data Submission (JSON)7

http POST https://api.example.com/orders id:=42 price:=19.99

Constructs a JSON body with integer and float values using the colon-equals syntax.

Link
http POST https://api.example.com/config settings:='{"theme": "dark"}'

Embeds a raw JSON object inside a specific field of the request payload.

Link
http POST https://api.example.com/data items:='[1, 2, 3]'

Sends a JSON array within a specific field of the request body.

Link
http POST https://api.example.com/users null:=null empty:=""

Sends explicit null values and empty strings in a JSON payload.

Link
http POST https://api.example.com/math pi:=3.14159

Sends floating point numbers directly in the JSON body.

Link
http POST https://api.example.com/array list:='[{"id":1}, {"id":2}]'

Sends a list of objects within a JSON field.

Link
http POST https://api.example.com/hook payload:='{"a": [1,2], "b": {"c": 3}}'

Sends complex nested JSON structures in a single command.

Link

Data Submission (Form)1

http -f POST https://api.example.com/login username=admin password=secret

Submits data as 'application/x-www-form-urlencoded' instead of JSON.

Link

Headers6

http https://api.example.com/secure X-API-Key:123456

Adds a custom HTTP header to the request using the colon syntax.

Link
http https://api.example.com/mobile User-Agent:iOS/15.0

Overrides the default User-Agent header to simulate a different client.

Link
http https://api.example.com/resource If-None-Match:"etag_value"

Sends conditional headers to check for resource updates.

Link
http https://api.example.com/protected Authorization:"Bearer mytoken"

Manually sets the Authorization header for token-based access.

Link
http https://api.example.com header-with-empty-value:

Sends a header with an empty value.

Link
http https://api.example.com header-to-remove:

Removes a default header (like Accept-Encoding) by setting it to empty.

Link

Data Submission (Files)3

http POST https://api.example.com/upload @/path/to/data.json

Uploads the contents of a file as the raw request body.

Link
http -f POST https://api.example.com/upload profile_pic@/path/to/image.png

Uploads a file as a field in a Multipart-Encoded form.

Link
http --form POST https://api.example.com/upload file@/dev/null

Simulates a file upload with an empty file.

Link

Authentication4

http -a user:password https://api.example.com/protected

Performs Basic Authentication with the provided username and password.

Link
http -a user https://api.example.com/protected

Prompts interactively for the password for Basic Authentication.

Link
http -A digest -a user:pass https://api.example.com/digest-auth

Uses Digest Authentication instead of the default Basic Auth.

Link
http -A bearer -a 'token_string' https://api.example.com/api

Simplifies Bearer Token authentication syntax.

Link

Session Management4

http --session=logged-in -a user:pass https://api.example.com/login

Creates a named session that persists cookies and auth headers.

Link
http --session=logged-in https://api.example.com/dashboard

Reuses an existing session to maintain state across requests.

Link
http --session-read-only=logged-in https://api.example.com/view

Uses a session's cookies but does not save any new cookies received.

Link
http --session=secure_user --ssl=tls1.3 https://api.example.com/profile

Saves a session that forces TLS 1.3 for future requests.

Link

Output Control12

http -v https://api.example.com/debug

Prints the whole HTTP exchange (request and response) for debugging.

Link
http -h https://api.example.com/headers

Prints only the response headers, suppressing the body.

Link
http -b https://api.example.com/json

Prints only the response body, suppressing the headers.

Link
http -p Hh https://api.example.com/trace

Prints request headers (H) and response headers (h) only.

Link
http --style=solarized https://api.example.com/color

Changes the syntax highlighting color scheme of the output.

Link
http --pretty=none https://api.example.com/raw

Disables all formatting and colors for raw output.

Link
http --pretty=format https://api.example.com/data

Applies formatting to the JSON output but disables colors.

Link
http --print=b --pretty=format https://api.example.com/data > output.json

Saves only the formatted response body to a file for later inspection.

Link
http --print=HB https://api.example.com

Prints the request headers (H) and request body (B) only.

Link
http --stream https://api.example.com/events

Streams the response output line-by-line, ideal for Server-Sent Events (SSE).

Link
http --style=monokai https://api.example.com/code

Uses the Monokai color scheme for better visibility of code responses.

Link
http --pretty=all --style=fruity https://api.example.com

Maximizes readability with pretty printing and a vibrant color style.

Link

Downloads4

http -d https://api.example.com/files/report.pdf

Downloads the file and saves it with the filename from the Content-Disposition header.

Link
http -o my_report.pdf https://api.example.com/files/report.pdf

Downloads the file and saves it with a custom filename.

Link
http --download --output report.pdf https://api.example.com/report

Explicit long-form command to download a resource to a file.

Link
http -d -o archive.zip https://api.example.com/generate-zip

Combines download flag with output filename for clear intent.

Link

SSL & Security4

http --verify=no https://self-signed.local/admin

Skips SSL certificate verification (insecure) for testing self-signed certs.

Link
http --verify=/path/to/ca.pem https://internal.api.com

Verifies the SSL certificate using a custom CA bundle.

Link
http --cert=client.pem --cert-key=key.pem https://mtls.example.com

Uses a client certificate and private key for Mutual TLS (mTLS) authentication.

Link
http --ssl=tls1.2 https://legacy.example.com

Forces a specific SSL/TLS version for the connection.

Link

Proxy Usage4

http --proxy=http:http://10.0.0.1:8080 https://api.example.com

Routes HTTP traffic through a specific proxy server.

Link
http --proxy=https:socks5://127.0.0.1:9050 https://onion.example.com

Routes HTTPS traffic through a SOCKS5 proxy.

Link
http --proxy-auth=user:pass --proxy=http:10.0.0.1:8080 https://api.example.com

Authenticates with the proxy server using Basic Auth.

Link
http --proxy=http:http://user:pass@10.10.1.1:8080 https://api.example.com

Inline proxy authentication syntax within the proxy URL.

Link

Networking6

http --timeout=5 https://slow.example.com

Sets a connection and read timeout in seconds.

Link
http --follow https://redirect.example.com

Automatically follows 30x redirects.

Link
http --max-redirects=3 --follow https://loop.example.com

Limits the number of redirects followed to prevent infinite loops.

Link
http --ipv4 https://api.example.com

Forces the connection to use IPv4 only.

Link
http --ipv6 https://api.example.com

Forces the connection to use IPv6 only.

Link
http --max-redirects=0 https://api.example.com/redirect

Prevents following any redirects to inspect the 3xx response directly.

Link

Advanced Workflow7

http --chunked POST https://api.example.com/stream @large_file.txt

Forces chunked transfer encoding for uploading large files.

Link
http -f POST https://api.example.com/search query='test' filters:='{"active":true}'

Mixes form fields and JSON strings in a single form-encoded request.

Link
cat config.json | http POST https://api.example.com/setup env==production

Uploads a file via piping while simultaneously adding URL query parameters.

Link
http --compress POST https://api.example.com/logs @large_log.txt

Compresses the request body using gzip before sending.

Link
http --quiet POST https://api.example.com/ping

Suppresses all output entirely, useful for silent heartbeat scripts.

Link
http --session=temp https://api.example.com/1 && http --session=temp https://api.example.com/2

Uses a temporary named session for a quick multi-step workflow.

Link
http --print=b https://api.example.com/ip | http POST https://api.tracker.com/log ip=@-

Pipes the body of one response into a field of the next request.

Link

Offline & Debug2

http --offline https://api.example.com/test

Prints the request that would be sent without actually sending it.

Link
http --debug https://api.example.com

Prints detailed exception tracebacks for troubleshooting HTTPie errors.

Link

Scripting & Automation6

http --check-status https://api.example.com/health

Exits with an error code if the HTTP status is not 2xx, useful for scripts.

Link
http --ignore-stdin https://api.example.com/test

Prevents HTTPie from reading data piped to stdin.

Link
echo '{"foo": "bar"}' | http POST https://api.example.com/pipe

Pipes JSON from the shell directly into the request body.

Link
http --timeout=0.1 https://local.test

Sets a very short timeout to test latency handling.

Link
http --check-status --ignore-stdin GET https://healthcheck.local

Robust health check command for cron jobs.

Link
http --check-status --timeout=2 HEAD https://critical.service.local

A fast, strict availability check for monitoring systems.

Link

Red Team / Testing8

http POST https://api.example.com/login username=' admin'--'

Injects SQL payloads into JSON fields for vulnerability testing.

Link
http https://api.example.com/admin Cookie:session_id=admin_cookie

Manually injects a session cookie to test session hijacking scenarios.

Link
http -v PUT https://api.example.com/profile Host:internal-admin.local

Spoofs the Host header to test for Host Header Injection vulnerabilities.

Link
http DELETE https://api.example.com/users/1 X-HTTP-Method-Override:PUT

Tests for HTTP method override vulnerabilities in APIs.

Link
http POST https://api.example.com/xml Content-Type:application/xml @payload.xml

Manually sets Content-Type to send XXE payloads via raw XML files.

Link
http POST https://api.example.com/login 'username=admin'' OR ''1''=''1'

Tests SQL injection vulnerabilities using form fields.

Link
http GET https://api.example.com/admin 'X-Original-URL:/admin'

Tests for access control bypass using framework-specific override headers.

Link
http -v OPTIONS https://api.example.com

Checks for CORS misconfigurations and allowed methods verbally.

Link

Blue Team / Validation4

http --print=h https://api.example.com | grep 'Strict-Transport-Security'

Validates the presence of security headers in the response.

Link
http --max-headers=1024 https://api.example.com

Adjusts the maximum allowed header size to test boundary conditions.

Link
http HEAD https://api.example.com | grep -i "server"

Inspects the Server header to identify backend technology.

Link
http --verify=no HEAD https://expired.example.com

Checks connectivity to a host with an expired certificate without failing.

Link

Incident Response1

http -v --all https://api.example.com/suspicious-endpoint

Captures the entire redirect chain and all headers for forensic analysis.

Link

API Testing3

http https://api.example.com/users | http POST https://api.backup.com/users

Downloads data from one API and immediately pipes it as a POST body to another.

Link
http --session=test https://api.example.com/token && http --session=test https://api.example.com/data

Chains commands in shell using the same session for sequential testing.

Link
http PUT https://api.example.com/items/1 updated_at:=`date +%s`

Uses shell command substitution to send a current timestamp.

Link

Configuration1

http --default-scheme=https example.com

Sets the default protocol scheme to HTTPS for the request.

Link

Advanced Auth2

http --auth-type=digest -a user:pass POST https://api.example.com/upload @file.bin

Combines Digest Auth with binary file uploading.

Link
http -a user:pass --auth-type=basic https://api.example.com

Explicitly sets auth type to Basic (redundant but explicit for scripts).

Link

Cleanup1

http --session=logged-in DELETE https://api.example.com/logout

Uses the session to call the logout endpoint before discarding the session file.

Link