cURL to Code Converter
Pricing
Pay per event
cURL to Code Converter
Convert cURL commands to Python, JavaScript, PHP, Go, Ruby, Java, C#, Rust, Swift, Kotlin, and more. Supports 14 languages. Batch-convert dozens of cURL commands in one run.
Pricing
Pay per event
Rating
0.0
(0)
Developer
Stas Persiianenko
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
21 days ago
Last modified
Categories
Share
Convert cURL commands to clean, production-ready code in Python, JavaScript, PHP, Go, Ruby, Java, C#, Rust, Swift, Kotlin, and more — all in one run.
What does it do?
Paste any cURL command (or a batch of them) and get back ready-to-use code snippets in your chosen programming languages. The actor parses each cURL command and generates idiomatic HTTP client code with correct headers, methods, request bodies, and authentication.
It handles:
- 🔁 Simple GET requests and complex POSTs with JSON bodies
- 🔐 HTTP Basic Auth, Bearer tokens, and custom headers
- 📦 Form data, multipart uploads, and raw body payloads
- 🔗 URL parameters and query strings
- 🔄 Multi-line cURL commands with
\line continuations - 📋 Batch conversion — process dozens of commands in one run
Who is it for?
This tool is for developers who want to stop manually translating curl commands:
- API developers — convert browser DevTools "Copy as cURL" exports directly to your stack
- Backend engineers — migrate API documentation examples from curl to Python or Node.js
- QA engineers — transform curl-based test scripts into language-native HTTP clients
- Data engineers — batch-convert curl scraping scripts when switching language stack
- Full-stack developers — translate third-party API cURL examples into production code without boilerplate
Why use it?
Writing HTTP client code from curl is tedious and error-prone. Getting headers, auth, and body encoding right takes time. This actor does it instantly — and does it for 14 languages at once.
- ⚡ Instant — no manual parsing, no copy-paste errors
- 🌐 14 languages — Python, JS, Node.js (3 variants), PHP, Go, Ruby, Java, C#, R, Rust, Swift, Kotlin
- 📦 Batch — convert entire curl libraries in a single run
- 🔒 Private — your commands are processed and discarded, never stored
- 💰 Cheap — 100 commands costs ~$0.105 at FREE tier
Supported languages
| Key | Language / Library |
|---|---|
python | Python (requests) |
javascript | JavaScript (fetch) |
node | Node.js (http) |
node-fetch | Node.js (node-fetch) |
node-axios | Node.js (axios) |
php | PHP (curl) |
go | Go (net/http) |
ruby | Ruby (net/http) |
java | Java (HttpURLConnection) |
csharp | C# (HttpClient) |
r | R (httr) |
rust | Rust (reqwest) |
swift | Swift (URLSession) |
kotlin | Kotlin (OkHttp) |
How much does it cost to convert cURL commands to code?
Pay-per-event pricing — you only pay for what you convert:
| Event | FREE | BRONZE | SILVER | GOLD | PLATINUM | DIAMOND |
|---|---|---|---|---|---|---|
| Run started (one-time) | $0.005 | $0.005 | $0.005 | $0.005 | $0.005 | $0.005 |
| Per cURL command converted | $0.001 | $0.0009 | $0.0008 | $0.00065 | $0.0005 | $0.0004 |
Example costs:
- 10 commands → ~$0.015 (FREE tier)
- 100 commands → ~$0.105 (FREE tier)
- 100 commands → ~$0.045 (DIAMOND tier — 60% off)
DIAMOND subscribers save 60% on per-conversion charges.
How to convert cURL commands to code
Step 1 — Open the actor on Apify Console
Step 2 — Paste your cURL commands into the cURL Commands field (one per line)
Step 3 — Select the Target Languages you want (defaults to Python, JavaScript, PHP, Go, Ruby)
Step 4 — Click Start and wait a few seconds
Step 5 — Download the dataset as JSON or access results via the Apify API
💡 You can also run it via API or CLI — see the API usage section below.
Input parameters
| Field | Type | Required | Description |
|---|---|---|---|
curlCommands | array of strings | ✅ Yes | One or more cURL commands to convert. Each must start with curl. |
languages | array of strings | No | Target languages (defaults to python, javascript, php, go, ruby if omitted). |
Example input
{"curlCommands": ["curl https://api.github.com/repos/apify/apify-sdk-js","curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{\"name\": \"John\"}'","curl -u admin:secret https://api.example.com/protected"],"languages": ["python", "javascript", "go"]}
Output examples
Each cURL command produces one dataset item with all requested language conversions:
{"curlCommand": "curl https://api.github.com/repos/apify/apify-sdk-js","conversions": {"python": "import requests\n\nresponse = requests.get('https://api.github.com/repos/apify/apify-sdk-js')\n","javascript": "fetch('https://api.github.com/repos/apify/apify-sdk-js');\n","go": "package main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", \"https://api.github.com/repos/apify/apify-sdk-js\", nil)\n\t..."},"errors": {},"success": true}
Output fields:
| Field | Type | Description |
|---|---|---|
curlCommand | string | The original cURL command |
conversions | object | Map of language key → generated code string (null if conversion failed) |
errors | object | Map of language key → error message (only populated for failed conversions) |
success | boolean | True if at least one language conversion succeeded |
Tips and best practices
- Start with the defaults — the default languages (Python, JS, PHP, Go, Ruby) cover most use cases. Add more only if you need them.
- Copy from DevTools — in Chrome or Firefox, right-click any network request → Copy → Copy as cURL. Paste directly into this actor.
- Multi-line commands work — commands with
\line continuations are fully supported. Paste them as-is. - Check the
errorsfield — if a conversion fails for one language, other languages still succeed. Theerrorsfield tells you which ones failed and why. - Batch efficiently — combining 50 commands in one run costs the same start fee as 1 command. Batch up to save money.
- Complex flags — some advanced cURL flags like
--cert,--resolve, and--noproxymay not be supported in all target languages. The actor will note errors without blocking other conversions.
Integrations
With Make (Integromat): Use the Apify Make module to trigger a conversion run, then pass the output to a Google Sheets or Notion step to store your code snippets library.
With Zapier: Chain this actor with a Zapier Apify trigger → format the output → save to Airtable for team code sharing.
With n8n: Build a webhook → Apify HTTP Request node → Code node workflow that auto-converts inbound curl commands to your stack's format.
With GitHub Actions: Use the Apify API in a CI workflow to validate that your API documentation examples are always translatable to your target languages.
API usage (Node.js)
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });const run = await client.actor('automation-lab/curl-to-code-converter').call({curlCommands: ['curl https://api.github.com/repos/apify/apify-sdk-js',"curl -X POST https://api.example.com/data -H 'Content-Type: application/json' -d '{\"key\":\"value\"}'",],languages: ['python', 'javascript', 'go'],});const { items } = await client.dataset(run.defaultDatasetId).listItems();for (const item of items) {console.log('Command:', item.curlCommand);console.log('Python:', item.conversions.python);}
API usage (Python)
from apify_client import ApifyClientclient = ApifyClient("YOUR_API_TOKEN")run = client.actor("automation-lab/curl-to-code-converter").call(run_input={"curlCommands": ["curl https://api.github.com/repos/apify/apify-sdk-js","curl -X POST https://api.example.com/data -H 'Content-Type: application/json' -d '{\"key\":\"value\"}'",],"languages": ["python", "javascript", "go"],})for item in client.dataset(run["defaultDatasetId"]).iterate_items():print("Command:", item["curlCommand"])print("Python:", item["conversions"]["python"])
API usage (cURL)
curl -X POST \"https://api.apify.com/v2/acts/automation-lab~curl-to-code-converter/runs?token=YOUR_API_TOKEN" \-H "Content-Type: application/json" \-d '{"curlCommands": ["curl https://api.github.com/repos/apify/apify-sdk-js"],"languages": ["python", "javascript"]}'
Use with AI assistants (MCP)
The cURL to Code Converter is available as a tool for AI assistants that support the Model Context Protocol (MCP).
Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:
Setup for Claude Code
$claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/curl-to-code-converter"
Setup for Claude Desktop, Cursor, or VS Code
Add this to your MCP config file:
{"mcpServers": {"apify": {"url": "https://mcp.apify.com?tools=automation-lab/curl-to-code-converter"}}}
Your AI assistant will use OAuth to authenticate with your Apify account on first use.
Example prompts
Once connected, try asking your AI assistant:
- "Convert this curl command to Python:
curl -X POST https://api.example.com/data -H 'Authorization: Bearer TOKEN' -d '{\"key\":\"value\"}'" - "Take these 5 curl commands from my Postman export and generate Go code for all of them"
- "I'm migrating from bash scripts to Node.js — convert all these curl calls to fetch"
Learn more in the Apify MCP documentation.
FAQ
Q: What happens when a conversion fails for one language?
A: That language's conversions value is null and the error goes into the errors field. Other languages still succeed. The run is not aborted.
Q: Does it support cURL flags like --compressed, -L (follow redirects), or --cookie?
A: Most common flags are supported. --compressed maps to Accept-Encoding headers, -L maps to redirect handling, and cookies map to Cookie headers. Very advanced flags like --cert (client certificates) may not translate to all languages.
Q: Can I convert more than 100 commands per run? A: Yes — there's no hard limit. Large batches (500+ commands) work fine. The run just takes longer and charges per-command accordingly.
Q: The generated code doesn't match my expectations — what should I check?
A: Check that your cURL command is valid and parseable. Run curl --help on the command locally first. Commands with shell variable interpolation (e.g., $TOKEN) are passed through as literals — you'll need to replace them in the generated code.
Q: Are my cURL commands stored? A: No. The actor processes your input and writes output to the dataset. Commands are not logged beyond the Apify run log, which is visible to your account only.
Legality and terms of use
This actor converts cURL commands locally using open-source parsing libraries. It does not make any HTTP requests to the target URLs in your cURL commands — it only generates code.
No web scraping or data collection from external sites occurs. The actor is entirely a code transformation tool. Usage is subject to Apify's Terms of Service.
Related tools
- JSON Schema Generator — Generate JSON Schema from sample JSON objects
- Color Contrast Checker — Validate WCAG AA/AAA color contrast ratios for accessibility


