2026-09-09

cURL Flags Cheat Sheet

The cURL flags that come up in day-to-day API work, with a minimal example for each. If you've got a cURL command copied out of a network tab or API doc and need it as real code instead, the cURL Converter turns it into JavaScript or Python directly.

Common flags

Flag Meaning Example
-X Set the HTTP method (GET is the default if omitted) curl -X POST https://api.example.com/users
-H Add a request header (repeatable) curl -H "Content-Type: application/json" https://api.example.com
-d, --data Send data in the request body (implies POST unless -X overrides it) curl -d '{"name":"Ada"}' https://api.example.com/users
-F Send multipart/form-data (for file uploads or form fields) curl -F "file=@photo.jpg" https://api.example.com/upload
-u Send HTTP Basic Auth credentials curl -u username:password https://api.example.com
-L Follow redirects (cURL doesn't follow them by default) curl -L https://example.com/old-path
-o Write the response to a named file curl -o result.json https://api.example.com/data
-O Write the response to a file, using the remote filename curl -O https://example.com/report.pdf
-I Fetch headers only (HEAD request), no body curl -I https://example.com
-v Verbose output - show the full request/response exchange curl -v https://api.example.com
-s Silent mode - suppress the progress meter and error messages curl -s https://api.example.com
-k Skip TLS certificate verification (insecure - only for local/dev use) curl -k https://self-signed.local

A combined example

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer TOKEN" \
  -d '{"name": "Ada", "role": "admin"}'

This sends a POST request with a JSON body and two headers - the most common shape for a "create a resource" API call. Paste a command like this into the cURL Converter to get an equivalent fetch or requests snippet instantly.

Try cURL Converter · More cheat sheets · All tools