Last updated: May 2025 | Perfect for quick reference, API testing, and proxy validation.
1. Basics
# Simple GET
curl https://example.com
# Follow redirects
curl -L https://example.com
# Save output to file
curl -o output.html https://example.com
curl -O https://example.com/file.tar.gz # keep original filename2. HTTP Methods
# GET with query params
curl "https://httpbin.org/get?key=value&foo=bar"
# POST JSON
curl -X POST -H "Content-Type: application/json" \
-d '{"name":"test","value":123}' https://httpbin.org/post
# POST form data
curl -X POST -d "name=test&value=123" https://httpbin.org/post
# PUT
curl -X PUT -H "Content-Type: application/json" \
-d '{"updated":"data"}' https://httpbin.org/put
# DELETE
curl -X DELETE https://httpbin.org/delete3. Headers & Metadata
# Custom headers
curl -H "Authorization: Bearer token123" https://api.example.com
curl -H "X-Custom-Header: value" https://httpbin.org/headers
# View only headers (HEAD request)
curl -I https://example.com
# Verbose output (great for debugging)
curl -v https://httpbin.org/headers
curl -vvv https://httpbin.org/headers # extra verbose4. Authentication
# Basic Auth
curl -u username:password https://httpbin.org/basic-auth/username/password
# Bearer Token
curl -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user
# OAuth / API Key (common pattern)
curl -H "X-API-Key: your_key_here" https://api.example.com5. Cookies & Sessions
# Send cookies
curl -b "session=abc123; user=guest" https://httpbin.org/cookies
# Store & reuse cookies (session simulation)
curl -c cookies.txt -b cookies.txt https://httpbin.org/cookies/set?foo=bar6. Downloads & Uploads
# Download with progress bar
curl -# -O https://speed.cloudflare.com/__down?bytes=100000000
# Resume interrupted download
curl -C - -O https://example.com/largefile.zip
# Upload file
curl -F "file=@localfile.txt" https://httpbin.org/post
curl --upload-file largefile.zip https://transfer.sh/7. Performance & Limits
# Set timeout (seconds)
curl --max-time 10 https://example.com
# Connect timeout
curl --connect-timeout 5 https://example.com
# Limit download speed (e.g., 1MB/s)
curl --limit-rate 1M https://example.com/largefile
# Number of redirects to follow
curl -L --max-redirs 5 https://example.com8. Proxy & Network Options
# HTTP Proxy
curl -x http://proxy:8080 https://example.com
# SOCKS5 Proxy
curl -x socks5://proxy:1080 https://example.com
# Proxy with auth
curl -x http://user:pass@proxy:8080 https://example.com
# Ignore SSL errors (useful for testing)
curl -k https://self-signed.example.com9. Advanced / Useful Flags
# Silent (no progress) but show errors
curl -s -S https://example.com
# Raw output (no decoding)
curl --raw https://...
# Trace to file (detailed timing)
curl --trace trace.log https://httpbin.org/get
# Parallel requests (curl >= 7.66)
curl --parallel --parallel-immediate \
-o file1 https://... \
-o file2 https://...10. Informative & Testing Endpoints
Great for testing proxies, headers, latency, and API behavior:
httpbin.org (Most Useful)
https://httpbin.org/get— Echo request detailshttps://httpbin.org/post— Test POSTshttps://httpbin.org/headers— View all headershttps://httpbin.org/ip— Your IP (perfect proxy test)https://httpbin.org/uuid— Random UUIDhttps://httpbin.org/delay/3— Artificial delay (seconds)https://httpbin.org/status/404— Specific status codeshttps://httpbin.org/redirect/3— Chain of redirectshttps://httpbin.org/basic-auth/user/pass— Basic auth testhttps://httpbin.org/cookies— Cookie testing
Other Excellent Test Endpoints
Cloudflare:
https://speed.cloudflare.com/__down?bytes=100000000— Large download testhttps://1.1.1.1/cdn-cgi/trace— Cloudflare edge info
JSONPlaceholder (Fake REST API):
https://jsonplaceholder.typicode.com/posts— GET/POSThttps://jsonplaceholder.typicode.com/users
Reqres.in:
https://reqres.in/api/users— User CRUD simulation
IP & Location:
https://ipinfo.io/jsonhttps://ifconfig.me/all.jsonhttps://httpbin.org/ip
Others:
https://httpstat.us/200— Simple status checkhttps://postman-echo.com/get— Alternative to httpbinhttps://api.github.com/users/octocat— Real public API
One-Liners You'll Love
# Quick proxy + IP check
curl -x http://yourproxy:port https://httpbin.org/ip
# Test API with pretty JSON
curl -s https://httpbin.org/get | jq .
# Check website headers quickly
curl -I -L https://example.com
# Download all images from a page (advanced)
curl -s https://example.com | grep -o 'https://[^"]*\.jpg' | xargs -n1 curl -OPro Tips:
- Combine flags:
curl -v -L -H "Accept: application/json" ... - Use
-w "%{http_code} %{time_total}\n"for timing stats - Alias common commands in
~/.bashrc
alias myapi='curl -H "Authorization: Bearer $TOKEN" https://api.example.com'
Be the first to comment on this post.