cURL to Code

Turn a curl command into JavaScript, Python, Go or PHP code.

100% private — everything runs in your browser

How to Use

  1. 1

    Copy a curl command from your terminal or API docs.

  2. 2

    Choose the language you want to target.

  3. 3

    Convert, then copy the generated code.

Examples

JSON POST

Input

curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{"name":"Ada"}'

Output

fetch code with method POST, the JSON header and the body.

Basic auth

Input

curl -u user:pass https://api.example.com/me

Output

Code that sends an Authorization: Basic header, or the native auth option of the language.

FAQ

Which flags are supported?

Headers, data, GET query mode, basic auth, follow-redirect and insecure flags, plus method overrides.

Why are -F and --upload-file rejected?

Multipart and file uploads need extra runtime code. The tool refuses rather than emit code that silently behaves differently.

Does it follow redirects by default?

It mirrors curl: redirects are followed only when -L or --location is present.

Related Tools