Home / Cost tools / cURL converter / Axios
cURL to Axios converter
Paste a cURL command and get the same request in Node.js (Axios), using Axios. It converts in your browser; nothing you paste is sent anywhere.
Converted in your browser. Nothing you paste is stored or sent, so a command with your API key in it stays on your machine.
import axios from "axios";
const response = await axios({
method: "get",
url: "https://api.scraper.example/v1/scrape?url=https%3A%2F%2Fshop.example.com%2Fproducts%3Fpage%3D2&render_js=true&country=us",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
},
});
console.log(response.status);
console.log(response.data); Install first: npm install axios
Running the code
Install axios with npm and run it as an ES module. The request becomes one config object: method, url, headers, data, auth and timeout in milliseconds.
Where Axios differs from curl
Axios throws for any status outside 200 to 299, so a 404 or a 403 from the target lands in catch, with the response on error.response. It parses a JSON reply into response.data for you.
What calls like this one cost
The example is a scraping API call with JavaScript rendering on and a country chosen. 100,000 of them a month cost from $49.00 on ScrapeBadger, and the same pages without rendering from $19.00 on BrowserCloud, the cheapest complete bills across 27 web scraping APIs this site prices from their own pages. What rendering adds on each API