Loading Legacy
Paste curl from documentation or DevTools and get a modern async fetch() example with method, headers, and body filled in—handy when moving snippets into Next.js, Node, or browser code.
cURL command
Generated fetch()
const res = await fetch("https://api.example.com/v1/items", {
method: "GET",
headers: {
"accept": "application/json",
"authorization": "Bearer YOUR_TOKEN"
},
body: "{\"limit\":10}",
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
// const text = await res.text();
// const data = await res.json();Parsed method GET and 2 header(s). Review secrets before committing code.
No. Common cases like method, headers, and quoted --data are supported. Exotic flags or multipart uploads may need manual edits.
Parsing happens locally in your browser, but never commit secrets—scrub authorization headers before sharing code.