Curl Command Generator
Build cURL commands for REST APIs with headers, authentication, and request bodies.
- Free
- No account
- Runs in your browser
- Nothing uploaded
Runs entirely in your browser — your input is never uploaded, logged, or stored.Privacy policy
What is Curl Command Generator?
cURL is the standard command-line tool for making HTTP requests. Developers use it to test APIs, debug webhooks, reproduce browser requests, and automate data transfers. But crafting curl commands by hand — especially with headers, authentication tokens, JSON bodies, and query parameters — is tedious and error-prone.
This generator builds complete, copy-paste-ready curl commands from your inputs. Fill in the URL, pick a method, add headers and body, and the command appears instantly. Every value is wrapped in single quotes, and an apostrophe inside one is rewritten as `'\''` — the escape that catches people out, because a JSON body mentioning O'Brien otherwise closes the quote early and hands the shell a command it reads as something else entirely. Query parameter values are URL-encoded, and the finished command is broken across lines with backslash continuations so a request with six headers is still readable in a terminal or a script.
It is for developers and DevOps engineers who work with REST APIs: testing endpoints, debugging failing requests, documenting API calls, or generating commands for CI/CD scripts. Nothing you type leaves the page — the command is assembled in your browser, which matters when the header you are pasting is a production bearer token. If you need to send the request and read the response, use something like Postman or httpie; this tool writes the command, and you run it yourself.
The generator builds a curl command string from structured inputs:
1. **Method**: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS — passed as `-X {METHOD}` 2. **URL**: The target endpoint, used as-is (query parameters are appended separately) 3. **Headers**: Each header becomes `-H 'Name: Value'`, one per line 4. **Body**: Passed as `-d '{body}'` for POST/PUT/PATCH, with single quotes escaped as `'\''` 5. **Auth**: Basic auth becomes `-u user:pass`, Bearer token becomes `-H 'Authorization: Bearer {token}'` 6. **Query parameters**: Appended to the URL as `?key=value&key2=value2`
The output is a single shell-safe command you can paste into any terminal.
Worked examples
- GET request to https://api.example.com/users → curl 'https://api.example.com/users'
- POST with JSON body → curl -X POST 'https://api.example.com/users' -H 'Content-Type: application/json' -d '{"name": "John"}'
- GET with Bearer token → curl 'https://api.example.com/users' -H 'Authorization: Bearer tok_abc123'
- POST with Basic auth → curl -X POST 'https://api.example.com/users' -u 'user:pass' -d 'name=John'
How to use Curl Command Generator
- Enter the API endpoint URL (e.g., https://api.example.com/users).
- Select the HTTP method (GET, POST, PUT, PATCH, DELETE).
- Add headers if needed (Content-Type, Accept, custom headers).
- For POST/PUT/PATCH, paste a JSON body or raw text.
- Choose authentication type and enter credentials if required.
- Copy the generated command from the output pane.
Common errors
- Command doesn't work in Windows CMD — CMD uses double quotes for strings. The generator produces POSIX-style single quotes; use Git Bash or WSL on Windows.
- JSON body shows up as empty — make sure you selected POST, PUT, or PATCH. GET requests don't include a body.
- Headers are duplicated — the generator adds Content-Type automatically when you paste a JSON body. Remove it from the headers list if you added it manually.
- Special characters break the command — the generator escapes single quotes in the body. If you're adding raw curl flags, you'll need to escape them yourself.
FAQ
How do I generate a curl command for a POST request with JSON?
Select POST from the method dropdown, paste your JSON in the body field, and make sure Content-Type is set to application/json (it's added automatically). The generated command will include -d with your JSON payload.
Does this tool send my API credentials anywhere?
No. The command is generated entirely in your browser. Nothing you enter — URLs, tokens, API keys, or body content — is transmitted, logged, or stored.
Can I generate curl commands with query parameters?
Yes. Add them directly to the URL (e.g., https://api.example.com/users?page=1&limit=10) or use the query parameters section to add them individually. Both approaches produce the same curl command.
Why are single quotes used in the generated command?
Single quotes are the POSIX standard for shell strings. They prevent variable expansion and special character interpretation. On Windows CMD, use Git Bash or WSL where single quotes work correctly.
Can I add cookies to the generated command?
Yes. Add a Cookie header with your cookie string, e.g., -H 'Cookie: session=abc123; user=john'. For complex cookie scenarios, consider using a cookies file with curl's -b flag.
Related tools
Prefer AllUtil on Google
One click adds AllUtil to your Google preferences. You'll see our tools highlighted with a Preferred badge in Search and AI answers.