🌐

HTTP Header Parser

Parse raw HTTP headers into structured key-value pairs with content-type analysis

POST /v1/http-header-parse
curl -X POST "https://dns.toolkitapi.io/v1/http-header-parse" \
  -H "Content-Type: application/json" \
  -d '{"headers": "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nCache-Control: max-age=3600\nX-Request-Id: abc123"}'
import httpx

resp = httpx.post(
    "https://dns.toolkitapi.io/v1/http-header-parse",
    json={"headers": "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nCache-Control: max-age=3600\nX-Request-Id: abc123"},
)
print(resp.json())
const resp = await fetch("https://dns.toolkitapi.io/v1/http-header-parse", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"headers": "HTTP/1.1 200 OK\nContent-Type: application/json; charset=utf-8\nCache-Control: max-age=3600\nX-Request-Id: abc123"}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
{
  "headers": {
    "Content-Type": "application/json; charset=utf-8",
    "Cache-Control": "max-age=3600",
    "X-Request-Id": "abc123"
  },
  "count": 3,
  "request_line": "HTTP/1.1 200 OK",
  "content_type": {
    "type": "application/json",
    "params": {"charset": "utf-8"}
  }
}

Try It Live

Live Demo

Description

Parse raw HTTP headers into structured key-value pairs with content-type analysis

How to Use

1

1. Send a POST with a JSON body containing the `headers` field — raw HTTP headers as a multi-line string.

2

2. The first line is automatically detected as a request or status line if it starts with `HTTP/` or contains ` HTTP/`.

3

3. Inspect `headers` for the parsed key-value pairs, `request_line` for the status/request line, and `content_type` for parsed media type details.

About This Tool

HTTP Header Parser takes raw HTTP headers (as you'd see in a `curl -v` dump or browser dev tools) and converts them into a structured JSON object. It automatically detects and separates the request/status line, parses all header key-value pairs, and extracts `Content-Type` details including media type and parameters.

Duplicate header names are collected into arrays.

Why Use This Tool

Frequently Asked Questions

How are duplicate headers handled?
Headers appearing multiple times are returned as an array of values. Single-occurrence headers are returned as strings.
Is the request/status line required?
No. If the first line doesn't match an HTTP request or status line pattern, all lines are treated as headers.
Which Content-Type details are extracted?
The media type is separated from parameters (like `charset`, `boundary`). This only applies when a `Content-Type` header is present.

Start using HTTP Header Parser now

Get your free API key and make your first request in under a minute.