Use this file to discover all available pages before exploring further.
Generating tenant tokens without a library is possible, but not recommended. This guide summarizes the necessary steps.The full process requires you to create a token header, prepare the data payload with at least one set of search rules, and then sign the token with an API key.
Next, find your default search API key. Query the get API keys endpoint and inspect the uid field to obtain your API key’s UID:
curl \ -X GET 'MEILISEARCH_URL/keys' \ -H 'Authorization: Bearer MASTER_KEY'
For maximum security, you should also set an expiry date for your tenant tokens. The following Node.js example configures the token to expire 20 minutes after its creation:
parseInt(Date.now() / 1000) + 20 * 60
Lastly, assemble all parts of the payload in a single object:
You must then encode both the header and the payload into base64, concatenate them, and generate the token by signing it using your chosen encryption algorithm.