cURL to Code
Convert cURL commands into fetch, Axios, Python requests, PHP, Go and Node.js code.
Tip: in Chrome DevTools → Network, right-click a request → Copy → Copy as cURL (bash).
Parsed request
| Method | POST |
|---|---|
| URL | https://api.example.com/v1/orders?status=open |
| Authorization | Bearer YOUR_TOKEN |
| Content-Type | application/json |
| Body | {"customerId": 42, "items": [{"sku": "TS-01", "qty": 2}], "express": true} |
const response = await fetch("https://api.example.com/v1/orders?status=open", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"customerId": 42,
"items": [
{
"sku": "TS-01",
"qty": 2
}
],
"express": true
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);