← Cheat Sheets

curl Command Reference

Make HTTP requests from the terminal.

# curl Command Reference

Make HTTP requests from the terminal.

```bash
curl https://example.com                 # GET
curl -I https://example.com              # headers only
curl -L url                              # follow redirects
curl -o file.html url                    # save as file
curl -O url/file.zip                     # save with original name
curl -X POST -H "Content-Type: application/json" \
     -d '{"name":"Ann"}' https://api.example.com/users
curl -H "Authorization: Bearer TOKEN" url
curl -u user:password url                # basic auth
curl -F "file=@photo.png" url            # multipart upload
curl --data-urlencode "q=a b" url
curl -s url | head                       # silent
curl -v url                              # verbose (shows headers)
curl -w "%{http_code}\n" -o /dev/null -s url
```