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

OptionBecomes
-X, --requestthe HTTP method
-H, --headerheaders
-d, --data, --data-raw, --data-binarythe request body (POST by default)
--data-urlencodeURL-encoded form fields
--jsona JSON body with Content-Type and Accept set
-F, --formmultipart form data (@file for uploads)
-u, --userbasic authentication
-G, --getputs -d data in the query string
-A, -b, -eUser-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 …' strings are handled like a shell would.

Things to check after converting

Turn the request into an endpoint

Need this call to run on a server — on a schedule, from a webhook, or for your frontend without exposing the key? Paste the curl command into Wisp and say what should trigger it; Wisp writes the function, stores the key as a secret and gives you a URL.

Related