curl
CLITransfer data from or to a server using various protocols.
Universal URL transfer tool supporting HTTP, FTP, SMTP and more
Verified commands
Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.
Get only the HTTP status code
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/Get the body and the status code together
curl -s -w '\n%{http_code}\n' https://example.com/POST JSON from a file
curl -sS -X POST -H 'Content-Type: application/json' -d @body.json https://api.example.com/itemsCommon failures (1)
- server reports invalid JSONinline -d '{...}' quoting broke; put the payload in a file and use -d @body.json
Fail the command on HTTP 4xx/5xx (for scripts)
curl -sSf https://api.example.com/healthCommon failures (1)
- exit code 22the server returned an HTTP error; drop -f to see the body
Follow redirects
curl -sL -o /dev/null -w '%{http_code}\n' https://example.com/redirectSend a bearer token
curl -s -H 'Authorization: Bearer TOKEN' https://api.example.com/meCall an API and pick a value with jq
curl -s https://api.example.com/data | jq '.items | length'More recipes
Curated from documentation and usage. Percentages are estimates, not measurements.
Download a file
curl -L -o output.zip https://example.com/file.zipInstall
apt
sudo apt install curlHomebrew
brew install curlAgent notes
- When to use
- Downloading files, calling APIs, scripting HTTP requests
- Quick examples
curl -s https://api.example.com/datacurl -X POST -d '{"key":"val"}' -H 'Content-Type: application/json' URL
Use from an agent
curl -s https://clihub.com/api/tools/curl | jq '.agentHints.provenRecipes[] | {task, command, verified}'Or call get_tool with slug curl on the MCP server at https://clihub.com/mcp.