cURL Builder

Build copy-ready curl commands from method, URL, headers and body for API testing and docs.

Back to all tools on ToolForge

More in JSON & API







cURL Command

About cURL Builder

This cURL builder creates copy-ready curl commands from method, URL, headers and request body fields.

cURL Command Syntax

# Basic cURL command structure
curl [URL] [OPTIONS]

# Common options:
-X, --request       HTTP method (GET, POST, PUT, DELETE, etc.)
-H, --header        Add HTTP header (can be repeated)
-d, --data          POST data (use @filename for file upload)
-u, --user          Username and password
-o, --output        Write to file instead of stdout
-v, --verbose       Show request details for debugging

cURL Examples

GET request with headers:

curl "https://api.github.com/users/octocat" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer token"

POST request with JSON body:

curl "https://api.example.com/users" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"name":"John","email":"[email protected]"}'

File upload with cURL:

curl "https://api.example.com/upload" \
  -X POST \
  -F "file=@/path/to/file.txt" \
  -F "description=My file"

Common Use Cases

Frequently Asked Questions

What is the cURL command syntax?
cURL syntax is: curl [URL] [OPTIONS]. Common options: -X (HTTP method), -H (headers), -d (data/body), -u (authentication), -o (output file), -v (verbose). Example: curl https://api.example.com/users -X POST -H "Content-Type: application/json" -d '{"name":"test"}'.
How do I send a POST request with cURL?
Use -X POST and -d for data: curl "https://api.example.com/users" -X POST -H "Content-Type: application/json" -d '{"name":"John","email":"[email protected]"}'. The -H flag adds headers, -d sends the request body. For JSON, always set Content-Type header.
How do I include authentication in cURL?
For Basic auth: curl -u username:password https://api.example.com. For Bearer tokens: curl -H "Authorization: Bearer token123" https://api.example.com. For API keys: curl -H "X-API-Key: your-key" https://api.example.com. Never share credentials in public code.
How do I upload files with cURL?
Use -F for multipart form data: curl -F "file=@/path/to/file.txt" -F "description=My file" https://api.example.com/upload. The @ symbol reads from a file. For binary uploads: curl -T file.zip https://example.com/upload. Use -H "Content-Type: multipart/form-data" if needed.