Back to home

cURL to Code

Turn a curl command into fetch, axios, Python or Go code

cURL command
POST https://api.example.com/v1/users
Code
const res = await fetch("https://api.example.com/v1/users", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer sk-demo-token",
  },
  body: JSON.stringify(
    {
      "name": "Alice",
      "email": "alice@example.com",
      "age": 29
    },
  ),
});

if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);
18 lines

Parsed in your browser and never sent anywhere; handles -X / -H / -d / -F / -u / -b / -A / -e plus quoting and line continuations. The result is a runnable code skeleton.