This method lets you send the server a specific key-value pair (an extra HTTP header) with every query. This gives the API an additional header it can use in situations such as:Documentation Index
Fetch the complete documentation index at: https://algolia.com/llms.txt
Use this file to discover all available pages before exploring further.
- Setting
X-Forwarded-Forfor analytics. If your server sends the user’s IP address with every search, analytics can distinguish between users. Otherwise, analytics uses the server’s IP address, which doesn’t provide user details. Alternatively, see the followingX-Algolia-UserTokenexample. - Setting
X-Algolia-UserTokenfor analytics. The Analytics API uses the provided value to distinguish between users. It takes priority over any value inX-Forwarded-For. Use this header if you need to forward the user’s identity without relying on IP addresses. - Setting
X-Algolia-UserTokenfor API key rate limiting. - Setting
X-Forwarded-Forto ensure that geo-search locations use the user’s IP address, not your backend server’s. For an example of this, see thearoundLatLngViaIPparameter.
The
set extra header method will eventually be replaced by the request options parameter, allowing you to set the header as part of your query parameters.Examples
Parameters
Name of the header to add.
Value of the header to add.