Console9

curl flags and options reference

Complete reference for curl command-line flags including request methods, headers, authentication, and TLS options.

curl flags and options reference

Complete reference for curl command-line flags including request methods, headers, authentication, and TLS options.

curl Request Flags

FlagDescriptionExample
-X METHODSet the HTTP request method (GET, POST, PUT, DELETE, PATCH).curl -X POST https://api.example.com/data
-d DATASend data in a POST request body. Sets Content-Type to application/x-www-form-urlencoded.curl -d "key=value" https://api.example.com/data
--json DATASend JSON data. Automatically sets Content-Type and Accept headers. Requires curl 7.82+.curl --json '{"key":"value"}' https://api.example.com
-F FIELD=VALUESend multipart form data. Use @ prefix to upload files.curl -F "file=@report.pdf" https://api.example.com/upload
-T FILEUpload a file via PUT request.curl -T file.txt https://api.example.com/files/

curl Output Flags

FlagDescriptionExample
-o FILESave response body to a file.curl -o output.html https://example.com
-OSave using the remote filename.curl -O https://example.com/file.tar.gz
-iInclude response headers in the output.curl -i https://example.com
-IFetch response headers only (HEAD request).curl -I https://example.com
-sSilent mode — suppress progress meter and error messages.curl -s https://example.com
-vVerbose mode — show request/response headers, TLS handshake.curl -v https://example.com
-w FORMATWrite output using a format string after the transfer.curl -o /dev/null -s -w "%{http_code}" https://example.com
-C -Resume a previous download.curl -C - -O https://example.com/large.iso

curl Header and Authentication Flags

FlagDescriptionExample
-H HEADERAdd a custom HTTP header.curl -H "Authorization: Bearer TOKEN" https://api.example.com
-u USER:PASSHTTP basic authentication.curl -u admin:secret https://api.example.com
-b COOKIESSend cookies (from a string or file).curl -b "session=abc123" https://example.com
-c FILESave received cookies to a file.curl -c cookies.txt https://example.com
-LFollow HTTP redirects (301, 302, 307, 308).curl -L https://example.com/old-url
--max-redirs NLimit the number of redirects to follow.curl -L --max-redirs 3 https://example.com

curl TLS/SSL Flags

FlagDescriptionExample
-k/ --insecureSkip SSL certificate verification. For debugging only.curl -k https://self-signed.example.com
--cacert FILEUse a specific CA certificate bundle.curl --cacert /path/to/ca.crt https://internal.example.com
--cert FILEClient certificate for mutual TLS.curl --cert client.crt --key client.key https://api.example.com
--tlsv1.2Force minimum TLS version 1.2.curl --tlsv1.2 https://example.com
--tlsv1.3Force TLS version 1.3.curl --tlsv1.3 https://example.com

curl Connection Flags

FlagDescriptionExample
--connect-timeout SECSMaximum time for the TCP connection to establish.curl --connect-timeout 10 https://example.com
--max-time SECSMaximum total time for the entire operation.curl --max-time 60 https://example.com
-x PROXYUse an HTTP or SOCKS proxy.curl -x http://proxy:8080 https://example.com
--retry NRetry failed requests N times.curl --retry 3 https://example.com