Convert a cURL DELETE request to Node.js

Paste any curl DELETE command and get clean Node.js code using native fetch. Runs entirely in your browser — headers, auth, and JSON bodies map to idiomatic Node.js.

Quick answer

To convert a cURL command to Node.js, paste it into the Toolpaper workbench below. It parses the command in your browser and emits idiomatic Node.js code — headers, query string, request body, authentication (Bearer, Basic, API key), and cookies are all wired up automatically. No data is uploaded; conversion is fully client-side.

Prefer a different target? See the full cURL to Node.js reference, or jump to the same guide in JavaScript, Python, or Go.

InputcURL command
1 secret
MethodDELETE·Headers1·Body—· Chars 89
OutputJavaScript · Node fetch(Node 18+)
// Node 18+ has global fetch
const response = await fetch("https://api.example.com/users/42", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  },
  redirect: "manual"
});
const data = await response.json();
Inspect

Example

A representative curl command for this scenario. Paste your own above to convert an exact match.

curl input
curl -X DELETE https://api.example.com/users/42 \
  -H "Authorization: Bearer YOUR_TOKEN"

Implementation notes

  • Request-line method (DELETE) and target URL are extracted from the curl command exactly as written — no case-folding, no path rewriting.
  • Every -H header maps to a Node.js header entry; duplicates are preserved so servers that read multi-valued headers keep behaving.
  • Query strings in the URL stay in the URL; -G with --data-urlencode is promoted to a structured params argument where native fetch supports it.
  • DELETE with a body (some REST APIs require it) is preserved — many generators mistakenly strip it, Node.js keeps the payload attached.
  • TLS flags (--insecure, --cacert, --cert) surface as inline notes so you don't ship an insecure client to production by accident.

Common mistakes

  • Forgetting that -X DELETE without a body still sends an empty body — the generated code mirrors that exactly.
  • Assuming curl auto-follows redirects: it doesn't. Add -L (or the generator's follow-redirects flag) if you actually need to chase 3xx responses.
  • Copying a Cookie header from DevTools that already encodes session state — use the Clean panel to strip session cookies before you share.

Common questions

How do I send a DELETE request in Node.js?
Paste your curl DELETE command above. Toolpaper generates Node.js using native fetch with headers, query string, and (where applicable) request body wired up.
Does the DELETE generator handle authentication?
Yes — Authorization headers, Bearer tokens, Basic auth (-u), and API keys pass through to the generated Node.js code unchanged.
Is my curl sent to a server?
No. Parsing and code generation run in your browser. Nothing is uploaded.
Can I also convert this to other languages?
Yes. Once you paste your command, the language picker lets you switch between 18 targets (fetch, axios, Python, Go, PHP, Ruby, Rust, Java, Kotlin, C#, PowerShell, Swift and more).

More cURL methods in Node.js

Node.js hub →

The same guide in other languages

All guides →

Full Node.js reference on the cURL to Node.js hub, or open the main converter for all 18 targets.