> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/api-references/readme/api-reference-33/saved-searches.md). Agents can also search and read this documentation through its [MCP server](https://developer.emporix.io/~gitbook/mcp).

# Saved Searches

## Retrieving all saved searches

> !\[Preview]\(<https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview\\_api1.png)\\>
> \
> {% hint style="danger" %}\
> This functionality is in preview mode - some of the features may not be fully operational yet.\
> {% endhint %}\
> \
> Retrieves the saved searches for every searchable type on the tenant: custom schema types, \`customer\`, and \`legal-entity\`. Each item includes \`type\`.

```json
{"openapi":"3.0.0","info":{"title":"Search Service","version":"0.0.1"},"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["search.search_read"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"search.search_read":"Needed to search documents, to read saved searches, and to read search indexes and index jobs.","search.search_manage":"Needed to create, update, and delete saved searches and search indexes.","schema.custominstance_read":"Needed to read every custom entity instance. When this scope is absent, `custom.{type}_read` or `custom.{type}_read_own` can still allow the search.","customer.customer_read":"Needed to search every customer. A restricted form such as `customer.customer_read--DE#AT` returns only customers whose `restriction` matches one of the listed values.","customer.customer_read_own":"Needed to search only the caller's own customer.","customermanagement.legalentity_read":"Needed to search every legal entity. A restricted form such as `customermanagement.legalentity_read--DE#AT` returns only legal entities whose `restrictions` contain one of the listed values.","customermanagement.legalentity_read_own":"Needed to search only the caller's own legal entity."}}}}},"parameters":{"query_pageNumber":{"name":"pageNumber","in":"query","description":"Page number to be retrieved. The number of the first page is 1.\n","schema":{"default":1,"minimum":1,"type":"integer"}},"query_pageSize":{"name":"pageSize","in":"query","description":"Number of items to be retrieved per page.","schema":{"default":60,"minimum":1,"maximum":2000,"type":"integer"}},"query_sort_createdAt":{"name":"sort","in":"query","description":"Comma-separated list of properties used to sort the results. The order of properties indicates their priority.\n\nPossible values:\n\n* `{fieldName}`\n* `{fieldName}:ASC`\n* `{fieldName}:DESC`\n\nWhen the direction is omitted, the field is sorted in ascending order. When `sort` is omitted, results are ordered by `metadata.createdAt` descending.","schema":{"type":"string"}},"query_q":{"name":"q","in":"query","description":"A standard query parameter is used to search for specific values.\n\nSee: [Standard practises - Query parameter](https://developer.emporix.io/api-documentation/standard-practices/q-param)","schema":{"type":"string"}},"query_fields_query":{"name":"fields","in":"query","description":"Comma-separated list of saved search properties to return. When the parameter is omitted, the saved search is returned in full.","schema":{"type":"string"}},"header_Accept-Language":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of language codes acceptable for the response.\n\n* If the header is set to a language or a list of languages, the service returns the first requested language that has a translation. Localized fields are maps with that language code as the key.\n* If the header is set to `*`, localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the header is empty, localized fields are retrieved as maps containing a single translation, where the key is a language code and the value is the field in the specified language. The endpoint assumes that localized fields are to be retrieved in the tenant's default language defined in the Configuration Service.\n* If none of the requested languages has a translation, the localized fields are omitted from the response.\n"},"header_X-Total-Count":{"name":"X-Total-Count","in":"header","required":false,"description":"Flag indicating whether the total count of retrieved items should be returned.","schema":{"default":false,"type":"boolean"}}},"schemas":{"SavedQuery":{"type":"object","description":"One stored saved search. The request field `index` is returned as `indexId`. `queries` is one query node. A list sent on save is returned as one `or` group.","properties":{"id":{"type":"string","description":"Saved search id."},"name":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized name of the saved search."},"description":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized description of the saved search."},"type":{"type":"string","description":"Type this saved search belongs to. A custom schema type, `customer`, or `legal-entity`."},"indexId":{"type":"string","description":"Id of the search index this saved search uses."},"queries":{"$ref":"#/components/schemas/QueryNode"},"filters":{"$ref":"#/components/schemas/FilterNode"},"metadata":{"$ref":"#/components/schemas/ResourceMetadata"}}},"QueryNode":{"type":"object","description":"One query node. A node is an `and` group, an `or` group, or one query. Do not combine those forms in the same object.","properties":{"and":{"type":"array","description":"Every child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"or":{"type":"array","description":"Any child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"type":{"$ref":"#/components/schemas/SearchType"},"query":{"type":"string","description":"Text or pattern to match."},"field":{"type":"string","description":"Document field to match. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. The list path itself cannot be searched."},"boost":{"type":"number","minimum":0,"exclusiveMinimum":true,"default":1,"description":"Score multiplier for matches on this field. The default is 1."},"fuzzy":{"$ref":"#/components/schemas/Fuzzy"},"analyzer":{"type":"string","description":"Optional analyzer for this clause. Allowed only when `type` is `TEXT` or `PHRASE`.\n\nThe value is the field's `analyzer`, or one name from that field's `additionalAnalyzers`. The name is not case-sensitive. When omitted, the query uses the field's `analyzer`."}}},"SearchType":{"type":"string","description":"Match mode.\n\n* `TEXT` matches the query tokens.\n* `PHRASE` matches the query as adjacent words in order.\n* `AUTOCOMPLETE` matches the index field's autocomplete mode. `PREFIX` matches the start of a word. `NGRAM` matches a character sequence inside a word.\n* `WILDCARD` matches a pattern. `*` matches any number of characters. `?` matches one character. Fuzzy matching is not supported.","enum":["TEXT","PHRASE","AUTOCOMPLETE","WILDCARD"]},"Fuzzy":{"type":"object","description":"Edit-distance matching. Supported only when `type` is `TEXT` and `enabled` is `true`.","properties":{"enabled":{"type":"boolean","description":"When `true`, matches that are one or two edits from the query are included."},"maxEdits":{"type":"integer","description":"Maximum edit distance. Required when `enabled` is `true`. Allowed values are 1 and 2.","enum":[1,2]}}},"FilterNode":{"type":"object","description":"One filter node. A node is an `and` group, an `or` group, or a comparison. Do not combine those forms in the same object.\n\nComparison fields must be indexed on the index named by `index`.","properties":{"and":{"type":"array","minItems":1,"description":"Every child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"or":{"type":"array","minItems":1,"description":"At least one child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"field":{"type":"string","description":"Document field to compare. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. A lone `NEQ`, `NOT_IN`, or `EXISTS` `false` on a list excludes the document when any item matches the value. A document with no items in that list matches. The same operator joined by `and` with another condition on that list still applies to one item. The list path itself cannot be searched."},"operator":{"$ref":"#/components/schemas/FilterOperator"},"value":{"description":"Comparison value. The shape depends on `operator`.\n\n* `EQ`, `NEQ`, `GT`, `GTE`, `LT`, and `LTE` require one value.\n* `BETWEEN` requires an array of two values. The range is inclusive.\n* `IN` and `NOT_IN` require a non-empty array.\n* `EXISTS` requires a boolean. `true` matches documents where the field is present. `false` matches documents where the field is absent.\n* `CONTAINS` requires a non-blank string. The field must have `text: true` in the index."}}},"FilterOperator":{"type":"string","description":"Comparison applied to `field` and `value`.\n\n`CONTAINS` performs a case- and diacritic-insensitive substring match. The service wraps the value in `*` and escapes `\\`, `*`, and `?` within it. Spaces remain part of the value.","enum":["EQ","NEQ","GT","GTE","LT","LTE","BETWEEN","IN","NOT_IN","EXISTS","CONTAINS"]},"ResourceMetadata":{"type":"object","description":"Version and timestamps for a stored resource.","properties":{"version":{"type":"integer","description":"Stored version. The first version is 1."},"createdAt":{"type":"string","format":"date-time","description":"Time when the resource was created."},"modifiedAt":{"type":"string","format":"date-time","description":"Time when the resource was last modified."}}},"ErrorMessageFault":{"type":"object","description":"Authorization error returned by the API gateway.","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string","description":"Authorization failure."},"detail":{"type":"object","properties":{"errorcode":{"type":"string","description":"Gateway error code."}}}}}}},"ErrorMessage":{"type":"object","description":"Error returned for a failed request.","properties":{"code":{"type":"integer","description":"HTTP status code."},"status":{"type":"string","description":"HTTP status code as text."},"message":{"type":"string","description":"Explanation of the failure."},"details":{"type":"array","description":"Field-level or scope-level messages, when the failure has more than one part.","items":{"type":"object","properties":{"message":{"type":"string","description":"One part of the failure."}}}}}}},"responses":{"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_search_read":{"description":"The access token does not include `search.search_read`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500_resp_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/search/{tenant}/search/queries":{"get":{"summary":"Retrieving all saved searches","operationId":"GET-search-tenant-queries","tags":["Saved Searches"],"description":"![Preview](https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview_api1.png)\n\n{% hint style=\"danger\" %}\nThis functionality is in preview mode - some of the features may not be fully operational yet.\n{% endhint %}\n\nRetrieves the saved searches for every searchable type on the tenant: custom schema types, `customer`, and `legal-entity`. Each item includes `type`.","parameters":[{"$ref":"#/components/parameters/query_pageNumber"},{"$ref":"#/components/parameters/query_pageSize"},{"$ref":"#/components/parameters/query_sort_createdAt"},{"$ref":"#/components/parameters/query_q"},{"$ref":"#/components/parameters/query_fields_query"},{"$ref":"#/components/parameters/header_Accept-Language"},{"$ref":"#/components/parameters/header_X-Total-Count"}],"responses":{"200":{"description":"The request succeeded. The body is the current page of saved searches.","headers":{"X-Total-Count":{"description":"Number of saved searches. Present only when the request `X-Total-Count` header is `true`.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SavedQuery"}}}}},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_search_read"},"500":{"$ref":"#/components/responses/500_resp_common"}}}}}}
```

## Retrieving saved searches

> !\[Preview]\(<https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview\\_api1.png)\\>
> \
> {% hint style="danger" %}\
> This functionality is in preview mode - some of the features may not be fully operational yet.\
> {% endhint %}\
> \
> Retrieves the saved searches for one type.\
> \
> When \`sort\` is omitted, saved searches are ordered by \`metadata.createdAt\` descending. When the \`X-Total-Count\` request header is \`true\`, the response includes the \`X-Total-Count\` header with the number of saved searches. The response body stays an array.

```json
{"openapi":"3.0.0","info":{"title":"Search Service","version":"0.0.1"},"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["search.search_read"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"search.search_read":"Needed to search documents, to read saved searches, and to read search indexes and index jobs.","search.search_manage":"Needed to create, update, and delete saved searches and search indexes.","schema.custominstance_read":"Needed to read every custom entity instance. When this scope is absent, `custom.{type}_read` or `custom.{type}_read_own` can still allow the search.","customer.customer_read":"Needed to search every customer. A restricted form such as `customer.customer_read--DE#AT` returns only customers whose `restriction` matches one of the listed values.","customer.customer_read_own":"Needed to search only the caller's own customer.","customermanagement.legalentity_read":"Needed to search every legal entity. A restricted form such as `customermanagement.legalentity_read--DE#AT` returns only legal entities whose `restrictions` contain one of the listed values.","customermanagement.legalentity_read_own":"Needed to search only the caller's own legal entity."}}}}},"parameters":{"query_pageNumber":{"name":"pageNumber","in":"query","description":"Page number to be retrieved. The number of the first page is 1.\n","schema":{"default":1,"minimum":1,"type":"integer"}},"query_pageSize":{"name":"pageSize","in":"query","description":"Number of items to be retrieved per page.","schema":{"default":60,"minimum":1,"maximum":2000,"type":"integer"}},"query_sort_createdAt":{"name":"sort","in":"query","description":"Comma-separated list of properties used to sort the results. The order of properties indicates their priority.\n\nPossible values:\n\n* `{fieldName}`\n* `{fieldName}:ASC`\n* `{fieldName}:DESC`\n\nWhen the direction is omitted, the field is sorted in ascending order. When `sort` is omitted, results are ordered by `metadata.createdAt` descending.","schema":{"type":"string"}},"query_q":{"name":"q","in":"query","description":"A standard query parameter is used to search for specific values.\n\nSee: [Standard practises - Query parameter](https://developer.emporix.io/api-documentation/standard-practices/q-param)","schema":{"type":"string"}},"query_fields_query":{"name":"fields","in":"query","description":"Comma-separated list of saved search properties to return. When the parameter is omitted, the saved search is returned in full.","schema":{"type":"string"}},"header_Accept-Language":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of language codes acceptable for the response.\n\n* If the header is set to a language or a list of languages, the service returns the first requested language that has a translation. Localized fields are maps with that language code as the key.\n* If the header is set to `*`, localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the header is empty, localized fields are retrieved as maps containing a single translation, where the key is a language code and the value is the field in the specified language. The endpoint assumes that localized fields are to be retrieved in the tenant's default language defined in the Configuration Service.\n* If none of the requested languages has a translation, the localized fields are omitted from the response.\n"},"header_X-Total-Count":{"name":"X-Total-Count","in":"header","required":false,"description":"Flag indicating whether the total count of retrieved items should be returned.","schema":{"default":false,"type":"boolean"}}},"schemas":{"SavedQuery":{"type":"object","description":"One stored saved search. The request field `index` is returned as `indexId`. `queries` is one query node. A list sent on save is returned as one `or` group.","properties":{"id":{"type":"string","description":"Saved search id."},"name":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized name of the saved search."},"description":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized description of the saved search."},"type":{"type":"string","description":"Type this saved search belongs to. A custom schema type, `customer`, or `legal-entity`."},"indexId":{"type":"string","description":"Id of the search index this saved search uses."},"queries":{"$ref":"#/components/schemas/QueryNode"},"filters":{"$ref":"#/components/schemas/FilterNode"},"metadata":{"$ref":"#/components/schemas/ResourceMetadata"}}},"QueryNode":{"type":"object","description":"One query node. A node is an `and` group, an `or` group, or one query. Do not combine those forms in the same object.","properties":{"and":{"type":"array","description":"Every child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"or":{"type":"array","description":"Any child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"type":{"$ref":"#/components/schemas/SearchType"},"query":{"type":"string","description":"Text or pattern to match."},"field":{"type":"string","description":"Document field to match. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. The list path itself cannot be searched."},"boost":{"type":"number","minimum":0,"exclusiveMinimum":true,"default":1,"description":"Score multiplier for matches on this field. The default is 1."},"fuzzy":{"$ref":"#/components/schemas/Fuzzy"},"analyzer":{"type":"string","description":"Optional analyzer for this clause. Allowed only when `type` is `TEXT` or `PHRASE`.\n\nThe value is the field's `analyzer`, or one name from that field's `additionalAnalyzers`. The name is not case-sensitive. When omitted, the query uses the field's `analyzer`."}}},"SearchType":{"type":"string","description":"Match mode.\n\n* `TEXT` matches the query tokens.\n* `PHRASE` matches the query as adjacent words in order.\n* `AUTOCOMPLETE` matches the index field's autocomplete mode. `PREFIX` matches the start of a word. `NGRAM` matches a character sequence inside a word.\n* `WILDCARD` matches a pattern. `*` matches any number of characters. `?` matches one character. Fuzzy matching is not supported.","enum":["TEXT","PHRASE","AUTOCOMPLETE","WILDCARD"]},"Fuzzy":{"type":"object","description":"Edit-distance matching. Supported only when `type` is `TEXT` and `enabled` is `true`.","properties":{"enabled":{"type":"boolean","description":"When `true`, matches that are one or two edits from the query are included."},"maxEdits":{"type":"integer","description":"Maximum edit distance. Required when `enabled` is `true`. Allowed values are 1 and 2.","enum":[1,2]}}},"FilterNode":{"type":"object","description":"One filter node. A node is an `and` group, an `or` group, or a comparison. Do not combine those forms in the same object.\n\nComparison fields must be indexed on the index named by `index`.","properties":{"and":{"type":"array","minItems":1,"description":"Every child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"or":{"type":"array","minItems":1,"description":"At least one child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"field":{"type":"string","description":"Document field to compare. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. A lone `NEQ`, `NOT_IN`, or `EXISTS` `false` on a list excludes the document when any item matches the value. A document with no items in that list matches. The same operator joined by `and` with another condition on that list still applies to one item. The list path itself cannot be searched."},"operator":{"$ref":"#/components/schemas/FilterOperator"},"value":{"description":"Comparison value. The shape depends on `operator`.\n\n* `EQ`, `NEQ`, `GT`, `GTE`, `LT`, and `LTE` require one value.\n* `BETWEEN` requires an array of two values. The range is inclusive.\n* `IN` and `NOT_IN` require a non-empty array.\n* `EXISTS` requires a boolean. `true` matches documents where the field is present. `false` matches documents where the field is absent.\n* `CONTAINS` requires a non-blank string. The field must have `text: true` in the index."}}},"FilterOperator":{"type":"string","description":"Comparison applied to `field` and `value`.\n\n`CONTAINS` performs a case- and diacritic-insensitive substring match. The service wraps the value in `*` and escapes `\\`, `*`, and `?` within it. Spaces remain part of the value.","enum":["EQ","NEQ","GT","GTE","LT","LTE","BETWEEN","IN","NOT_IN","EXISTS","CONTAINS"]},"ResourceMetadata":{"type":"object","description":"Version and timestamps for a stored resource.","properties":{"version":{"type":"integer","description":"Stored version. The first version is 1."},"createdAt":{"type":"string","format":"date-time","description":"Time when the resource was created."},"modifiedAt":{"type":"string","format":"date-time","description":"Time when the resource was last modified."}}},"ErrorMessageFault":{"type":"object","description":"Authorization error returned by the API gateway.","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string","description":"Authorization failure."},"detail":{"type":"object","properties":{"errorcode":{"type":"string","description":"Gateway error code."}}}}}}},"ErrorMessage":{"type":"object","description":"Error returned for a failed request.","properties":{"code":{"type":"integer","description":"HTTP status code."},"status":{"type":"string","description":"HTTP status code as text."},"message":{"type":"string","description":"Explanation of the failure."},"details":{"type":"array","description":"Field-level or scope-level messages, when the failure has more than one part.","items":{"type":"object","properties":{"message":{"type":"string","description":"One part of the failure."}}}}}}},"responses":{"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_search_read":{"description":"The access token does not include `search.search_read`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500_resp_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/search/{tenant}/search/{type}/queries":{"get":{"summary":"Retrieving saved searches","operationId":"GET-search-tenant-type-queries","tags":["Saved Searches"],"description":"![Preview](https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview_api1.png)\n\n{% hint style=\"danger\" %}\nThis functionality is in preview mode - some of the features may not be fully operational yet.\n{% endhint %}\n\nRetrieves the saved searches for one type.\n\nWhen `sort` is omitted, saved searches are ordered by `metadata.createdAt` descending. When the `X-Total-Count` request header is `true`, the response includes the `X-Total-Count` header with the number of saved searches. The response body stays an array.","parameters":[{"$ref":"#/components/parameters/query_pageNumber"},{"$ref":"#/components/parameters/query_pageSize"},{"$ref":"#/components/parameters/query_sort_createdAt"},{"$ref":"#/components/parameters/query_q"},{"$ref":"#/components/parameters/query_fields_query"},{"$ref":"#/components/parameters/header_Accept-Language"},{"$ref":"#/components/parameters/header_X-Total-Count"}],"responses":{"200":{"description":"The request succeeded. The body is the current page of saved searches.","headers":{"X-Total-Count":{"description":"Number of saved searches. Present only when the request `X-Total-Count` header is `true`.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SavedQuery"}}}}},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_search_read"},"500":{"$ref":"#/components/responses/500_resp_common"}}}}}}
```

## Retrieving a saved search

> !\[Preview]\(<https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview\\_api1.png)\\>
> \
> {% hint style="danger" %}\
> This functionality is in preview mode - some of the features may not be fully operational yet.\
> {% endhint %}\
> \
> Retrieves one saved search.

```json
{"openapi":"3.0.0","info":{"title":"Search Service","version":"0.0.1"},"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["search.search_read"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"search.search_read":"Needed to search documents, to read saved searches, and to read search indexes and index jobs.","search.search_manage":"Needed to create, update, and delete saved searches and search indexes.","schema.custominstance_read":"Needed to read every custom entity instance. When this scope is absent, `custom.{type}_read` or `custom.{type}_read_own` can still allow the search.","customer.customer_read":"Needed to search every customer. A restricted form such as `customer.customer_read--DE#AT` returns only customers whose `restriction` matches one of the listed values.","customer.customer_read_own":"Needed to search only the caller's own customer.","customermanagement.legalentity_read":"Needed to search every legal entity. A restricted form such as `customermanagement.legalentity_read--DE#AT` returns only legal entities whose `restrictions` contain one of the listed values.","customermanagement.legalentity_read_own":"Needed to search only the caller's own legal entity."}}}}},"parameters":{"query_fields_query":{"name":"fields","in":"query","description":"Comma-separated list of saved search properties to return. When the parameter is omitted, the saved search is returned in full.","schema":{"type":"string"}},"header_Accept-Language":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string"},"description":"List of language codes acceptable for the response.\n\n* If the header is set to a language or a list of languages, the service returns the first requested language that has a translation. Localized fields are maps with that language code as the key.\n* If the header is set to `*`, localized fields are retrieved as maps of translations, where the keys are language codes and values are the fields in their respective languages.\n* If the header is empty, localized fields are retrieved as maps containing a single translation, where the key is a language code and the value is the field in the specified language. The endpoint assumes that localized fields are to be retrieved in the tenant's default language defined in the Configuration Service.\n* If none of the requested languages has a translation, the localized fields are omitted from the response.\n"}},"schemas":{"SavedQuery":{"type":"object","description":"One stored saved search. The request field `index` is returned as `indexId`. `queries` is one query node. A list sent on save is returned as one `or` group.","properties":{"id":{"type":"string","description":"Saved search id."},"name":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized name of the saved search."},"description":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized description of the saved search."},"type":{"type":"string","description":"Type this saved search belongs to. A custom schema type, `customer`, or `legal-entity`."},"indexId":{"type":"string","description":"Id of the search index this saved search uses."},"queries":{"$ref":"#/components/schemas/QueryNode"},"filters":{"$ref":"#/components/schemas/FilterNode"},"metadata":{"$ref":"#/components/schemas/ResourceMetadata"}}},"QueryNode":{"type":"object","description":"One query node. A node is an `and` group, an `or` group, or one query. Do not combine those forms in the same object.","properties":{"and":{"type":"array","description":"Every child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"or":{"type":"array","description":"Any child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"type":{"$ref":"#/components/schemas/SearchType"},"query":{"type":"string","description":"Text or pattern to match."},"field":{"type":"string","description":"Document field to match. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. The list path itself cannot be searched."},"boost":{"type":"number","minimum":0,"exclusiveMinimum":true,"default":1,"description":"Score multiplier for matches on this field. The default is 1."},"fuzzy":{"$ref":"#/components/schemas/Fuzzy"},"analyzer":{"type":"string","description":"Optional analyzer for this clause. Allowed only when `type` is `TEXT` or `PHRASE`.\n\nThe value is the field's `analyzer`, or one name from that field's `additionalAnalyzers`. The name is not case-sensitive. When omitted, the query uses the field's `analyzer`."}}},"SearchType":{"type":"string","description":"Match mode.\n\n* `TEXT` matches the query tokens.\n* `PHRASE` matches the query as adjacent words in order.\n* `AUTOCOMPLETE` matches the index field's autocomplete mode. `PREFIX` matches the start of a word. `NGRAM` matches a character sequence inside a word.\n* `WILDCARD` matches a pattern. `*` matches any number of characters. `?` matches one character. Fuzzy matching is not supported.","enum":["TEXT","PHRASE","AUTOCOMPLETE","WILDCARD"]},"Fuzzy":{"type":"object","description":"Edit-distance matching. Supported only when `type` is `TEXT` and `enabled` is `true`.","properties":{"enabled":{"type":"boolean","description":"When `true`, matches that are one or two edits from the query are included."},"maxEdits":{"type":"integer","description":"Maximum edit distance. Required when `enabled` is `true`. Allowed values are 1 and 2.","enum":[1,2]}}},"FilterNode":{"type":"object","description":"One filter node. A node is an `and` group, an `or` group, or a comparison. Do not combine those forms in the same object.\n\nComparison fields must be indexed on the index named by `index`.","properties":{"and":{"type":"array","minItems":1,"description":"Every child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"or":{"type":"array","minItems":1,"description":"At least one child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"field":{"type":"string","description":"Document field to compare. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. A lone `NEQ`, `NOT_IN`, or `EXISTS` `false` on a list excludes the document when any item matches the value. A document with no items in that list matches. The same operator joined by `and` with another condition on that list still applies to one item. The list path itself cannot be searched."},"operator":{"$ref":"#/components/schemas/FilterOperator"},"value":{"description":"Comparison value. The shape depends on `operator`.\n\n* `EQ`, `NEQ`, `GT`, `GTE`, `LT`, and `LTE` require one value.\n* `BETWEEN` requires an array of two values. The range is inclusive.\n* `IN` and `NOT_IN` require a non-empty array.\n* `EXISTS` requires a boolean. `true` matches documents where the field is present. `false` matches documents where the field is absent.\n* `CONTAINS` requires a non-blank string. The field must have `text: true` in the index."}}},"FilterOperator":{"type":"string","description":"Comparison applied to `field` and `value`.\n\n`CONTAINS` performs a case- and diacritic-insensitive substring match. The service wraps the value in `*` and escapes `\\`, `*`, and `?` within it. Spaces remain part of the value.","enum":["EQ","NEQ","GT","GTE","LT","LTE","BETWEEN","IN","NOT_IN","EXISTS","CONTAINS"]},"ResourceMetadata":{"type":"object","description":"Version and timestamps for a stored resource.","properties":{"version":{"type":"integer","description":"Stored version. The first version is 1."},"createdAt":{"type":"string","format":"date-time","description":"Time when the resource was created."},"modifiedAt":{"type":"string","format":"date-time","description":"Time when the resource was last modified."}}},"ErrorMessageFault":{"type":"object","description":"Authorization error returned by the API gateway.","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string","description":"Authorization failure."},"detail":{"type":"object","properties":{"errorcode":{"type":"string","description":"Gateway error code."}}}}}}},"ErrorMessage":{"type":"object","description":"Error returned for a failed request.","properties":{"code":{"type":"integer","description":"HTTP status code."},"status":{"type":"string","description":"HTTP status code as text."},"message":{"type":"string","description":"Explanation of the failure."},"details":{"type":"array","description":"Field-level or scope-level messages, when the failure has more than one part.","items":{"type":"object","properties":{"message":{"type":"string","description":"One part of the failure."}}}}}}},"responses":{"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_search_read":{"description":"The access token does not include `search.search_read`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500_resp_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/search/{tenant}/search/{type}/queries/{id}":{"get":{"summary":"Retrieving a saved search","operationId":"GET-search-tenant-type-queries-id","tags":["Saved Searches"],"description":"![Preview](https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview_api1.png)\n\n{% hint style=\"danger\" %}\nThis functionality is in preview mode - some of the features may not be fully operational yet.\n{% endhint %}\n\nRetrieves one saved search.","parameters":[{"$ref":"#/components/parameters/query_fields_query"},{"$ref":"#/components/parameters/header_Accept-Language"}],"responses":{"200":{"description":"The request succeeded. The body is the saved search.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedQuery"}}}},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_search_read"},"404":{"description":"No saved search with this id exists for the type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"$ref":"#/components/responses/500_resp_common"}}}}}}
```

## Upserting a saved search

> !\[Preview]\(<https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview\\_api1.png)\\>
> \
> {% hint style="danger" %}\
> This functionality is in preview mode - some of the features may not be fully operational yet.\
> {% endhint %}\
> \
> Creates or replaces the saved search identified by \`{id}\` for one type. Unknown properties in the body are ignored. Saving does not start an index build.\
> \
> A new saved search returns \`201 Created\` and the saved search id. Replacing an existing saved search returns \`204 No Content\`. \`index\` must already exist for this type. The body must include \`queries\`, \`filters\`, or both.\
> \
> \`metadata\` can be omitted when the saved search is created. An update requires \`metadata.version\`.

```json
{"openapi":"3.0.0","info":{"title":"Search Service","version":"0.0.1"},"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["search.search_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"search.search_read":"Needed to search documents, to read saved searches, and to read search indexes and index jobs.","search.search_manage":"Needed to create, update, and delete saved searches and search indexes.","schema.custominstance_read":"Needed to read every custom entity instance. When this scope is absent, `custom.{type}_read` or `custom.{type}_read_own` can still allow the search.","customer.customer_read":"Needed to search every customer. A restricted form such as `customer.customer_read--DE#AT` returns only customers whose `restriction` matches one of the listed values.","customer.customer_read_own":"Needed to search only the caller's own customer.","customermanagement.legalentity_read":"Needed to search every legal entity. A restricted form such as `customermanagement.legalentity_read--DE#AT` returns only legal entities whose `restrictions` contain one of the listed values.","customermanagement.legalentity_read_own":"Needed to search only the caller's own legal entity."}}}}},"parameters":{"header_Content-Language":{"name":"Content-Language","in":"header","required":false,"description":"Language of the localized `name` and `description` in the request body. Each language key in those maps must be configured for the tenant.","schema":{"type":"string"}}},"schemas":{"SavedQueryRequest":{"type":"object","description":"Definition of a saved search. Unknown properties are ignored. The body must include `queries`, `filters`, or both. `index` must already exist for the type.","properties":{"id":{"type":"string","description":"Saved search id. Optional. When it is present, it must equal the `{id}` path parameter."},"name":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized name of the saved search."},"description":{"type":"object","additionalProperties":{"type":"string"},"description":"Localized description of the saved search."},"index":{"type":"string","description":"Id of the search index this saved search uses."},"queries":{"description":"Queries stored with the saved search. A list is stored as one `or` group. A single query object is stored unchanged.","oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/QueryNode"}},{"$ref":"#/components/schemas/QueryNode"}]},"filters":{"$ref":"#/components/schemas/FilterNode"},"metadata":{"$ref":"#/components/schemas/QueryMetadataRequest"}},"required":["index"],"anyOf":[{"required":["queries"]},{"required":["filters"]}]},"QueryNode":{"type":"object","description":"One query node. A node is an `and` group, an `or` group, or one query. Do not combine those forms in the same object.","properties":{"and":{"type":"array","description":"Every child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"or":{"type":"array","description":"Any child must match.","items":{"$ref":"#/components/schemas/QueryNode"}},"type":{"$ref":"#/components/schemas/SearchType"},"query":{"type":"string","description":"Text or pattern to match."},"field":{"type":"string","description":"Document field to match. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. The list path itself cannot be searched."},"boost":{"type":"number","minimum":0,"exclusiveMinimum":true,"default":1,"description":"Score multiplier for matches on this field. The default is 1."},"fuzzy":{"$ref":"#/components/schemas/Fuzzy"},"analyzer":{"type":"string","description":"Optional analyzer for this clause. Allowed only when `type` is `TEXT` or `PHRASE`.\n\nThe value is the field's `analyzer`, or one name from that field's `additionalAnalyzers`. The name is not case-sensitive. When omitted, the query uses the field's `analyzer`."}}},"SearchType":{"type":"string","description":"Match mode.\n\n* `TEXT` matches the query tokens.\n* `PHRASE` matches the query as adjacent words in order.\n* `AUTOCOMPLETE` matches the index field's autocomplete mode. `PREFIX` matches the start of a word. `NGRAM` matches a character sequence inside a word.\n* `WILDCARD` matches a pattern. `*` matches any number of characters. `?` matches one character. Fuzzy matching is not supported.","enum":["TEXT","PHRASE","AUTOCOMPLETE","WILDCARD"]},"Fuzzy":{"type":"object","description":"Edit-distance matching. Supported only when `type` is `TEXT` and `enabled` is `true`.","properties":{"enabled":{"type":"boolean","description":"When `true`, matches that are one or two edits from the query are included."},"maxEdits":{"type":"integer","description":"Maximum edit distance. Required when `enabled` is `true`. Allowed values are 1 and 2.","enum":[1,2]}}},"FilterNode":{"type":"object","description":"One filter node. A node is an `and` group, an `or` group, or a comparison. Do not combine those forms in the same object.\n\nComparison fields must be indexed on the index named by `index`.","properties":{"and":{"type":"array","minItems":1,"description":"Every child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"or":{"type":"array","minItems":1,"description":"At least one child must match. The group must not be empty.","items":{"$ref":"#/components/schemas/FilterNode"}},"field":{"type":"string","description":"Document field to compare. `id` is stored as `_id`. A field inside `itemFields` uses its full path, such as `addresses.city`. Conditions on one list joined by `and` must match the same item. A lone `NEQ`, `NOT_IN`, or `EXISTS` `false` on a list excludes the document when any item matches the value. A document with no items in that list matches. The same operator joined by `and` with another condition on that list still applies to one item. The list path itself cannot be searched."},"operator":{"$ref":"#/components/schemas/FilterOperator"},"value":{"description":"Comparison value. The shape depends on `operator`.\n\n* `EQ`, `NEQ`, `GT`, `GTE`, `LT`, and `LTE` require one value.\n* `BETWEEN` requires an array of two values. The range is inclusive.\n* `IN` and `NOT_IN` require a non-empty array.\n* `EXISTS` requires a boolean. `true` matches documents where the field is present. `false` matches documents where the field is absent.\n* `CONTAINS` requires a non-blank string. The field must have `text: true` in the index."}}},"FilterOperator":{"type":"string","description":"Comparison applied to `field` and `value`.\n\n`CONTAINS` performs a case- and diacritic-insensitive substring match. The service wraps the value in `*` and escapes `\\`, `*`, and `?` within it. Spaces remain part of the value.","enum":["EQ","NEQ","GT","GTE","LT","LTE","BETWEEN","IN","NOT_IN","EXISTS","CONTAINS"]},"QueryMetadataRequest":{"type":"object","description":"Optimistic lock for a saved search update. Required when the saved search already exists.","properties":{"version":{"type":"integer","minimum":1,"description":"Current stored version. Required on update. A missing version on update returns 400. A version that does not match the stored saved search returns 409."}},"required":["version"]},"SavedQueryId":{"type":"object","description":"Identifier of a created saved search.","properties":{"id":{"type":"string","description":"Saved search id."}},"required":["id"]},"ErrorMessage":{"type":"object","description":"Error returned for a failed request.","properties":{"code":{"type":"integer","description":"HTTP status code."},"status":{"type":"string","description":"HTTP status code as text."},"message":{"type":"string","description":"Explanation of the failure."},"details":{"type":"array","description":"Field-level or scope-level messages, when the failure has more than one part.","items":{"type":"object","properties":{"message":{"type":"string","description":"One part of the failure."}}}}}},"ErrorMessageFault":{"type":"object","description":"Authorization error returned by the API gateway.","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string","description":"Authorization failure."},"detail":{"type":"object","properties":{"errorcode":{"type":"string","description":"Gateway error code."}}}}}}}},"responses":{"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_search_manage":{"description":"The access token does not include `search.search_manage`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500_resp_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/search/{tenant}/search/{type}/queries/{id}":{"put":{"summary":"Upserting a saved search","operationId":"PUT-search-tenant-type-queries-id","tags":["Saved Searches"],"description":"![Preview](https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview_api1.png)\n\n{% hint style=\"danger\" %}\nThis functionality is in preview mode - some of the features may not be fully operational yet.\n{% endhint %}\n\nCreates or replaces the saved search identified by `{id}` for one type. Unknown properties in the body are ignored. Saving does not start an index build.\n\nA new saved search returns `201 Created` and the saved search id. Replacing an existing saved search returns `204 No Content`. `index` must already exist for this type. The body must include `queries`, `filters`, or both.\n\n`metadata` can be omitted when the saved search is created. An update requires `metadata.version`.","parameters":[{"$ref":"#/components/parameters/header_Content-Language"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedQueryRequest"}}}},"responses":{"201":{"description":"The saved search was created. The body is the saved search id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedQueryId"}}}},"204":{"description":"The saved search was replaced. The response has no body."},"400":{"description":"The saved search id, criteria, or metadata version is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_search_manage"},"404":{"description":"No index with the id in `index` exists for this type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"409":{"description":"`metadata.version` does not match the stored saved search.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"$ref":"#/components/responses/500_resp_common"}}}}}}
```

## Deleting a saved search

> !\[Preview]\(<https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview\\_api1.png)\\>
> \
> {% hint style="danger" %}\
> This functionality is in preview mode - some of the features may not be fully operational yet.\
> {% endhint %}\
> \
> Deletes one saved search. Deleting does not start an index build.

```json
{"openapi":"3.0.0","info":{"title":"Search Service","version":"0.0.1"},"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["search.search_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"search.search_read":"Needed to search documents, to read saved searches, and to read search indexes and index jobs.","search.search_manage":"Needed to create, update, and delete saved searches and search indexes.","schema.custominstance_read":"Needed to read every custom entity instance. When this scope is absent, `custom.{type}_read` or `custom.{type}_read_own` can still allow the search.","customer.customer_read":"Needed to search every customer. A restricted form such as `customer.customer_read--DE#AT` returns only customers whose `restriction` matches one of the listed values.","customer.customer_read_own":"Needed to search only the caller's own customer.","customermanagement.legalentity_read":"Needed to search every legal entity. A restricted form such as `customermanagement.legalentity_read--DE#AT` returns only legal entities whose `restrictions` contain one of the listed values.","customermanagement.legalentity_read_own":"Needed to search only the caller's own legal entity."}}}}},"responses":{"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_search_manage":{"description":"The access token does not include `search.search_manage`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500_resp_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}},"schemas":{"ErrorMessageFault":{"type":"object","description":"Authorization error returned by the API gateway.","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string","description":"Authorization failure."},"detail":{"type":"object","properties":{"errorcode":{"type":"string","description":"Gateway error code."}}}}}}},"ErrorMessage":{"type":"object","description":"Error returned for a failed request.","properties":{"code":{"type":"integer","description":"HTTP status code."},"status":{"type":"string","description":"HTTP status code as text."},"message":{"type":"string","description":"Explanation of the failure."},"details":{"type":"array","description":"Field-level or scope-level messages, when the failure has more than one part.","items":{"type":"object","properties":{"message":{"type":"string","description":"One part of the failure."}}}}}}}},"paths":{"/search/{tenant}/search/{type}/queries/{id}":{"delete":{"summary":"Deleting a saved search","operationId":"DELETE-search-tenant-type-queries-id","tags":["Saved Searches"],"description":"![Preview](https://res.cloudinary.com/saas-ag/image/upload/v1752824268/emporix/icons/preview_api1.png)\n\n{% hint style=\"danger\" %}\nThis functionality is in preview mode - some of the features may not be fully operational yet.\n{% endhint %}\n\nDeletes one saved search. Deleting does not start an index build.","responses":{"204":{"description":"The saved search was deleted. The response has no body."},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_search_manage"},"404":{"description":"No saved search with this id exists for the type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"500":{"$ref":"#/components/responses/500_resp_common"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.emporix.io/api-references/readme/api-reference-33/saved-searches.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
