Skip to content

HTTPie & curlie — Modern cURL Alternatives for API Development

DodaTech Updated 2026-06-24 8 min read

In this tutorial, you'll learn about HTTPie & curlie. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

HTTPie and curlie are modern command-line HTTP clients that make API requests readable — with JSON syntax highlighting, intuitive argument syntax, session support, and baked-in authentication helpers.

What You'll Learn

How to use HTTPie for intuitive API requests with JSON support, use curlie as a drop-in curl replacement with a friendlier interface, compare both tools to raw curl, handle authentication, sessions, file uploads, and streaming responses, and integrate them into API development workflows.

Why Modern HTTP Clients Matter

curl is universal but verbose. A simple POST with JSON body requires -X POST -H "Content-Type: application/json" -d '{"key":"value"}' — and the response is raw text. HTTPie replaces this with http POST :3000/api key=value — automatically setting JSON headers, formatting the response, and colorizing it. curlie combines curl's feature completeness with HTTPie's usability. Doda Browser's API team uses HTTPie in all documentation examples because the syntax is self-explanatory.

Learning Path

flowchart LR
  A[Zsh & Oh My Zsh] --> B[HTTPie & curlie
You are here] B --> C[procs & bottom] B --> D[API Development] style B fill:#f90,color:#fff

HTTPie — Human-Friendly HTTP

Installation

# macOS
brew install httpie

# Ubuntu/Debian
sudo apt install httpie

# Fedora
sudo dnf install httpie

# Arch
sudo pacman -S httpie

# Python (latest)
pip install --upgrade httpie

# Verify
http --version

Basic Usage

The http command follows a simple pattern: http [method] URL [items]

# GET request
http httpbin.org/get

# POST with JSON body
http httpbin.org/post name=John age=30

# PUT
http PUT httpbin.org/put id=1 name=Updated

# DELETE
http DELETE httpbin.org/delete

Expected output:

http httpbin.org/json
HTTP/1.1 200 OK
Content-Type: application/json

{
    "slideshow": {
        "author": "Yours Truly",
        "date": "date of publication",
        "slides": [
            {
                "title": "Wake up to WonderWidgets!",
                "type": "all]
            }
        ],
        "title": "Sample Slide Show"
    }
}

Request Items

HTTPie uses a compact syntax for different parts of the request:

# Query parameters (==)
http httpbin.org/get page==2 limit==10

# Request headers (:)
http httpbin.org/headers Authorization:"Bearer token123" X-Custom:"value"

# JSON body fields (=)
http POST httpbin.org/post name=Alice email=alice@example.com

# JSON nested fields (:= for JSON)
http POST httpbin.org/post tags:='["dev", "api"]' meta:='{"key":"value"}'

# Form data (:= and @ for file)
http -f POST httpbin.org/post name=Alice file@./document.pdf

# Raw JSON body
echo '{"key":"value"}' | http POST httpbin.org/post

Output Control

# Pretty-print (default)
http httpbin.org/json

# Compact output (no indentation)
http --pretty=compact httpbin.org/json

# Raw output (no colors, no formatting)
http --print=B httpbin.org/json   # Response body only
http --print=H httpbin.org/json   # Response headers only
http --print=b httpbin.org/json   # Full response (body + headers)
http --print=HhB --pretty=all     # Custom combinations

# Download to file
http --download httpbin.org/image/png -o output.png

# Follow redirects
http --follow httpbin.org/redirect-to?url=http://example.com

Sessions

Sessions persist cookies and headers across requests:

# Create a session (named)
http --session=mysession POST httpbin.org/post username=admin

# Use the session (cookie is preserved)
http --session=mysession httpbin.org/cookies

# Session with authentication
http --session=user1 --auth=user:pass httpbin.org/basic-auth/user/pass

# Read-only session (no save)
http --session-read-only=mysession httpbin.org/get

Authentication

# Basic auth
http --auth user:password httpbin.org/basic-auth/user/pass

# Bearer token
http httpbin.org/bearer Authorization:"Bearer mytoken123"

# Digest auth
http --auth-type=digest --auth user:pass httpbin.org/digest-auth/...

# OAuth 1.0
http --auth-type=oauth1 --auth consumer_key:consumer_secret:token:secret \
    httpbin.org/anything

File Uploads

# Single file
http -f POST httpbin.org/post file@./data.csv

# Multiple files
http -f POST httpbin.org/post file1@./a.pdf file2@./b.pdf

# Stream file (large files)
http httpbin.org/post < largefile.bin

# Upload with additional fields
http -f POST httpbin.org/post name=Alice file@./report.pdf

curlie — curl with HTTPie-Style Syntax

curlie combines curl's power with HTTPie's interface:

Installation

# macOS
brew install curlie

# Ubuntu/Debian (snap)
sudo snap install curlie

# Go
go install github.com/rs/curlie@latest

# Download binary
curl -sSL https://github.com/rs/curlie/releases/download/v1.7.2/curlie_1.7.2_linux_amd64.tar.gz
tar xzf curlie_1.7.2_linux_amd64.tar.gz
sudo install curlie /usr/local/bin/

Usage

curlie uses the same argument syntax as HTTPie:

# GET
curlie httpbin.org/get

# POST with JSON
curlie POST httpbin.org/post name=John age=30

# Headers
curlie httpbin.org/headers Authorization:"Bearer token123"

# Query parameters
curlie httpbin.org/get page==2 limit==10

# With body and headers
curlie POST httpbin.org/post name=Alice X-API-Key:abc123

curl Compatibility

curlie falls through to curl for unsupported arguments:

# Any curl flag works
curlie -v httpbin.org/get
curlie --connect-timeout 5 httpbin.org/get
curlie -x http://proxy:8080 httpbin.org/get

HTTPie vs curlie vs curl

Feature curl HTTPie curlie
Syntax Verbose Compact Compact
JSON support Manual -H/-d Automatic Automatic
Syntax highlighting No Yes Yes
Sessions Manual cookies Built-in No
Plugin system No Yes (plugins) No
Windows support Native Native Via WSL
All curl flags Yes Partial Full
Binary size ~2MB ~5MB ~5MB

Real-World Examples

API Testing Workflow

# 1. Authenticate
http POST api.example.com/auth/login email=test@test.com password=secret
# Save session: http --session=api POST ...

# 2. List resources (with session)
http --session=api GET api.example.com/users

# 3. Create resource
http --session=api POST api.example.com/users name=Alice role=admin

# 4. Update
http --session=api PATCH api.example.com/users/1 name="Alice Updated"

# 5. Delete
http --session=api DELETE api.example.com/users/1

Health Check Monitoring

#!/bin/bash
# health-check.sh

ENDPOINTS=(
    "http://localhost:8080/health"
    "http://localhost:8081/ready"
    "http://localhost:9090/-/healthy"
)

for endpoint in "${ENDPOINTS[@]}"; do
    status=$(http --check-status --timeout 5 --print=h "$endpoint" 2>/dev/null)
    code=$(echo "$status" | head -1 | cut -d' ' -f2)
    if [ "$code" != "200" ]; then
        echo "FAIL: $endpoint returned $code"
    else
        echo "OK: $endpoint"
    fi
done

API Documentation Generation

# Generate curl examples from HTTPie commands
# HTTPie's syntax is easier to document
# Example to show in docs:

# Create a user
# $ http POST api.example.com/users \
#     name=Alice \
#     email=alice@example.com \
#     Authorization:"Bearer $TOKEN"

# The equivalent curl:
# curl -X POST https://api.example.com/users \
#   -H "Authorization: Bearer $TOKEN" \
#   -H "Content-Type: application/json" \
#   -d '{"name":"Alice","email":"alice@example.com"}'

Debugging API Responses

# Show response headers
http --print=Hh httpbin.org/get

# Inspect timing
http --print=h --pretty=none httpbin.org/delay/3

# Test rate limiting
for i in {1..20}; do
    http --check-status --ignore-stdin httpbin.org/get
    sleep 0.1
done

Common Errors

1. "http: command not found"

HTTPie is not installed. Install with pip install httpie or brew install httpie. If pip installs to user site, ensure ~/.local/bin is in PATH.

2. JSON Body Not Automatically Detected

HTTPie detects JSON by default. If sending form data, use -f flag. For raw request body, pipe stdin: cat data.json | http POST httpbin.org/post.

3. HTTPS Certificate Errors

Use --verify=no to skip verification (testing only): http --verify=no https://self-signed.local/api. For production, set the correct CA bundle with --verify=/path/to/ca-bundle.crt.

4. curlie Shows No Output

curlie inherits curl's quiet mode by default. Use -v for verbose output or check the exit code with echo $?.

5. Session Cookies Not Persisting

The session file is created in ~/.httpie/sessions/. Ensure the directory is writable. If using --session-read-only, cookies from the response are not saved.

6. Large File Upload Times Out

HTTPie and curl have default timeouts. Increase with --timeout 300 for long uploads. For extremely large files, use a dedicated upload tool.

7. HTTPie Output Piped to Another Command Shows Escape Codes

HTTPie colors output by default. Use --pretty=none or --style=native when piping: http httpbin.org/get --pretty=none | jq .url.

Practice Questions

1. How do you send a POST request with JSON body using HTTPie? http POST api.example.com/users name=Alice email=alice@example.com — HTTPie automatically sets Content-Type and serializes the data as JSON.

2. How is the HTTPie argument syntax different from curl? HTTPie uses key=value for JSON body fields, key==value for query parameters, and key:value for headers. curl requires explicit flags for each.

3. How do you persist cookies across multiple HTTPie requests? Use --session=name to create a named session. Cookies from responses are saved and sent with subsequent requests.

4. What does http --download url -o file.zip do? Downloads a file and saves it to disk, showing a progress bar. Equivalent to curl -O but with progress display.

5. How do you send a URL-encoded form with HTTPie instead of JSON? Use the -f flag (or --form): http -f POST api.example.com/login username=admin password=secret.

Challenge: Create a Shell Script that: (1) authenticates with a REST API using HTTPie sessions, (2) creates a new resource (e.g., a project with name and description), (3) lists all resources to verify creation, (4) updates the resource, (5) deletes it, (6) verifies deletion. Write the same workflow in plain curl and compare the script lengths. Use curlie to test edge cases (missing fields, invalid auth, duplicate entries) and document the error responses.

Should I replace curl with HTTPie?

For interactive API testing — yes. For scripting and production automation, curl is more portable (pre-installed everywhere). Many developers use HTTPie for development and curl for deployment scripts.

Does HTTPie support HTTP/2?

Yes — HTTPie 3.0+ supports HTTP/2. Enable with --http2.

Can I pipe HTTPie output to jq?

Yes — but disable colors: http --pretty=none httpbin.org/get | jq '.url'.

Does curlie support all curl flags?

Most common ones. curlie passes unknown arguments to curl. For edge cases, curl is more reliable.

How do I use HTTPie with GraphQL?

Send POST requests with the GraphQL query: http POST api.example.com/<a href="/apis/graphql/">GraphQL</a> query="{ users { id name } }".

What's Next

procs & bottom — Modern ps & top
ripgrep & fd — Modern File Search
Essential CLI Tools

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-24.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro