Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

curl Converter API

Convert a curl command into equivalent code: JavaScript fetch, Node.js axios, Python requests, Go net/http, PHP curl or HTTPie. Handles headers, -d/--data*, -F forms, -u auth and common flags; unsupported options come back as warnings.

POST /api/v1/tools/curl-converterMCP curl_converterDeveloper Tools

Convert curl commands to JavaScript fetch, Node axios, Python requests, Go net/http, PHP curl or HTTPie. Handles headers, data, forms, auth and cookies in your browser.

Input

Send these as a JSON object. Unknown fields are rejected.

command
The curl command, as copied from a terminal or browser dev tools (line continuations allowed). (string, up to 100000 characters, required)
target
Output language: fetch (JavaScript fetch), axios (Node.js axios), python (Python requests), go (Go net/http), php (PHP curl), httpie (HTTPie). (string, one of fetch, axios, python, go, php, httpie, default "fetch")
curl https://pithlab.com/api/v1/tools/curl-converter \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"command":"curl -X POST https://api.example.com/v1/items -H '''Content-Type: application/json''' -H '''Authorization: Bearer TOKEN''' -d '''{\"name\":\"Widget\"}'''","target":"python"}'
Example response
{
  "ok": true,
  "result": {
    "output": "import requests\n\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"Authorization\": \"Bearer TOKEN\",\n}\n\njson_data = {\n    \"name\": \"Widget\",\n}\n\nresponse = requests.post(\"https://api.example.com/v1/items\", headers=headers, json=json_data)\n\nprint(response.status_code)\nprint(response.text)\n",
    "warnings": []
  }
}