---
title: "Create search rule"
method: POST
path: "/v1/stores/{store_identifier}/rules"
tags: ["stores"]
---

# Create search rule

`POST /v1/stores/{store_identifier}/rules`

Create a new search rule for a store.

Args:
    store_identifier: The ID or name of the store
    rule_create: Search rule creation parameters

Returns:
    SearchRuleResponse: The created search rule details

## Path parameters

- `store_identifier` union, required — The ID or name of the store
  - string
  - string, uuid

## Request body

- MxbaiOmniApiRoutesV1StoresRulesModelsSearchRuleCreateParams — Parameters for creating a new search rule for a store.
  - `query` string, required — The query pattern to match
  - `rules` union[], required — The rules to apply on query matches
    - union — The possible rules for a vector store search
      - QueryStringSubstitutionRule — Represents a string query substitution rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'query_string', required — The type of substitution
        - `substitution` string, required — The substitution to apply
      - QueryRegexSubstitutionRule — Represents a regex query substitution rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'query_regex', required — The type of substitution
        - `pattern` string, required — The regex pattern to match
        - `flags` RegexFlag[] — The regex flags to use
        - `replacement` string, required — The replacement string (can use regex groups)
      - ChunkSearchResultRule — Represents a chunk search result rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'chunk_search_result', required — The type of substitution
        - `file_id` string, required — The file ID of the chunk to substitute
        - `chunk_index` integer, required — The index of the chunk to substitute
        - `result_index` integer, required — The index where the result will be inserted
      - FileSearchResultRule — Represents a file search result rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'file_search_result', required — The type of substitution
        - `file_id` string, required — The file ID of the file to substitute
        - `chunk_index` integer — An optional chunk index to use for the chunk substitution
        - `result_index` integer, required — The index where the result will be inserted

## Response `201`

The created search rule

- MxbaiOmniApiRoutesV1StoresRulesModelsSearchRuleResponse — Response model for a store search rule.
  - `id` string, required — The search rule ID
  - `object` 'search_rule' — The object type
  - `query` string, required — The query pattern
  - `store_id` string, required — The store ID
  - `rules` union[], required — The rules to apply
    - union — The possible rules for a vector store search
      - QueryStringSubstitutionRule — Represents a string query substitution rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'query_string', required — The type of substitution
        - `substitution` string, required — The substitution to apply
      - QueryRegexSubstitutionRule — Represents a regex query substitution rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'query_regex', required — The type of substitution
        - `pattern` string, required — The regex pattern to match
        - `flags` RegexFlag[] — The regex flags to use
        - `replacement` string, required — The replacement string (can use regex groups)
      - ChunkSearchResultRule — Represents a chunk search result rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'chunk_search_result', required — The type of substitution
        - `file_id` string, required — The file ID of the chunk to substitute
        - `chunk_index` integer, required — The index of the chunk to substitute
        - `result_index` integer, required — The index where the result will be inserted
      - FileSearchResultRule — Represents a file search result rule for a vector store search.
        - `query` string, required — The query to trigger the rule
        - `store_id` string, required — The store identifier to apply the rule to
        - `type` 'file_search_result', required — The type of substitution
        - `file_id` string, required — The file ID of the file to substitute
        - `chunk_index` integer — An optional chunk index to use for the chunk substitution
        - `result_index` integer, required — The index where the result will be inserted
  - `created_at` string, date-time, required — When the rule was created
  - `updated_at` string, date-time, required — When the rule was last updated

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/mixedbread/apis/mxbai-omni.md) · [All operations](https://skmtc.net/mixedbread/apis/mxbai-omni/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mixedbread/mxbai-omni/revisions/f66774ddecfc/schema)
