Back to HTTP Headers
Request

HTTP X-Requested-With Header

Identifies that the request was made with JavaScript (e.g., via XMLHttpRequest). Commonly used to distinguish AJAX requests from normal browser navigation.

Purpose

Allows servers to identify AJAX requests and apply different handling or security rules.

X-Requested-With: XMLHttpRequest Example: X-Requested-With: XMLHttpRequest

Code Examples

See how to use the X-Requested-With header in different tools and languages.

curl -H "X-Requested-With: XMLHttpRequest" https://api.example.com/data
# Some frameworks require this header for AJAX endpoints

Related Headers

Test Your APIs

x-requested-with headerhttp x-requested-withhttp headers guide