Skip to main content
Ganesh Joshi
Back to Cheatsheets

curl commands

Updated 2026-02-15

curl flags for HTTP requests: GET, POST, headers, auth, and file upload. Debug APIs from the terminal.

Basic requests

  • curl https://api.example.com

    GET request.

  • curl -X POST -d '{"a":1}' -H 'Content-Type: application/json' URL

    POST JSON.

  • curl -X PUT -d @file.json URL

    PUT with file body.

  • curl -X DELETE URL

    DELETE request.

Headers and auth

  • curl -H 'Header: value' URL

    Add header.

  • curl -u user:pass URL

    Basic auth.

  • curl -H 'Authorization: Bearer TOKEN' URL

    Bearer token.

  • curl -v URL

    Verbose output.

  • curl -i URL

    Include response headers.

Files and redirect

  • curl -o file URL

    Save to file.

  • curl -L URL

    Follow redirects.

  • curl -F 'file=@path' URL

    Multipart form upload.

curl commands | Cheatsheet | Ganesh Joshi