Location-based text search
Written by
Updated at January 20, 2026
By default, Yandex Search API results are not linked to the user's location because queries are sent from Yandex Cloud servers. For geolocation-dependent search results, as in a browser, specify in the query parameters the IP address of the user you are going to use to get your search results.
Note
The IP address must be valid and public. Private subnet addresses do not affect search results.
API
-
Add the
X-Forwarded-For-Yfield to the request body in themetadata.fieldssection:body.json
... "metadata": { "fields": { "X-Forwarded-For-Y": "<user_IP_address>" } }, ...Where
X-Forwarded-For-Yis the user's IP address. -
Set the other request body parameters according to the specification.
-
Send the request and get the result. For more information, see Performing text search queries in deferred mode.