skip to content
Alvin Lucillo

Display response headers and body with curl

/ 1 min read

By default, curl doesn’t return the response headers. To return the headers, use -i or --include

curl https://httpbin.org/get
{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Host": "httpbin.org",
    "User-Agent": "curl/8.5.0",
    "X-Amzn-Trace-Id": "Root=1-68cab17f-6e12663c67a549f475a0ddfc"
  },
  "origin": "180.190.74.102",
  "url": "https://httpbin.org/get"
}

Notice that there are headers here that weren’t present in the result above.

curl -i https://httpbin.org/get
HTTP/2 200
date: Wed, 17 Sep 2025 13:03:15 GMT
content-type: application/json
content-length: 255
server: gunicorn/19.9.0
access-control-allow-origin: *
access-control-allow-credentials: true

{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Host": "httpbin.org",
    "User-Agent": "curl/8.5.0",
    "X-Amzn-Trace-Id": "Root=1-68cab191-51f8173967c0ad4b72d1c147"
  },
  "origin": "180.190.74.102",
  "url": "https://httpbin.org/get"
}