cURL to Node, Python and Java Converter
Turn a cURL command into Node.js fetch, Python requests or Java HttpClient code. Secrets are replaced with placeholders. Nothing is executed.
cURL to Code tool
Runs entirely in your browser. Nothing you paste is uploaded or stored.
The command is only parsed, never run.
Found a problem or have an idea for this tool? Send feedback.
About this tool
Paste a cURL command, for example one copied from browser developer tools or API documentation, and get the same request as Node.js fetch, Python requests or Java HttpClient code.
Secrets such as Authorization headers and basic-auth passwords are replaced with placeholders by default, so the code is safe to paste into a ticket. The command is only parsed, never run.
How to use it
- Paste the cURL command.
- Choose a language.
- Copy the code and fill in any placeholders from your own configuration.
Limitations
- Common options only: method, URL, headers, body and basic auth.
- The Java sample must run inside a method that handles checked exceptions.
Example
curl -X POST https://api.example.com/orders -H 'Content-Type: application/json' -H 'Authorization: Bearer abc123' -d '{"id":1}'const response = await fetch("https://api.example.com/orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "<AUTHORIZATION>",
},
body: "{\"id\":1}",
});
console.log(response.status, await response.text());
Common use cases
From docs to code
Turn the cURL example in an API guide into working client code.
Reproducing a browser call
Copy as cURL from developer tools, then convert it.
Sharing a request
Share a request with secrets removed.