Terminal GuideTerminal Guide
httpie icon

HTTPie

Dev Tools
macOSLinuxWindows
Python

User-friendly command-line HTTP client.

Official Website

Features

Intuitive SyntaxJSON SupportSyntax HighlightingPlugins

Installation

Homebrew
brew install httpie
APT (Debian/Ubuntu)
apt install httpie
Pacman (Arch)
pacman -S httpie
pip
pip install httpie

Why use HTTPie?

HTTPie is designed with the concept of "HTTP client for humans" in mind. With more intuitive syntax than curl, you can efficiently develop and debug APIs.

Readable Output

Colorful output with syntax highlighting. Headers and body are beautifully formatted.

Intuitive Syntax

Just list key=value pairs after the URL. JSON is handled automatically.

Authentication Support

Supports multiple auth methods including Basic, Bearer Token, and OAuth.

Session Management

Save cookies and headers as sessions. Run consecutive API tests easily.

Installation

Installation
# macOS (Homebrew)
brew install httpie

# pip (Python)
pip install httpie

# Ubuntu/Debian
sudo apt install httpie

# Arch Linux
sudo pacman -S httpie

# Windows (pip)
pip install httpie

Basic Usage

GET Request

GET
# Simple GET
http GET https://api.github.com/users/octocat

# http defaults to GET
http https://api.github.com/users/octocat

# Query parameters
http https://api.github.com/search/repositories q==python sort==stars

# Add headers
http https://api.example.com/data Accept:application/json X-API-Key:secret123

POST Request

POST
# Send JSON data (default)
http POST https://api.example.com/users name=John age:=30 active:=true

# = is string, := is JSON value (number, boolean, array, object)

# Send array
http POST https://api.example.com/items tags:='["dev","test"]'

# Nested object
http POST https://api.example.com/users user[name]=John user[email]=john@example.com

Other HTTP Methods

HTTP Methods
# PUT
http PUT https://api.example.com/users/1 name=Jane

# PATCH
http PATCH https://api.example.com/users/1 email=jane@example.com

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

# HEAD (get headers only)
http HEAD https://api.example.com/health

Common Patterns

Authentication

Authentication
# Basic auth
http -a username:password https://api.example.com/secure

# Bearer Token
http https://api.example.com/data Authorization:"Bearer your-token-here"

# API Key (header)
http https://api.example.com/data X-API-Key:your-api-key

# API Key (query parameter)
http https://api.example.com/data api_key==your-api-key

File Upload

Upload
# Upload file (multipart/form-data)
http -f POST https://api.example.com/upload file@/path/to/image.jpg

# Multiple files
http -f POST https://api.example.com/upload files@image1.jpg files@image2.jpg

# Combine file with fields
http -f POST https://api.example.com/upload file@document.pdf description="Report"

JSON Body

JSON Body
# JSON from standard input
echo '{"name":"John","age":30}' | http POST https://api.example.com/users

# JSON body from file
http POST https://api.example.com/users < user.json

# Here document
http POST https://api.example.com/users <<< '{"name":"John","items":[1,2,3]}'

Advanced Usage

Sessions

Sessions
# Use session (save cookies)
http --session=mysession POST https://api.example.com/login username=user password=pass

# Subsequent requests with same session
http --session=mysession https://api.example.com/dashboard

# Named session (saved per host)
http --session=./session.json https://api.example.com/data

# Read-only session (don't save changes)
http --session-read-only=mysession https://api.example.com/profile

Output Control

Output Control
# Show headers only
http --headers https://api.example.com/data

# Show body only
http --body https://api.example.com/data

# Show both request and response
http --verbose https://api.example.com/data

# Download
http --download https://example.com/file.zip

# Save output to file
http https://api.example.com/data > response.json

Proxy and SSL

Proxy and SSL
# HTTP proxy
http --proxy=http:http://proxy.example.com:8080 https://api.example.com

# Skip SSL certificate verification (development only)
http --verify=no https://localhost:8443/api

# Client certificate
http --cert=client.pem --cert-key=client-key.pem https://api.example.com

Common Options

OptionDescriptionExample
-v, --verboseVerbose output (including request)http -v GET url
-h, --headersShow headers onlyhttp -h GET url
-b, --bodyShow body onlyhttp -b GET url
-f, --formSend as form datahttp -f POST url file@f.txt
-aBasic authenticationhttp -a user:pass url
--json, -jJSON mode (explicit)http -j POST url data=val
--timeoutTimeout in secondshttp --timeout=30 url

Comparison with curl

GET Request

Comparison: GET
# curl
curl -H "Accept: application/json" https://api.example.com/users

# HTTPie
http https://api.example.com/users Accept:application/json

POST Request (JSON)

Comparison: POST
# curl
curl -X POST -H "Content-Type: application/json" -d '{"name":"John","age":30}' https://api.example.com/users

# HTTPie
http POST https://api.example.com/users name=John age:=30

Tips

  • = is interpreted as string, := is interpreted as JSON. Use := for numbers and booleans
  • == adds query parameters (?key=value)
  • When piping output to jq, use http -b to output body only
  • Customize default settings in ~/.config/httpie/config.json
  • HTTPie Desktop (GUI version) is also available for more visual API testing
Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More