Convert a cURL Command to Python, Java or JavaScript and Run It

Import a cURL command, check which options matter, send it from the browser, and turn it into Python requests, Java HttpClient or fetch code.

Read what the command actually sends

A cURL command is a method, a URL and a list of options. -X sets the method; without it curl sends GET, or POST when a body is given with -d, --data-raw or --json. -H adds a header, -u user:password becomes a Basic Authorization header, -b sends cookies, and -F builds a multipart form, with @file for file fields.

Some options only affect the command line: -s hides progress, -o saves the output, -k skips certificate checks and --compressed asks for gzip. They do not change the request your server receives, so a converter can safely ignore them.

curl -X PATCH 'https://jsonplaceholder.typicode.com/posts/1' \
  -H 'Content-Type: application/json' \
  -u demo:s3cret \
  --data-raw '{"title": "Updated"}'

Run it from the browser

Paste the command into the URL field of the API tester. The method, URL, query parameters, headers, Basic or Bearer auth and JSON body move into their own tabs, where you can edit them and press Send. The Sent request tab shows the final headers, including the Authorization header built from -u.

If the request fails without a status code, the API probably does not accept requests from web pages (CORS). Enable CORS on your own server, or use the API tester's local proxy, which forwards requests from your own computer.

Generate Python, Java or JavaScript

Select Code and choose a language. Python requests sends a parsed JSON body with json=, so booleans and null become True and None. Java HttpClient uses HttpRequest.BodyPublishers.ofString with the JSON text, and Spring RestClient chains .header() and .body() calls. JavaScript fetch wraps the body in JSON.stringify.

Keep secrets out of shared code: turn off Fill in variable values and use a {{token}} variable in the Auth tab, so the generated code contains a placeholder you can replace with an environment variable.

import requests

url = "https://jsonplaceholder.typicode.com/posts/1"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Basic ZGVtbzpzM2NyZXQ=",
}
payload = {
    "title": "Updated"
}

response = requests.request("PATCH", url, headers=headers, json=payload, timeout=30)

print(response.status_code)
print(response.text)

Check the decoded credentials

Basic auth is only Base64, not encryption: decoding ZGVtbzpzM2NyZXQ= gives demo:s3cret. Anyone who can read a command, a log or generated code can recover the password, so always send Basic auth over HTTPS and avoid committing commands that contain real credentials.

Reference: curl manual: options for headers, data and authentication.