Skip to content
ToolZone

Curl Command Builder

Build a curl command visually by setting the method, URL, headers, and body, then copy the ready-to-run command for your terminal.

Runs in your browser. Nothing you enter or upload leaves your device.

Headers

Generated code

curl \
  -H 'Accept: application/json' \
  'https://api.example.com/users'

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the Curl Command Builder

The Curl Command Builder turns a simple form into a ready-to-run curl command, or the same request as JavaScript fetch or Python requests code. Fill in the method, URL, headers, and body, and it handles the flags and quoting so you can paste the result straight into a terminal, a README, or a bug report.

How it works

The command starts with curl. For any method other than GET, it adds -X followed by the method, since GET is curl's default. If verbose is ticked, -v comes next. Each header row with a name becomes -H 'Name: value'; empty header rows are skipped. For non-GET methods, a non-empty body is added with -d.

Every header, the body, and the URL are wrapped in single quotes, and any single quote inside them is escaped as '\'' so that the shell passes the text through unchanged. The parts are joined with a backslash and a new line, which shells such as bash and zsh read as one continuous command.

How to use

  1. 1

    Choose the Method and enter the URL of the endpoint.

  2. 2

    Edit the Headers, or click a preset such as Content-Type or Authorization to add it.

  3. 3

    For POST, PUT, PATCH, DELETE or OPTIONS, paste the request body; a JSON body is checked when Content-Type is JSON.

  4. 4

    Tick the flags you need (follow redirects, show headers, silent, compressed, verbose), pick curl, fetch or Python, and click Copy code.

Worked examples

Default GET request

Fetching a list of users.

Input
GET https://api.example.com/users, header Content-Type: application/json
Result
curl \ -H 'Content-Type: application/json' \ 'https://api.example.com/users'

POST with a JSON body and auth header

Creating a user with a bearer token.

Input
POST https://api.example.com/users Headers: Content-Type: application/json, Authorization: Bearer TOKEN Body: {"name": "Jane Doe"}
Result
curl \ -X POST \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer TOKEN' \ -d '{"name": "Jane Doe"}' \ 'https://api.example.com/users'

DELETE with verbose output

Debugging a delete endpoint.

Input
DELETE https://api.example.com/users/42, verbose on, no headers
Result
curl \ -X DELETE \ -v \ 'https://api.example.com/users/42'
Limitations
The Body box is hidden for GET and HEAD requests, and a body entered earlier is not included then. File uploads and multipart form fields (-F) are not supported. The quoting targets Unix-like shells; Windows Command Prompt needs manual changes.
Assumptions
The command will run in bash, zsh, or a compatible shell. The body is sent as-is with -d; set the Content-Type header to match its format.
Privacy
The command is built in your browser and no request is sent; headers, tokens, and body text are not stored.

Frequently asked questions

Why does the -X flag disappear for GET requests?+

curl uses GET by default, so -X GET is unnecessary and is left out to keep the command clean.

Is my API key or token safe to paste into this tool?+

The command is generated in your browser and is not sent anywhere. It is still good practice to use placeholder values when a command will be shared or saved.

Does this tool send the request?+

No. It only builds the command text. Run the copied command in your own terminal to make the request.

How are quotes in my JSON body handled?+

The body is wrapped in single quotes, so double quotes inside JSON need no escaping. Any single quotes are escaped automatically for the shell.

Why are there backslashes at the end of each line?+

A trailing backslash tells the shell the command continues on the next line. It keeps long commands readable, and you can paste the whole block at once.

Related tools