cURL Builder: Build HTTP Requests Visually
The curl2code cURL Builder lets you construct HTTP requests using a visual form — no need to memorize curl flags. Choose the HTTP method, set the URL, add headers, authentication, query parameters, and a request body — then copy the generated curl command or convert it to code in over 30 languages including Python, JavaScript, Go, and more. Everything runs locally in your browser — your API keys and data never leave your device. If you already have a curl command, paste it into the curl converter for instant code generation.
How to Use cURL Builder
- 1
Set the request URL and method
Enter the target URL and select the HTTP method —
GET,POST,PUT,PATCH,DELETE, or any custom method. - 2
Configure headers, body, and auth
Use the tabs to add custom headers, set the request body (JSON, form data, or raw text), configure authentication (Bearer token, Basic auth, or API key), and add query parameters.
- 3
Copy the curl command or generated code
The
curlcommand is generated in real time. Copy it directly, or select a target language to get production-ready code.
What You Can Build
HTTP Methods
Build requests with any HTTP method — GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, or a custom verb.
Custom Headers
Add any number of HTTP headers like Content-Type, Accept, User-Agent, or custom headers required by your API.
Request Body
Send data as JSON, form data (application/x-www-form-urlencoded), multipart form (multipart/form-data), or raw text.
Authentication
Configure Bearer token, Basic auth (username and password), or API key in a header — the Builder generates the correct Authorization header automatically.
Query Parameters
Add query parameters as key-value pairs and the Builder appends them to the URL with proper encoding.
Code Generation
Convert the built request to code in 30+ languages — from Python and JavaScript to Rust, Swift, and Ansible.
curl Guides
Frequently Asked Questions
How do I add Bearer token authorization to a curl request?
In the cURL Builder, select the Auth tab and choose Bearer Token. Enter your token and the Builder generates curl -H "Authorization: Bearer YOUR_TOKEN" URL. In raw curl, use the -H flag: curl -H "Authorization: Bearer abc123" https://api.example.com. To convert this to code, paste the command into the curl converter — it will produce the correct authorization header for Python, JavaScript, and 30+ other languages.
How to send Basic authentication with curl?
Use the -u flag: curl -u username:password https://api.example.com. This sends a Base64-encoded Authorization: Basic header. In the cURL Builder, select Auth → Basic and fill in the username and password fields. Basic auth is not encrypted on its own — always use HTTPS. curl2code correctly converts -u to the equivalent auth mechanism in each target language.
How to pass an API key in curl headers?
Most APIs accept keys in a header: curl -H "X-API-Key: YOUR_KEY" https://api.example.com. Some APIs use Authorization: ApiKey KEY or a query parameter instead. In the cURL Builder, use the Headers tab to add any custom header, or the Auth tab for built-in API key support. The Builder generates the correct curl syntax, which you can then convert to Python, Go, or any other language.
How to make a GET request with custom headers in curl?
A basic GET request is simply curl https://api.example.com — GET is the default method. To add headers, use -H: curl -H "Accept: application/json" -H "Authorization: Bearer token" https://api.example.com/users. In the cURL Builder, enter the URL, keep the method as GET, and add your headers in the Headers tab. The generated command can be converted to code with the converter.
What is the difference between POST and PUT in curl?
Both send data to a server, but they differ in semantics. POST creates a new resource: curl -X POST -d {"name":"Alice"} URL. PUT replaces an existing resource entirely: curl -X PUT -d {"name":"Bob"} URL. Use PATCH for partial updates. In practice, the curl syntax is identical except for the -X flag. The cURL Builder lets you switch methods with a dropdown — the rest of the request stays the same.
How to send a POST request with JSON body in curl?
Use -X POST with -H and -d: curl -X POST -H "Content-Type: application/json" -d {"key":"value"} https://api.example.com. In the cURL Builder, set the method to POST, switch to the Body tab, select JSON, and paste your data — the Content-Type header is added automatically. This is the most common API request pattern. Convert it to Python, JavaScript, or any language with the converter.
How to set Content-Type and Accept headers in curl?
Use the -H flag for each header: curl -H "Content-Type: application/json" -H "Accept: application/json" https://api.example.com. Content-Type tells the server what format the request body is in; Accept tells the server what format you want the response in. In the cURL Builder, add these in the Headers tab — or the Content-Type is set automatically when you choose a body type.
How to add custom headers to a curl request?
Use -H (or --header) for each header: curl -H "X-Request-ID: abc123" -H "User-Agent: MyApp/1.0" https://api.example.com. You can add as many -H flags as needed. Common custom headers include X-API-Key, User-Agent, X-Request-ID, and Cache-Control. In the cURL Builder, the Headers tab provides a key-value editor for adding unlimited custom headers.
How to send form data and multipart requests with curl?
For URL-encoded form data, use -d: curl -d "username=alice&password=secret" https://example.com/login. For multipart form data (file uploads), use -F: curl -F "file=@photo.jpg" -F "description=My photo" https://example.com/upload. The -F flag automatically sets Content-Type: multipart/form-data. In the cURL Builder, switch to the Body tab and select Form Data or Multipart to build these requests visually.
How to upload a file with curl?
Use the -F flag with @ to reference a local file: curl -F "file=@/path/to/document.pdf" https://api.example.com/upload. You can upload multiple files: curl -F "file1=@photo.jpg" -F "file2=@resume.pdf" URL. To set a custom filename or MIME type: curl -F "file=@photo.jpg;filename=avatar.jpg;type=image/jpeg" URL. curl2code converts all these patterns correctly to Python, Node.js, Go, and other languages.
How to send raw data and request body in curl?
Use -d (or --data) to send a request body: curl -d "raw text payload" https://api.example.com. For binary or file-based data, use --data-binary @file.bin. Use --data-raw to send the string literally without interpreting @: curl --data-raw {"key":"value"} URL. Adding -d automatically sets the method to POST and the Content-Type to application/x-www-form-urlencoded — override it with -H when sending JSON or plain text. In the cURL Builder, use the Body tab to enter raw content and select the appropriate content type.
How to send and manage cookies with curl?
Use -b to send cookies: curl -b "session=abc123; lang=en" https://example.com. To save cookies from a response, use -c: curl -c cookies.txt https://example.com/login. To send saved cookies on the next request: curl -b cookies.txt https://example.com/dashboard. Combine both for a full session flow: curl -c cookies.txt -b cookies.txt URL. curl2code correctly converts -b cookie strings to the equivalent cookie handling in Python, JavaScript, and 30+ other languages via the converter.