cURL Commands Cheat Sheet — HTTP Requests, Headers & Flags

High-frequency cURL commands for testing REST APIs, sending JSON payloads, inspecting response headers, and downloading files.

Sending Requests & Payloads

curl -i https://api.example.com/users

Send standard GET request and display HTTP response headers + body

curl -X POST https://api.com/users -H "Content-Type: application/json" -d '{"name":"Alice"}'

Send POST request with raw JSON body payload

curl -H "Authorization: Bearer <TOKEN>" https://api.com/profile

Send Bearer JWT authentication header

curl -u username:password https://api.example.com

Send HTTP Basic Authentication credentials

Downloads & Advanced Flags

curl -O -L https://example.com/download.zip

Download file using remote filename and follow 301/302 redirects (-L)

curl -s -o /dev/null -w "%{http_code}" https://example.com

Quietly query URL and print ONLY the HTTP status code number

curl -k https://localhost:8443

Allow self-signed or invalid SSL certificates (insecure development)