cURL generator Fill in a request, get a cURL command — for bash, cmd or PowerShell.
Fill in a request, get a cURL command — for bash, cmd or PowerShell.QUERY
HEADERS
AUTH
BODY
Valid JSON
OPTIONS
bash · zsh · macOS · Linux
curl https://api.example.com/v1/customers \
-H "Authorization: Bearer $API_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"email":"ada@example.com","name":"Ada Lovelace","metadata":{"plan":"pro"}}' \
-L \
-m 307 linesSet them first: export API_TOKEN=…
The flags you'll use most
What the generator writes, and why.
- -X POSTSets the method. Left out for GET, and for POST when there's a body, because curl picks those itself.
- -H 'Name: value'Adds a header. One -H per header; repeat it as many times as you need.
- -d / -F-d sends a body (JSON or form fields). -F sends multipart, and @path uploads a file.
- -u · -L · -m-u user:pass for basic auth, -L to follow redirects, -m 30 to give up after 30 seconds.
Questions
The short answers.
Why does PowerShell use curl.exe?
In Windows PowerShell, curl is an alias for Invoke-WebRequest, which takes different options. curl.exe runs the real curl.
Why are some values in double quotes?
With “Secrets as env variables” on, tokens become $API_TOKEN (or %API_TOKEN%, $env:API_TOKEN). Shells only expand variables inside double quotes.
-d or --json?
--json is shorter but needs curl 7.82 or newer. -d with a Content-Type header works everywhere, so that's what we write.
Can I start from an existing command?
Yes. Use “Import a cURL command” at the top of the form, then edit any field.
Is the output safe to paste into my shell?
Yes. Values are quoted for the shell you pick: single quotes in bash, curl.exe's double-quote rules in cmd, and '…' in PowerShell. Spaces, quotes and $ signs reach curl unchanged.