curl Cheatsheet Online | Common curl Commands for APIs and Debugging

curl Cheatsheet

Practical curl commands for APIs, headers, auth, redirects, debugging, and download workflows.

20/20 commands
TerminalBackend / DevOps

This curl cheatsheet focuses on the commands developers actually use to test APIs, inspect headers, debug redirect chains, and automate HTTP requests from the terminal.

Basics and Quick Checks

GET a page
curl https://example.com
Only response headers
curl -I https://example.com
Include headers with body
curl -i https://example.com
Verbose request details
curl -v https://example.com

Methods, JSON, and Forms

POST JSON
curl -X POST https://api.example.com/items -H "Content-Type: application/json" -d '{"name":"demo"}'
PUT JSON
curl -X PUT https://api.example.com/items/42 -H "Content-Type: application/json" -d '{"name":"updated"}'
Send form data
curl -X POST https://example.com/form -d "name=demo&role=admin"
Upload a file
curl -F "file=@report.pdf" https://example.com/upload

Headers and Authentication

Add custom header
curl -H "X-Trace-Id: 123" https://api.example.com
Bearer token auth
curl -H "Authorization: Bearer <token>" https://api.example.com/me
Basic auth
curl -u username:password https://api.example.com
Send JSON accept header
curl -H "Accept: application/json" https://api.example.com/items

Redirects and Debugging

Show first redirect response
curl -I https://example.com/old-path
Follow redirect chain
curl -IL https://example.com/old-path
Follow redirects with body
curl -L https://example.com/download
Show timing summary
curl -s -o /dev/null -w "code=%{http_code} total=%{time_total}\n" https://example.com

Output and Automation

Save response to file
curl -o response.json https://api.example.com/items
Resume a download
curl -C - -O https://example.com/archive.zip
Silent mode with errors
curl -sS https://api.example.com/health
Fail on HTTP errors in scripts
curl -f https://api.example.com/health

What Is curl Cheatsheet?

This curl cheatsheet focuses on the commands developers actually use to test APIs, inspect headers, debug redirect chains, and automate HTTP requests from the terminal.

Daily curl commands for APIs and web debugging

Header, auth, JSON body, and file upload examples

Redirect, verbose, and response-inspection patterns

Key Features of curl Cheatsheet

Daily curl commands for APIs and web debugging

Header, auth, JSON body, and file upload examples

Redirect, verbose, and response-inspection patterns

How to Use curl Cheatsheet

Step 1

Start with simple GET or HEAD commands to confirm the endpoint

Step 2

Add headers, auth, and request bodies as the API requires

Step 3

Use verbose, include-header, and redirect-follow commands when debugging responses

Frequently Asked Questions

How do I check redirects with curl?

Use curl -I for a quick header check, or curl -IL <url> to follow the full redirect chain and inspect each response.

When should I use -i, -I, or -v?

-i includes response headers in the output, -I fetches only headers, and -v adds verbose request and connection details for debugging.

Still need help?

Need a hand with curl Cheatsheet? Reach out through support or send a feature request with your workflow.

Contact support