I have a web application that consists of a JavaScript frontend and a backend built with PHP, where the frontend makes some AJAX requests to the backend's URL, for example: api.examplesite.com?q=some_query
and the results are returned back in JSON format.
Anyone who knows this URL, could directly call it and get the same results.
What is the best practice to make this URL unreachable from third parties, but still working for my application?