How to use the curl Command Builder
- Enter the method and URL, then add query parameters and headers.
- Choose the body: JSON, a urlencoded form, multipart fields and files, or raw text.
- Add Basic or bearer authentication and the options you need, such as redirects and timeouts.
- Pick your shell and copy the command, or paste an existing curl command first to edit it.
How to build a curl command
A curl command is the program name, the options, and the URL: curl -X POST -H 'Content-Type: application/json' --data-raw '{"name":"Ada"}' https://api.example.com/users sends a POST with a JSON body. The hard part is not the options but the quoting, because the shell reads the command before curl does, and bash, PowerShell and cmd each treat quotes, $, % and & differently.
This builder first works out the exact arguments curl must receive, then quotes them for the shell you choose, so a value containing an apostrophe, a dollar sign or a line break arrives unchanged. The bash, Windows PowerShell 5.1 and cmd output is tested by running it against a local server and checking that the method, headers, query and body arrive byte for byte.
The options it writes
| Form setting | curl option |
|---|---|
| Method | -X PUT; left out where curl infers GET or POST; -I for HEAD |
| Query parameters | Percent-encoded and added to the URL |
| Header | -H 'Name: value'; an empty value is written -H 'Name;' |
| JSON body | -H 'Content-Type: application/json' --data-raw '...' |
| Form body | --data-urlencode 'name=value' for each field |
| Multipart | --form-string 'name=value', and -F 'file=@path;type=...' for files |
| Basic auth | -u 'user:password' |
| Bearer token | -H 'Authorization: Bearer ...' |
| Redirects, timeouts, retries | -L, --connect-timeout, --max-time, --retry |
| Output | -o file, -i, -v, -sS, --fail, --compressed |
| HTTP version, proxy, TLS | --http1.1, --http2, --http3, -x, -k |
Some choices avoid curl's own surprises. --data-raw is used instead of -d, because -d @file reads a file and a body that starts with @ would do the same. --form-string is used for text fields because -F treats @, < and ;type= in the value specially. A URL containing [ or { gets -g, since curl otherwise reads them as a range pattern.
Quoting in each shell
- bash and zsh: everything goes in single quotes, where nothing is special; a single quote inside is written
'\''. - PowerShell 7.3 and later: single quotes with
''for a quote. The program iscurl.exe, because in Windows PowerShellcurlis an alias forInvoke-WebRequest. - Windows PowerShell 5.1: it passes quotes inside arguments to native programs without escaping them, so they are escaped for it:
\", or""inside a quoted value. Use the 7.3 tab in PowerShell 7. - cmd: values go in double quotes; a value with
"or%has every special character escaped with^so%PATH%is not expanded. cmd cannot pass a line break inside an argument, so a multi-line body is read from a file.
Worked examples
# JSON API call with a token, following redirects and failing on HTTP errors
curl -H 'Authorization: Bearer YOUR_TOKEN' -H 'Content-Type: application/json' \
--data-raw '{"app":"storefront","branch":"main"}' -L --fail https://api.example.com/v1/deployments
# Upload a file with a description
curl --form-string 'description=Nightly build' -F 'file=@./build.log;type=text/plain' https://api.example.com/upload
# Check that a site answers, headers only
curl -I https://example.comCommon errors
- curl: (3) URL rejected: Bad hostname: an argument split at a space, so part of a header or body was read as a URL. The quoting was wrong for the shell; copy the command for the shell you are in.
- 415 Unsupported Media Type: the JSON body went without
Content-Type: application/json;-dalone sendsapplication/x-www-form-urlencoded. - SSL certificate problem: fix the certificate rather than adding
-k, which turns off the check for everything, including whoever is in the middle. - In PowerShell, "A parameter cannot be found that matches parameter name 'X'":
curlranInvoke-WebRequest. Typecurl.exe.
Checking a deploy with curl
Shipown checks the process and the port after each deploy, and says plainly that a running process is not proof the public URL works (build output and deployment status). curl -I https://your-domain from your own machine is that proof: the status line, the redirect to HTTPS and the security headers in one request.
Frequently asked questions
How do I send JSON with curl?
Add the header Content-Type: application/json and pass the body with --data-raw, for example curl -H 'Content-Type: application/json' --data-raw '{"a":1}' https://api.example.com. Without the header, curl labels the body as a form.
Why does curl not work the same in PowerShell?
In Windows PowerShell, curl is an alias for Invoke-WebRequest, which has different options. Type curl.exe to run the real curl, and use PowerShell quoting.
How do I send a bearer token with curl?
Add the header Authorization: Bearer followed by the token, as in -H 'Authorization: Bearer abc123'. curl's --oauth2-bearer option does the same.
What is the difference between -d, --data-raw and --data-binary?
All three send a request body. -d and --data-binary read a file when the value starts with @, and -d strips line breaks from such a file; --data-raw never treats @ specially.
Can I paste a curl command to edit it?
Yes. Paste a command from documentation or a browser's Copy as cURL (bash or cmd) and the form is filled in; options it does not support are listed.
Does this page send my request or my token anywhere?
No. It only writes the command. Nothing is requested and nothing you type leaves your browser.