cURL to Code Converter

Paste a curl command below. It's parsed entirely in your browser — the request is never sent anywhere, and credentials in the command are never transmitted. Shell features this tool can't safely interpret (variable expansion, command substitution, pipes, unrecognized flags) are rejected explicitly rather than guessed at.

Parsed request

Method
POST
URLhttps://api.example.com/users
Headers
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
Body{"name": "Ada Lovelace", "role": "engineer"}
fetch("https://api.example.com/users", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
  },
  body: "{\"name\": \"Ada Lovelace\", \"role\": \"engineer\"}",
})
  .then((res) => res.text())
  .then((data) => console.log(data));

FAQ

See also: