☰
Home
/
Cheatsheets
/
curl Cheatsheet
🌐
curl Cheatsheet
curl flags and patterns for HTTP requests, auth and file transfer
☆
Bookmark
Loading tool…
curl Cheatsheet
36 entries · click to copy
🌐 Basic Requests
curl https://example.com
GET request
curl -s https://example.com
Silent (no progress)
curl -o file.html https://example.com
Save response to file
curl -O https://example.com/file.zip
Save with original filename
curl -L https://example.com
Follow redirects
curl -I https://example.com
HEAD — fetch headers only
curl -v https://example.com
Verbose — show request + response headers
curl -w '%{http_code}' -o /dev/null https://example.com
Print only HTTP status code
📤 Request Methods & Data
curl -X POST https://api.example.com/users
POST request (empty body)
curl -X DELETE https://api.example.com/users/1
DELETE request
curl -X PUT -d '{"name":"Alice"}' https://api.example.com/users/1
PUT with body
curl -X PATCH -d '{"active":true}' https://api.example.com/users/1
PATCH with body
curl -d 'name=Alice&age=30' https://api.example.com/form
POST form data (application/x-www-form-urlencoded)
curl -F 'file=@photo.jpg' https://api.example.com/upload
Upload file (multipart/form-data)
curl -F 'file=@photo.jpg' -F 'caption=Hello' https://api.example.com/upload
Upload file with extra fields
📋 Headers
curl -H 'Content-Type: application/json' https://api.example.com
Set request header
curl -H 'Accept: application/json' -H 'X-API-Key: abc123' https://api.example.com
Multiple headers
curl -H 'Content-Type: application/json' -d '{"key":"val"}' https://api.example.com
POST JSON
curl -A 'MyApp/1.0' https://example.com
Custom user-agent
curl -e 'https://referrer.com' https://example.com
Set referer header
curl -D headers.txt https://example.com
Save response headers to file
🔐 Authentication
curl -u user:pass https://api.example.com
Basic auth
curl -H 'Authorization: Bearer TOKEN' https://api.example.com
Bearer token
curl -H 'Authorization: Basic BASE64' https://api.example.com
Base64 basic auth header
curl --digest -u user:pass https://api.example.com
Digest auth
curl --cert client.crt --key client.key https://api.example.com
Client certificate auth
curl -k https://self-signed.example.com
Skip SSL verification (insecure)
⚙️ Proxy & Advanced
curl -x http://proxy:8080 https://example.com
Use HTTP proxy
curl --socks5 127.0.0.1:1080 https://example.com
Use SOCKS5 proxy
curl --limit-rate 100k -O https://example.com/file.zip
Limit download speed
curl -C - -O https://example.com/file.zip
Resume interrupted download
curl --compressed https://example.com
Request gzip compression
curl --max-time 10 https://example.com
Timeout after 10 seconds
curl --retry 3 --retry-delay 2 https://example.com
Retry on failure
curl -b 'session=abc123' https://example.com
Send cookie
curl -c cookies.txt -b cookies.txt https://example.com
Save and send cookies