cURL Cheatsheet

A quick reference for common cURL commands and flags.

Authentication

Command Description
curl -u [user:password] [url] Send a request with Basic Authentication.
curl -H "Authorization: Bearer [token]" [url] Send a request with a Bearer Token.

Basic Usage

Command Description
curl [url] Make a simple GET request to the specified URL.
curl -o [filename] [url] Download a file and save it with the given filename.
curl -O [url] Download a file and save it with its original filename.

HTTP Methods

Command Description
curl -X POST [url] Make a POST request.
curl -X PUT [url] Make a PUT request.
curl -X DELETE [url] Make a DELETE request.

Headers & Data

Command Description
curl -H "Content-Type: application/json" [url] Send a request with a custom HTTP header.
curl -d "param1=value1&param2=value2" [url] Send data in a POST request (form-urlencoded).
curl -d @data.json -H "Content-Type: application/json" [url] Send data from a file (e.g., JSON).

Other Useful Flags

Command Description
curl -i [url] Include the HTTP response headers in the output.
curl -L [url] Follow any redirects.
curl -v [url] Verbose output, useful for debugging.

© 2025 devcortex.ai ・ AI-powered developer tools.