cURL to code

cURL to code

Turn a copied curl command into JavaScript fetch or Python requests code.

About this tool

curl is a command line tool for sending HTTP requests. A copied command often holds the method, headers and body you need to reproduce in code.

Paste a typical curl command to see the same request as JavaScript fetch or Python requests. Common flags such as -X, -H, -d, -G, -u and --json are read. Nothing is executed or sent.

Worked example

curl -X POST https://api.example.com/items -H "Content-Type: application/json" -d '{"name":"Ada"}' becomes a fetch call with method POST and the same JSON body.

Common searches