curl Cheatsheet
Quick reference for curl commands covering basic requests, headers, authentication, data posting, SSL/TLS, proxy, output, and debugging options
62 commands
curl {url}Fetch data from URL
curl https://example.comcurl -X GETSend GET request
curl -X GET https://api.example.com/userscurl -X POSTSend POST request
curl -X POST https://api.example.com/userscurl -X PUTSend PUT request
curl -X PUT https://api.example.com/users/1curl -X DELETESend DELETE request
curl -X DELETE https://api.example.com/users/1curl -X PATCHSend PATCH request
curl -X PATCH https://api.example.com/users/1curl -LFollow redirects
curl -L https://short.url/abccurl -IFetch headers only (HEAD)
curl -I https://example.comcurl --max-time {sec}Set maximum time for request
curl --max-time 10 https://example.comcurl --connect-timeout {sec}Set connection timeout
curl --connect-timeout 5 https://example.comcurl --retry {n}Retry on failure
curl --retry 3 https://example.comcurl -H "Header: Value"Send custom header
curl -H "Content-Type: application/json" https://api.example.comcurl -H "Accept: ..."Set Accept header
curl -H "Accept: application/json" https://api.example.comcurl -H "Authorization: Bearer ..."Bearer token authentication
curl -H "Authorization: Bearer eyJhbG..." https://api.example.comcurl -A "User-Agent"Set User-Agent
curl -A "Mozilla/5.0" https://example.comcurl -e "Referer"Set Referer header
curl -e "https://google.com" https://example.comcurl -b "cookies"Send cookies
curl -b "session=abc123" https://example.comcurl -c {file}Save response cookies to file
curl -c cookies.txt https://example.comcurl -b {file}Read cookies from file
curl -b cookies.txt https://example.comcurl -u user:passBasic authentication
curl -u admin:password https://api.example.comcurl --digest -u user:passDigest authentication
curl --digest -u admin:password https://api.example.comcurl --ntlm -u user:passNTLM authentication
curl --ntlm -u domain\\user:pass https://intranet.example.comcurl --negotiate -u :Negotiate (Kerberos) authentication
curl --negotiate -u : https://intranet.example.comcurl --oauth2-bearer {token}OAuth2 Bearer token
curl --oauth2-bearer eyJhbG... https://api.example.comcurl -nUse .netrc for credentials
curl -n https://api.example.comcurl -d "data"Send POST data
curl -d "name=John&age=30" https://api.example.com/userscurl -d @{file}Send POST data from file
curl -d @data.json https://api.example.com/userscurl --data-raw "data"Send data without @ processing
curl --data-raw '{"email":"user@test.com"}' https://api.example.comcurl --data-urlencode "data"URL-encode and send data
curl --data-urlencode "query=hello world" https://api.example.comcurl -F "file=@{path}"Upload file (multipart form)
curl -F "file=@photo.jpg" https://api.example.com/uploadcurl -F "key=value"Send multipart form data
curl -F "name=John" -F "file=@doc.pdf" https://api.example.comcurl -T {file}Upload file via PUT
curl -T upload.tar.gz https://example.com/files/curl --json '{...}'Send JSON data (auto Content-Type)
curl --json '{"name":"John"}' https://api.example.com/userscurl -kSkip SSL certificate verification
curl -k https://self-signed.example.comcurl --cacert {file}Specify CA certificate file
curl --cacert ca.pem https://example.comcurl --cert {file}Specify client certificate
curl --cert client.pem https://example.comcurl --key {file}Specify private key file
curl --key key.pem https://example.comcurl --tlsv1.2Use TLS 1.2
curl --tlsv1.2 https://example.comcurl --tlsv1.3Use TLS 1.3
curl --tlsv1.3 https://example.comcurl --ciphers {list}Specify cipher suites
curl --ciphers ECDHE-RSA-AES256-GCM-SHA384 https://example.comcurl -x {proxy}Use HTTP proxy
curl -x http://proxy:8080 https://example.comcurl --socks5 {proxy}Use SOCKS5 proxy
curl --socks5 localhost:1080 https://example.comcurl --socks5-hostname {proxy}SOCKS5 with DNS through proxy
curl --socks5-hostname localhost:1080 https://example.comcurl --noproxy "hosts"Specify hosts to bypass proxy
curl --noproxy "localhost,127.0.0.1" https://example.comcurl -U user:passProxy authentication
curl -x http://proxy:8080 -U user:pass https://example.comcurl -o {file}Save output to file
curl -o page.html https://example.comcurl -OSave with remote filename
curl -O https://example.com/file.tar.gzcurl -sSilent mode (hide progress)
curl -s https://api.example.com/datacurl -SShow errors in silent mode
curl -sS https://api.example.com/datacurl -# Show progress bar
curl -# -O https://example.com/largefile.zipcurl -C -Resume download automatically
curl -C - -O https://example.com/largefile.zipcurl --limit-rate {speed}Limit transfer rate
curl --limit-rate 1M -O https://example.com/file.zipcurl -vVerbose output (req/res headers)
curl -v https://example.comcurl -vvMore verbose debug output
curl -vv https://example.comcurl --trace {file}Write full trace to file
curl --trace trace.log https://example.comcurl --trace-ascii {file}Write ASCII trace to file
curl --trace-ascii trace.txt https://example.comcurl -w "format"Output response info in custom format
curl -w "\n%{http_code}\n" https://example.comcurl -w "%{time_total}"Show total time
curl -s -o /dev/null -w "%{time_total}" https://example.comcurl -w "%{size_download}"Show download size
curl -s -o /dev/null -w "%{size_download}" https://example.comcurl -w "%{speed_download}"Show download speed
curl -s -o /dev/null -w "%{speed_download}" https://example.comcurl --resolve host:port:ipOverride DNS resolution
curl --resolve example.com:443:1.2.3.4 https://example.comcurl -D {file}Save response headers to file
curl -D headers.txt https://example.com