← Back to Home

Generate Curl Command

/generate-curl
Generate a ready-to-use curl command from request details. Perfect for documentation, debugging, or sharing API calls.
Try it now

Parameters

url body
Target URL
method body
HTTP method (default: GET)
headers body
Request headers object
body body
Request body

Examples

curl
curl -X POST https://tcpdata.com/generate-curl \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.example.com/users",
    "method": "POST",
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer token123"
    },
    "body": {
      "name": "John Doe",
      "email": "john@example.com"
    }
  }'

# Returns a formatted curl command:
# curl -X POST \
#   -H "Content-Type: application/json" \
#   -H "Authorization: Bearer token123" \
#   -d '{"name":"John Doe","email":"john@example.com"}' \
#   "https://api.example.com/users"
JavaScript (fetch)
const response = await fetch('https://tcpdata.com/generate-curl', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    url: 'https://api.example.com/users',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer token123'
    },
    body: {
      name: 'John Doe',
      email: 'john@example.com'
    }
  })
});
const result = await response.json();
console.log(result.curl);
Python (requests)
import requests

response = requests.post('https://tcpdata.com/generate-curl', json={
    'url': 'https://api.example.com/users',
    'method': 'POST',
    'headers': {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer token123'
    },
    'body': {
        'name': 'John Doe',
        'email': 'john@example.com'
    }
})
print(response.json()['curl'])