cURL to Node.js request Converter
Convert curl commands to Node.js code using request. Paste a command and the request snippet appears instantly — everything runs in your browser.
- Instant ConversionCode updates as you type
- Multiple Languages40 languages, 61 libraries
- 100% Client SideYour data stays private
How to use this tool
Steps for using the cURL to Code.
- Copy a curl command — from API documentation, or from your browser's DevTools (Network tab → right-click a request → Copy as cURL (bash)).
- Paste it into Enter cURL command. The Node.js request code appears instantly; other Node.js libraries (fetch (built-in), Axios, Got, Ky, node-fetch, SuperAgent, http) are in the tabs above the code.
- Set up: Install with
npm install request(deprecated). - Run it: Save as
request.jsand runnode request.js. Replace placeholders such asYOUR_TOKENfirst, and check any notes under the editors for curl options that have no request equivalent.
Example
GET with headers → Node.js request
curl 'https://api.example.com/v1/users?page=2' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'// The `request` package is deprecated; consider fetch, got or Axios for new code.
const request = require('request');
const options = {
url: 'https://api.example.com/v1/users?page=2',
method: 'GET',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
};
request(options, (error, response, body) => {
if (error) throw error;
console.log(response.statusCode);
console.log(body);
});Common use cases
- Maintaining existing code that uses request
Converting curl to Node.js request
request was once the most popular Node.js HTTP client. It has been deprecated since 2020 and no longer receives updates.
The converter reads the curl command the way curl does — the method (-X), headers (-H), request bodies (-d, --data-raw, --json, -F), query strings, basic auth (-u) and cookies — and writes the equivalent request code. Options that have no request equivalent are listed under the editors rather than silently dropped.
Other libraries for Node.js, each with its own page: fetch (built-in), Axios, Got, Ky, node-fetch, SuperAgent, http.
Limitations
- Deprecated — use built-in fetch, Got or Axios for new code.
- The code is a starting point: add timeouts, retries and error handling for production use.
- Secrets in the curl command are copied into the code — move them to environment variables before committing.
Frequently asked questions
Is the request package still safe to use?
It's deprecated and unmaintained, so it won't get fixes. Migrate to fetch, Got or Axios.
Why generate request code at all?
To help when you're working on an existing codebase that still uses it.
Is my curl command sent to a server?
No. The conversion runs entirely in your browser, so tokens and passwords in the command never leave your device. Still, replace real secrets before sharing the generated code.