⌘ CheatSheet
← Library

🌐curl

API wrangling from the terminal.

CLI Tools · 2 sections

Edit

Basics

GET with headers shown
bash
curl -v https://api.example.com/users/1
POST JSON
bash
curl -X POST https://api.example.com/users \
  -H 'Content-Type: application/json' \
  -d '{"name": "ada"}'
Bearer auth
bash
curl -H 'Authorization: Bearer $TOKEN' https://api.example.com/me

Debugging

Timing breakdown
bash
curl -o /dev/null -s -w 'dns:%{time_namelookup} connect:%{time_connect} total:%{time_total}\n' https://example.com
Follow redirects + fail on HTTP errors-f makes 4xx/5xx exit non-zero
bash
curl -sSfL https://example.com
Only response headers
bash
curl -sI https://example.com