HomeCheat SheetscURL Command Line HTTP Request Cheat Sheet
100% Client-Side β€’ 0 B Data Leaves Browser
terminal

cURL Command Line HTTP Request Cheat Sheet

The definitive cURL CLI cheat sheet for testing APIs and microservices. Headers, JSON payloads, file uploads, authentication, and debug tracing.

Basic HTTP Methods

Standard HTTP GET request and print response to stdoutcurl https://api.example.com/items
Fetch HTTP response headers only (HEAD request)curl -I https://example.com
HTTP POST request with url-encoded form bodycurl -X POST https://api.example.com/items -d "name=Test"
HTTP PUT requestcurl -X PUT https://api.example.com/items/1 -d "name=Updated"
HTTP DELETE requestcurl -X DELETE https://api.example.com/items/1

JSON API Requests & Headers

POST JSON payload with Content-Type headercurl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name":"Ada"}'
Authenticated request using Bearer token headercurl -H "Authorization: Bearer <token>" https://api.example.com/secure
Basic HTTP Authenticationcurl -u username:password https://api.example.com
Specify Accept header for API response formatcurl -H "Accept: application/json" https://api.example.com

Files, Redirects & Debugging

Follow HTTP 301/302 redirects automaticallycurl -L https://example.com/redirect
Download remote file and save to local diskcurl -o filename.zip https://example.com/archive.zip
Upload file via multipart/form-datacurl -F "file=@/path/to/image.png" https://api.example.com/upload
Verbose mode showing TLS handshake, request and response headerscurl -v https://api.example.com
Silent mode but still show errors if connection failscurl -sS https://api.example.com

Frequently Asked Questions

β€’ Why does curl not follow redirects by default?

By default, curl only fetches the requested URL. You must provide the `-L` (or `--location`) flag to instruct curl to follow 3xx redirect headers to the target endpoint.