DD
DevDash

Last updated: April 12, 2026

curl Commands Cheatsheet

Quick Answer

curl is the universal command-line tool for making HTTP requests. Use -X for method, -H for headers, -d for body data, -o to save output, and -v for verbose debugging. This covers the 20 most useful flags.

Basic

CommandDescription
curl <url>

Make a GET request and print response to stdout

curl https://api.example.com/users
curl -o <file> <url>

Save response to a file

curl -o data.json https://api.example.com/data
curl -O <url>

Save with the remote filename

curl -s <url>

Silent mode — suppress progress meter

curl -v <url>

Verbose — show request/response headers

Methods

CommandDescription
curl -X POST <url>

Specify HTTP method (POST, PUT, DELETE, PATCH)

curl -X POST https://api.example.com/users
curl -X PUT <url>

Make a PUT request

curl -X DELETE <url>

Make a DELETE request

Headers

CommandDescription
curl -H "Header: value" <url>

Set a custom header

curl -H "Authorization: Bearer token123" <url>
curl -H "Content-Type: application/json"

Set JSON content type

Data

CommandDescription
curl -d '{"key":"val"}' <url>

Send data in request body (POST by default)

curl -d '{"name":"Alice"}' -H 'Content-Type: application/json' <url>
curl --data-raw <data> <url>

Send raw data without interpretation

curl -F "file=@path" <url>

Upload a file as multipart form data

curl -F "avatar=@photo.jpg" https://api.example.com/upload
curl -d "key=val&key2=val2" <url>

Send form-urlencoded data

Auth

CommandDescription
curl -u user:pass <url>

Basic authentication

curl -u admin:secret https://api.example.com/admin

Options

CommandDescription
curl -L <url>

Follow redirects (3xx responses)

curl -k <url>

Allow insecure SSL connections (skip cert verification)

curl --connect-timeout 5 <url>

Set connection timeout in seconds

curl -w "%{http_code}" <url>

Output specific variables (status code, time, etc.)

curl -s -o /dev/null -w "%{http_code}" <url>
curl -I <url>

Fetch headers only (HEAD request)

curl -I https://example.com

Frequently Asked Questions

More Cheatsheets

Want API access + no ads? Pro coming soon.