Given that Referer and X-Request-With clicks are sent (or not sent) by the client (browser or anything else that can send an HTTP request), they cannot be trusted.
You can use them as tips to improve your user experience; but you must not rely on them to be either present or correct.
, , ( XmlHttpRequest: XHR ... , , , XHR).
( , /), - API-, ?