curl

Transfer data to/from servers. Essential for testing APIs and debugging HTTP requests.

Synopsis

curl [options] [url]

Core Options

-X METHOD

HTTP method (GET, POST, PUT, DELETE).

-H 'Header: Value'

Add custom headers.

-d 'data'

Send data in request body.

-o file

Write output to file.

-I

Fetch response headers only.

-L

Follow redirects.

-u user:pass

Basic auth.

-sS -f

Silent, show errors, fail on HTTP errors.

Usage Examples

GET JSON

Fetch JSON API response.

curl -sS https://api.github.com

POST JSON

Send JSON payload.

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

Upload File

Send multipart form data.

curl -F 'file=@report.pdf' https://api.example.com/upload

Auth Request

Basic authentication.

curl -u user:pass https://api.example.com/secure

Download with Redirects

Follow 3xx redirects and save file.

curl -L -o app.tar.gz https://example.com/app.tar.gz
Built for builders.