🔄

cURL Converter

Verified

by Community

Convert cURL commands to equivalent code in Python, JavaScript, Go, PHP, and other languages. Also convert code back to cURL.

curlconvertapihttpdevelopment

cURL Converter Skill

When given a cURL command, convert it to the requested language.

Example Input

curl -X POST https://api.example.com/data \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer token123" \
  -d '{"name": "test"}'

Python (requests)

import requests
response = requests.post(
    "https://api.example.com/data",
    headers={"Content-Type": "application/json", "Authorization": "Bearer token123"},
    json={"name": "test"}
)
print(response.json())

JavaScript (fetch)

const response = await fetch("https://api.example.com/data", {
  method: "POST",
  headers: {"Content-Type": "application/json", "Authorization": "Bearer token123"},
  body: JSON.stringify({name: "test"})
});
const data = await response.json();

Guidelines

  • Parse all cURL flags: -X, -H, -d, -F, --data-raw, -u
  • Handle multipart/form-data for -F flags
  • Include error handling in generated code