Cheatsheet Pages / curl Cheatsheet

How to POST JSON with curl

You are creating something through an API and the body has to be JSON.

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

Good to know

-X sets the method, -H sets headers, -d sends the body — and -d already implies POST.

curl Cheatsheet one-page card — commands that actually work
The full one-page card — curl Cheatsheet. Get the complete cheatsheet on GitHub