Get only the HTTP status code
Print just the response status code. Handy in scripts.
curl -so /dev/null -w '%{http_code}' https://example.com
- tool
- curl21 commands
More curl commands
-
curl -X POST https://api.example.com/v1/items -H 'Content-Type: application/json' -d '{"name":"foo"}'Send a JSON payload in a POST request.
-
curl -H 'Authorization: Bearer $TOKEN' https://api.example.com/meSend a JWT or Bearer token in the Authorization header.
-
curl -Lv --max-redirs 5 https://example.comFollow up to 5 redirects and show every request and response in detail.
-
curl -sSL -o /tmp/result.json https://api.example.com/dataDownload quietly and follow redirects, but still show errors.
-
curl -o /dev/null -sS -w 'ttfb: %{time_starttransfer}s\ntotal: %{time_total}s\n' https://example.comMeasure TTFB and the total request time.