From a curl line in the docs to code in your project
API documentation shows a curl command, and browser developer tools can copy any request as one. Your project needs the same call in JavaScript or Python. Paste the command here and the equivalent code appears, with the method, headers and body already in place.
Convert a command in four steps
- Paste the cURL command into the left box. Multi-line commands with trailing backslashes work, and so does a leading
$. - Choose the output: JavaScript with
fetch, JavaScript withaxios, or Python withrequests. - Check any notes above the boxes. They list options that could not be carried over.
- Press Copy, or download the code as a file.
What is carried over
- The method from
-X, or POST when the command has data and GET otherwise. - Headers from
-H, plus cookies (-b), user agent (-A) and referer (-e). - Request bodies from
-d,--data-raw,--data-binary,--data-urlencodeand--json. A JSON body becomes a real object in the code. - Multipart forms from
-F, and-Gto move data into the query string. - Basic authentication from
-u, as a header for fetch and asauthfor axios and Python.
Things to check afterwards
Options that only affect how curl prints its output, such as -s, -v, -o and --compressed, are skipped. Uploading a file with @file needs a file object in a browser, so the code uses a placeholder. -k has no browser equivalent, because browsers always check certificates. Secrets such as tokens stay in the code exactly as in the command, so move them to a variable before you commit anything.
Your command stays on this page
The conversion happens in your browser. Copied requests often contain cookies and tokens, and none of it is sent anywhere.