curl to code converter
Paste a curl command from an API's documentation or your terminal and get the same request in Python, JavaScript, Go or PHP. Free, no sign-up.
What you paste stays in your browser. This tool does its work on your own machine. The page carries a browser security rule that blocks it from making network requests or loading outside scripts, so this site's analytics and chat are switched off here too. You can check: open your browser's network tab, then use the tool.
Need the data itself? Try a free call.
How to convert a curl command
Most API documentation shows its examples as curl, because curl is on nearly every machine and shows the whole request in one place: the method, the address, the headers and the body. To use that request in a program you have to move each part into your language's HTTP library, and that is where mistakes creep in: a header is dropped, a quote is escaped twice, or a GET quietly becomes a POST.
Paste the command into the first box and choose a language. The converter reads the command the way a shell would, so single quotes, double quotes and backslash line breaks work. It follows curl's own rules for what is implied: sending data makes the request a POST unless you say otherwise, data sent with -d gets a form content type unless you set one, -G moves the data into the query string, and --json adds both JSON headers.
Options it understands
Method (-X), headers (-H), the data options, --json, basic sign-in (-u), user agent, referer, cookies, -G, -I and -k. Options that only change what curl prints, such as -s or -v, are skipped because they do not change the request. Anything it does not convert, including form uploads with -F, is named in a message above the code, so you are never left guessing what was lost.
Example
curl -X POST https://api.foxapis.com/v1/brand/record \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "example.com"}'
Before you run the result, move the key out of the source and into an environment variable. A key pasted into a script has a habit of ending up in version control. Also keep the timeout in the Python version, or add one in the other languages: a request with no time limit can hang a whole job.
Questions
Is it safe to paste a command that holds my API key?
The conversion runs in your browser, and this page's security rule blocks it from sending anything over the network. Your clipboard and browser extensions are outside the page's control, so treat a key with the usual care.
Why did my GET turn into a POST?
Because curl does the same: when a command sends data and names no method, curl uses POST. Add -G to send the data in the address instead.
Does it work with commands copied from browser developer tools?
Usually, when you copy as cURL for bash. The Windows cmd form escapes text differently and may not read correctly, so choose the bash form.
Does it check that the request works?
No. It translates what the command says and never calls the address.
More tools: JSON to CSV · API response diff · API cost calculator
Run this free, then pay per call
Start with 10,000 credits, no card. They arrive once you confirm your email and expire 90 days after they are added; credits you buy never expire. Start with 10,000 credits
Building an AI agent? See the MCP server