Check only HTTP status code

Get just the response status code — useful in scripts

curl -so /dev/null -w '%{http_code}' https://example.com

tool
curl21 commands
tags
curlnetworkdebug

More curl commands

  • curl -X POST https://api.example.com/v1/items -H 'Content-Type: application/json' -d '{"name":"foo"}'

    Send JSON payload via POST

  • curl -H 'Authorization: Bearer $TOKEN' https://api.example.com/me

    Attach JWT/Bearer token in Authorization header

  • curl -Lv --max-redirs 5 https://example.com

    Follow up to 5 redirects and show full request/response

  • curl -sSL -o /tmp/result.json https://api.example.com/data

    Download silently, fail on error, follow redirects

  • curl -o /dev/null -sS -w 'ttfb: %{time_starttransfer}s\ntotal: %{time_total}s\n' https://example.com

    Benchmark TTFB and total request time

all 21 curl commands