curl Cheatsheet
HTTP client commands for API debugging and automation: methods, JSON payloads, headers, auth, multipart uploads, cookies, retries, and TLS diagnostics on curl 8.x.
How it works
curl transfers URL data from the shell: set method (-X), headers (-H), body (-d/-F), and output (-v/-i/-w) explicitly, because curl prints only the response body by default.
Survival kit
The few commands to learn first.
42 commands
Requests & Methods
Send GET, HEAD, POST, PUT, PATCH, and DELETE requests with clean headers.
- Essential
Fetch a URL and print the response body to stdout
curl <url>Build the command
curl <url>Values are inserted exactly as typed. Quote them yourself if they contain spaces or special characters.
When to use it
Baseline check for reachability, response payload, and pipe integration with jq.
Example
curl https://api.example.com/healthResult
{"status":"ok","version":"2.4.0"}
Payloads, Forms & Files
Send JSON, URL-encoded forms, multipart uploads, and binary bodies.
Auth, Cookies & TLS
Authenticate requests, manage cookies, resolve hosts, and verify certificates.
Headers, Timing & Debugging
Inspect TLS handshakes, response headers, status codes, and per-phase latency.
Downloads, Retries & Limits
Write files safely, resume interrupted downloads, cap wait time, and retry.