cURL to Code Converter
Paste a curl command and get the same request in Python, JavaScript, Go, PHP and Ruby, with credentials moved into environment variables.
Five languages below, all generated from the same parse.
- Method
- POST
- Headers
- 2
- Body
- 89 characters
- Values moved to environment variables
- 1
- The value of "authorization" looks like a credential, so the snippets read it from the API_KEY environment variable instead of hard-coding it.
-d flags are joined with &, again as curl does. A body that parses as JSON is emitted as a native dictionary in Python and an object in JavaScript, and as a raw string in the other three — a string is never reformatted, so whatever you pasted is what gets sent. Everything on this page runs in your browser. Nothing you paste is uploaded, logged or sent anywhere. Your key is not sent anywhere by this page, but it is still in your clipboard: rotate anything you paste into any converter, including this one.Curl is how every API doc shows a request and how nobody ships one. The translation is mechanical — a URL, a method, some headers, a body — and the reason it is worth a tool rather than a minute of typing is the quoting. A JSON body inside single quotes inside a shell command, re-escaped for a Go string literal, is exactly the kind of thing that works until the day a customer name contains an apostrophe.
The key in the header
Most curl commands people paste have a live API key in them. This tool spots credential-shaped header values and emits an environment variable read instead, preserving the Bearer prefix that everyone forgets when they do it by hand. It cannot spot a key that does not look like one, so check the output before you commit it. And treat any key you have pasted anywhere as compromised: rotating it costs a minute.
What is deliberately not converted
-k disables certificate verification and is not carried into the code, because a flag typed once during debugging should not become a permanent property of your client. -F builds multipart uploads, which every language does through its own helper. Both are reported rather than silently ignored, along with any flag this parser does not recognise — the list under the snippets is the complete record of what your command contained and the code does not.