Custom Headers

Add multiple custom headers

cURL Command

curl -H "X-API-Key: abc123" -H "Accept: application/json" -H "X-Request-ID: req-001" https://api.example.com/data

Flag-by-flag explanation

-H
Each -H adds one header; can be repeated

Python equivalent

import requests
headers = {"X-API-Key": "abc123", "Accept": "application/json", "X-Request-ID": "req-001"}
r = requests.get("https://api.example.com/data", headers=headers)

JavaScript fetch equivalent

await fetch("https://api.example.com/data", {
  headers: { "X-API-Key": "abc123", "Accept": "application/json", "X-Request-ID": "req-001" }
});

Related cURL examples

Tools

cURL Generator →