Skip to content

curl Command Builder

Build a request, or paste one to edit it, then copy it as curl, fetch or Python.

Free · No signupNothing is sent from this page

Query parameters 1 in the URL
curl 'https://api.example.com/v1/users?page=1' \
  -H 'Accept: application/json'

Getting the builder ready…

Describe it instead of memorising flags

Ask CtrlOps’ AI Terminal for the command.

It explains each command before you approve it, inside the SSH workspace where you run it.

Explore the AI TerminalDownload for MacDownload for Windows

Keep it handy

The flags
you will use most.

A curl command is curl [options] URL. These options cover most API calls, health checks and scripts.

Common curl flags and what they do
FlagWhat it does
-X, --requestSet the method. curl picks POST by itself when you send data.
-H, --headerAdd a header. Repeat it for each one.
--data-rawSend the body exactly as written. Safe for JSON.
-d, --dataSend a body; a value starting with @ reads a file.
--data-urlencodeSend a form field, URL-encoding the value for you.
-F, --formSend multipart form data; @path uploads a file.
-u, --userHTTP Basic auth as user:password.
-L, --locationFollow redirects.
-f, --failExit with an error on HTTP 400 and above. Use it in scripts.
-sSHide the progress bar but still show errors.
-i, --includePrint the response headers too.
-v, --verboseShow the full request and response for debugging.
-o, --outputSave the response to a file.
-k, --insecureSkip TLS certificate checks. Test servers only.
--max-timeGive up after this many seconds in total.

Getting it right

Small flags.
Big differences.

Let curl choose the method

curl sends GET by default and POST when you send data. Add -X only for PUT, PATCH, DELETE and the like. -X POST next to -L also forces POST after a redirect, which is rarely what you want.

Send the body you mean

Use --data-raw for JSON so a leading @ is never read as a file name, and set Content-Type: application/json; plain -d labels the body as a form. --data-urlencode encodes form values for you, and -F uploads files as multipart.

Keep secrets out of history

A token typed into a command ends up in ~/.bash_history. Export it first and reference it in double quotes, as in -H "Authorization: Bearer ${API_TOKEN}". The builder can write every output this way.

Make scripts fail loudly

By default curl exits successfully even on a 500. -f turns HTTP errors into a non-zero exit, -sS keeps logs clean but shows errors, and --max-time stops a request from hanging a cron job or deploy.

Read the curl manual

Common questions

curl,
explained.

How do I send a POST request with a JSON body in curl?

Use -X POST, add -H "Content-Type: application/json", and send the payload with --data-raw '{"key":"value"}'. In this builder, choose POST, pick the JSON body type, and paste your JSON - the Content-Type header is added automatically.

How do I add a bearer token or auth header to curl?

Add -H "Authorization: Bearer YOUR_TOKEN" for a bearer token, or -u user:password for HTTP Basic auth. Set the Authentication section to Bearer, Basic, or API key and the correct header/flag is generated.

How do I make curl follow redirects?

Add the -L (or --location) flag, which tells curl to follow HTTP 3xx redirects to the final URL. Enable "Follow redirects" in the options.

How do I make curl ignore SSL certificate errors?

Add -k (or --insecure) to skip TLS verification. This is fine for testing against a self-signed certificate locally, but never do it in production because it defeats the security of HTTPS.

How do I upload a file with curl?

Use multipart form data: -F "file=@/path/to/file". The @ tells curl to read and upload the file. In this builder, choose the Multipart body type and set a field to "file" with the path.

How do I convert a curl command to Python or JavaScript?

Build or paste your curl command here, then switch the output tab to Python (requests) or fetch (JavaScript) to get the equivalent code. You can also paste an existing curl command into the import box to load it into the builder first.

Keep exploring

Tools and guides for your next step.

Your privacy preferences. We use product analytics to improve CtrlOps. Google measurement runs without analytics cookies. Live chat stays off until you allow it. Cookie policy