How to convert a curl command to code
- Paste a curl command into the box: from API documentation, a terminal, or your browser's dev tools.
- Pick a language. The converted code updates as you type.
- Copy it into your project. Warnings below the code flag anything that needs your attention, like files.
Copy any request from your browser as cURL
In Chrome, Edge or Firefox, open the developer tools, go to the Network tab and reload the page. Right-click a request and choose Copy → Copy as cURL. Paste it here to replay that exact request from your own code. Both the bash and Windows (cmd) formats work; headers your HTTP library sets itself, like Content-Length and Host, are dropped automatically.
Supported languages
| Language | Library | Converter |
|---|---|---|
| Python | requests | curl to Python |
| JavaScript | fetch | curl to JavaScript |
| Node.js (axios) | axios | curl to Node.js (axios) |
| Go | net/http | curl to Go |
| PHP | cURL | curl to PHP |
| Ruby | Net::HTTP | curl to Ruby |
Supported curl options
| Option | Converted to |
|---|---|
-X, --request | HTTP method (GET, POST, PUT, PATCH, DELETE…) |
-H, --header | Request headers |
-d, --data, --data-raw, --data-binary | Request body (JSON, form-encoded or raw text) |
--data-urlencode, -G | URL-encoded data, in the body or the query string |
--json | JSON body with JSON Content-Type and Accept headers |
-F, --form | Multipart form fields and file uploads |
-u, --user, --oauth2-bearer | Basic auth or a bearer token |
-A, -e, -b | User-Agent, Referer and Cookie headers |
-L, -k, -m | Follow redirects, skip TLS checks, timeout |
-I, --head | HEAD request |
Output-only options like -s, -v, -i and --compressed are ignored. Anything the converter can't express (proxies, client certificates, reading data from files) is listed as a warning instead of silently dropped.
Building an AI agent? Turn the same command into an OpenAI or Claude tool definition, or an MCP server, with the AI Tool Generator.
Every conversion is tested: we send the same request with curl and with the generated code and check that the method, URL, headers, auth and body match.