curl Converter API
Convert a curl command into fetch, axios, Python requests, PHP, Go, Java, C#, Ruby, Node.js, wget or HTTPie code, with headers, body and query as JSON.
Paste a curl command, for example from an API’s documentation or from the browser’s "Copy as cURL" (bash or Windows cmd), and get equivalent code for JavaScript fetch, axios, Python requests, PHP curl, Go net/http, Java HttpClient, C# HttpClient, Ruby Net::HTTP, Node.js http / https, wget and HTTPie. to selects targets (comma-separated, default all). The response also has the parsed request: method, URL, query parameters, headers, body (JSON, form, multipart parts or a file reference) and auth, handy to feed a no-code HTTP step.
The command line is parsed by our own POSIX shell-word parser: single and double quotes, backslash escapes, $'…' ANSI-C strings, line continuations with \, ^ (cmd) or backtick (PowerShell). Supported options: -X, -H, -d / --data / --data-raw / --data-binary / --data-urlencode, --json, -F / --form, -u, --oauth2-bearer, -b, -A, -e, -k, -L, -I, -G, --compressed, -x, --url, --url-query, -o, -m, combined short flags (-sSL) and --opt=value.
Harmless display options (-s, -v, -i, --retry…) are listed in ignored_options; options we do not translate are listed in unsupported_options, and warnings explain approximations (files read with @, cookies from a file, several URLs). Nothing is sent to the URL in the command.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
curl | body|query | string | yes | The curl command (or send it as a raw text body). | |
to | body|query | string | no | all | Targets: fetch, axios, python, php, go, java, csharp, ruby, node, wget, httpie or all (comma-separated). |
Example
curl -X POST "https://apibox.io.vn/v1/curl-convert" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"curl":"curl -X POST https://api.example.com/v1/orders -H '\''Content-Type: application/json'\'' -u key:secret -d '\''{\"sku\":\"A1\",\"qty\":2}'\''","to":"python"}'const res = await fetch('https://apibox.io.vn/v1/curl-convert', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"curl": "curl -X POST https://api.example.com/v1/orders -H 'Content-Type: application/json' -u key:secret -d '{\"sku\":\"A1\",\"qty\":2}'",
"to": "python"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/curl-convert",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"curl": "curl -X POST https://api.example.com/v1/orders -H 'Content-Type: application/json' -u key:secret -d '{\"sku\":\"A1\",\"qty\":2}'", "to": "python"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/curl-convert');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"curl":"curl -X POST https://api.example.com/v1/orders -H \'Content-Type: application/json\' -u key:secret -d \'{\\"sku\\":\\"A1\\",\\"qty\\":2}\'","to":"python"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"request": {
"method": "POST",
"url": "https://api.example.com/v1/orders",
"full_url": "https://api.example.com/v1/orders",
"query": {},
"headers": {
"Content-Type": "application/json"
},
"body": {
"type": "json",
"text": "{\"sku\":\"A1\",\"qty\":2}",
"json": {
"sku": "A1",
"qty": 2
}
},
"auth": {
"user": "key",
"password": "secret",
"type": "basic"
},
"follow_redirects": false,
"insecure": false,
"compressed": false
},
"code": {
"python": "import requests\n\njson_data = {\n \"sku\": \"A1\",\n \"qty\": 2,\n}\n\nresponse = requests.post(\"https://api.example.com/v1/orders\",\n json=json_data,\n auth=(\"key\", \"secret\"),\n allow_redirects=False,\n)\nprint(response.status_code, response.text)\n"
},
"targets": {
"python": "Python requests"
}
}
Use cases
- Turn the curl examples of a payment or shipping API into PHP or Python code
- Replay a request copied from the browser DevTools in a script
- Get headers and body as JSON for an n8n, Make or Apps Script HTTP step
- Teach the same HTTP request in several languages
FAQ
Does the API call the URL in my command?
No. It only parses the text and generates code; no request is made to the URL.
What happens with -d @file or -F file=@photo.jpg?
The generated code reads the named file (open(), fs.readFileSync, CURLFile, os.Open…) and a warning reminds you that the file must exist where the code runs.
Is the Windows "Copy as cURL (cmd)" format supported?
Yes. ^ escapes and ^ line continuations from cmd, and backtick continuations from PowerShell, are handled before parsing.
Related APIs
UUID Generator
Generate up to 1,000 UUID v4, time-ordered UUID v7, ULID, Nano ID or random hex IDs per request. Secure randomness, optional uppercase.
⏱Cron Expression Parser
Validate a cron expression and get its next run times in any timezone, with a plain-English description. Supports 5, 6 and 7-field cron syntax.
🕒Time & Timezone Converter
Get the current time in any timezone, convert between timezones and Unix timestamps (seconds or ms), with UTC offset and weekday for up to 30 zones.