Basic Requests
GET Request
curl https://api.example.com/usersPOST Request with JSON
curl -X POST https://api.example.com/users \
-H "Content-Type: application/json" \
-d '{"name": "John", "email": "john@example.com"}'PUT Request
curl -X PUT https://api.example.com/users/1 \
-H "Content-Type: application/json" \
-d '{"name": "John Updated"}'DELETE Request
curl -X DELETE https://api.example.com/users/1Headers
Custom Headers
curl https://api.example.com/data \
-H "Authorization: Bearer your_token" \
-H "Accept: application/json" \
-H "X-Custom-Header: value"Authentication
Bearer Token
curl https://api.example.com/protected \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."Basic Auth
curl -u username:password https://api.example.com/secureAPI Key
curl https://api.example.com/data?api_key=your_keycurl https://api.example.com/data \
-H "X-API-Key: your_key"Data Handling
Form Data
curl -X POST https://api.example.com/upload \
-F "file=@/path/to/file.pdf" \
-F "name=document"URL-Encoded Data
curl -X POST https://api.example.com/login \
--data-urlencode "email=user@example.com" \
--data-urlencode "password=secret"Read Data from File
curl -X POST https://api.example.com/data \
-H "Content-Type: application/json" \
-d @payload.jsonUseful Options
Verbose Output
curl -v https://api.example.com/dataFollow Redirects
curl -L https://example.com/redirectSave Response to File
curl -o output.json https://api.example.com/dataSilent Mode
curl -s https://api.example.com/dataShow Only Headers
curl -I https://api.example.com/dataTimeout
curl --connect-timeout 5 --max-time 10 https://api.example.com/dataSSL/TLS
Ignore SSL Errors (Development Only)
curl -k https://self-signed.example.comSpecify Certificate
curl --cacert /path/to/cert.pem https://api.example.comConvert CURL to Code
Need to use these commands in your application? Convert them to your programming language: