Tools / curl converter
curl converter
Paste a curl command from API docs or your browser’s “Copy as cURL”. Get the same request as JavaScript fetch or Python requests.
Example
curl -X POST https://api.example.com/v1/orders -H "Content-Type: application/json" -d '{"item": "book", "quantity": 2}'As JavaScript fetch:
const res = await fetch('https://api.example.com/v1/orders', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
"item": "book",
"quantity": 2
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();Supported curl options
| Option | Becomes |
|---|---|
-X, --request | the HTTP method |
-H, --header | headers |
-d, --data, --data-raw, --data-binary | the request body (POST by default) |
--data-urlencode | URL-encoded form fields |
--json | a JSON body with Content-Type and Accept set |
-F, --form | multipart form data (@file for uploads) |
-u, --user | basic authentication |
-G, --get | puts -d data in the query string |
-A, -b, -e | User-Agent, Cookie and Referer headers |
Flags that don’t change the request — -s, -S, -L, -k, -v, -i, --compressed — are ignored. Quotes, \ line continuations and