By providing Meilisearch with a master key at launch, you protect your instance from unauthorized requests. The provided master key must be at least 16 bytes. From then on, you must include the Authorization header along with a valid API key to access protected routes (all routes except /health.
Copy
# replace the MASTER_KEY placeholder with your master keycurl \ -X GET 'MEILISEARCH_URL/keys' \ -H 'Authorization: Bearer MASTER_KEY'
The /keys route can only be accessed using the master key. For security reasons, we recommend using regular API keys for all other routes.
v0.24 and below use the X-MEILI-API-KEY: apiKey authorization header:
Copy
curl \ -X GET 'http://<your-domain-name>/version' \ -H 'X-Meili-API-Key: API_KEY'
Meilisearch paginates all GET routes that return multiple resources, for example, GET /indexes, GET /documents, GET /keys, etc. This allows you to work with manageable chunks of data. All these routes return 20 results per page, but you can configure it using the limit query parameter. You can move between pages using offset.All paginated responses contain the following fields:
Since the /tasks endpoint uses a different type of pagination, the response contains different fields. You can read more about it in the tasks API reference.
Parameters are options you can pass to an API endpoint to modify its response. There are three main types of parameters in Meilisearch’s API: request body parameters, path parameters, and query parameters.
These parameters are mandatory parts of POST, PUT, and PATCH requests. They accept a wide variety of values and data types depending on the resource you’re modifying. You must add these parameters to your request’s data payload.
These are parameters you pass to the API in the endpoint’s path. They are used to identify a resource uniquely. You can have multiple path parameters, for example, /indexes/{index_uid}/documents/{document_id}.If an endpoint does not take any path parameters, this section is not present in that endpoint’s documentation.
These optional parameters are a sequence of key-value pairs and appear after the question mark (?) in the endpoint. You can list multiple query parameters by separating them with an ampersand (&). The order of query parameters does not matter. They are mostly used with GET endpoints.If an endpoint does not take any query parameters, this section is not present in that endpoint’s documentation.
Any API request with a payload (--data-binary) requires a Content-Type header. Content type headers indicate the media type of the resource, helping the client process the response body correctly.Meilisearch currently supports the following formats:
Content-Type: application/json for JSON
Content-Type: application/x-ndjson for NDJSON
Content-Type: text/csv for CSV
Only the add documents and update documents endpoints accept NDJSON and CSV. For all others, use Content-Type: application/json.
The Content-Encoding header indicates the media type is compressed by a given algorithm. Compression improves transfer speed and reduces bandwidth consumption by sending and receiving smaller payloads. The Accept-Encoding header, instead, indicates the compression algorithm the client understands.Meilisearch supports the following compression methods:
Primary key field name, if index has a primary key
remote
String
Remote instance name, if request targets a remote instance
A search refers to a single HTTP search request. Every search request is assigned a requestUid. A query UID is a combination of q and indexUid.In the context of multi-search, for any given searchUid there may be multiple queryUid values.
The request body is data sent to the API. It is used with PUT, POST, and PATCH methods to create or update a resource. You must provide request bodies in JSON.