Meilisearch’s tenant tokens are JSON web tokens (JWTs). Their payload is made of three elements: search rules, an API key UID, and an optional expiration date.Documentation Index
Fetch the complete documentation index at: https://www.meilisearch.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Example payload
Search rules
The search rules object is a set of instructions defining search parameters Meilisearch enforces in every query made with a specific tenant token.Search rules object
searchRules must be a JSON object. Each key must correspond to one or more indexes:
filter key. This filter’s value must be a filter expression:
searchRules object.
A token may contain rules for any number of indexes. Specific rulesets take precedence and overwrite * rules.
The search rule may also be an empty object. In this case, the tenant token will have access to all documents in an index:
Examples
Single filter
In this example, the user will only receivemedical_records documents whose user_id equals 1:
Multiple filters
In this example, the user will only receivemedical_records documents whose user_id equals 1 and whose published field equals true:
Give access to all documents in an index
In this example, the user has access to all documents inmedical_records:
Target multiple indexes with a partial wildcard
In this example, the user will receive documents from any index starting withmedical. This includes indexes such as medical_records and medical_patents:
Target all indexes with a wildcard
In this example, the user will receive documents from any index in the whole instance:Target multiple indexes manually
In this example, the user has access to documents withuser_id = 1 for all indexes, except one. When querying medical_records, the user will only have access to published documents:
API key UID
Tenant token payloads must include an API key UID to validate requests. The UID is an alphanumeric string identifying an API key:Expiry date
The expiry date must be a UNIX timestamp ornull: