Common Commands

Published 2026-06-01Updated 2026-07-16

Common curl Commands

Common curl commands for HTTP requests, JSON APIs, headers, downloads, and debugging.

curl Cheatsheet

Basic Request

Send a GET request
curl https://example.com

Useful flags:

  • -i: show response headers.
  • -L: follow redirects.
  • -v: print verbose connection details for TLS, proxy, and header debugging.

Send JSON

Scenario

Call a JSON API

Set Content-Type and pass a request body with -d. curl switches to POST when -d is used.

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Oceanz"}'

Add Headers

curl https://api.example.com/me \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json"

Download a File

curl -L -o output.zip https://example.com/file.zip
  • -o output.zip: choose the local file name.
  • -O: use the remote file name.
  • -C -: resume an interrupted download.