curl

CLI

Transfer data from or to a server using various protocols.

Universal URL transfer tool supporting HTTP, FTP, SMTP and more

7 of 8 recipes verified by execution · 2026-09-17#http#download#upload#transfer

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

Verified macOS · Linux · 2026-09-17
curl -s -o /dev/null -w '%{http_code}\n' https://example.com/

Get the body and the status code together

Verified macOS · Linux · 2026-09-17
curl -s -w '\n%{http_code}\n' https://example.com/

POST JSON from a file

Verified macOS · Linux · 2026-09-17
curl -sS -X POST -H 'Content-Type: application/json' -d @body.json https://api.example.com/items
Common 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)

Verified macOS · Linux · 2026-09-17
curl -sSf https://api.example.com/health
Common failures (1)
  • exit code 22the server returned an HTTP error; drop -f to see the body

Follow redirects

Verified macOS · Linux · 2026-09-17
curl -sL -o /dev/null -w '%{http_code}\n' https://example.com/redirect

Send a bearer token

Verified macOS · Linux · 2026-09-17
curl -s -H 'Authorization: Bearer TOKEN' https://api.example.com/me

Call an API and pick a value with jq

Verified macOS · Linux · 2026-09-17
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

~98% est.
curl -L -o output.zip https://example.com/file.zip

Install

aptsudo apt install curl
Homebrewbrew install curl

Agent notes

When to use
Downloading files, calling APIs, scripting HTTP requests
Quick examples
  • curl -s https://api.example.com/data
  • curl -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.

Homepage ↗curl (MIT-like)0 views