---
title: "Validate catalog rules for a given context"
method: POST
path: "/catalogs/rules/validate"
tags: ["Rules"]
---

# Validate catalog rules for a given context

`POST /catalogs/rules/validate`

## Request

- Base URL: `https://euwest.api.elasticpath.com`
- URL: `https://euwest.api.elasticpath.com/catalogs/rules/validate`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/elasticpath/apis/catalogs-introduction/docs/catalogs/rules/validate/post.ts> (a function with typed inputs; its response is checked against the schema)

Validates catalog rules for a given context and returns a list of matching catalog rules.

## Query parameters

- `page[limit]` integer
- `page[offset]` integer

## Request body

- CatalogRuleValidatorRequest
  - `data` object
    - `match_type` 'filter' | 'similarity' | 'conflict' | 'resolve_for_shopper', required: The type of matching operation to perform on catalog rules: - **filter**: Advanced rule filtering with AND logic. Returns rules that match ALL specified criteria. - **similarity**: Finds rules similar to the supplied rule using OR logic. Returns rules sorted by similarity score (highest first) with metadata indicating: - Similarity score based on matching criteria (name: 100pts, account/customer/channel/tags: 5pts each, catalog: 3pts, pricebooks: 2pts, schedules: 2pts) - Whether the rule is active at the supplied match_date - Whether the rule would be resolved for a shopper context - **conflict**: Checks for conflicts between the supplied rule and existing rules. Returns rules that would conflict if the new rule were created. - **resolve_for_shopper**: Determines the exact catalog rule that would be applied for a given shopper context. Returns the single most specific matching rule or defaults to "Default Catalog Resolution".
    - `channels` string[], nullable: The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.
    - `tags` string[], nullable: A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.
    - `account_ids` string[], nullable: List of account IDs.
    - `account_tag_ids` string[], nullable: List of account tag UUIDs.
    - `customer_ids` string[], nullable: List of customer IDs.
    - `pricebook_ids` string[], nullable: List of pricebook IDs.
    - `schedules` object[], nullable
      - `valid_from` string, date-time
      - `valid_to` string, date-time
    - `name` string, nullable: The name of the catalog rule.
    - `catalog_id` string, nullable: The id of the catalog to match against.
    - `search_profile_slug` string, nullable: Optional. When `match_type` is `filter`, ANDs an exact match on the rule's `search_profile_slug`. Not used as a shopper-context matching dimension for `resolve_for_shopper`.
    - `match_date` string, date-time, nullable: The date to match against the schedules.

## Response `200`

List of matching catalog rules

- RuleListData: Container for a list of catalog rules.
  - `meta` PageMeta: Contains the results for the entire collection.
    - `results` object: Total number of results for the entire collection.
      - `total` integer: Total number of results for the entire collection.
    - `page` object
      - `limit` integer: The maximum number of records for all pages.
      - `offset` integer: The current offset by number of pages.
      - `current` integer: The current number of pages.
      - `total` integer: The total number of records for the entire collection.
  - `data` Rule[], required
    - `id` string, required: The catalog rule ID. Use this to get, modify, or delete the catalog rule.
    - `attributes` object, required
      - `name` string, required: The name of a catalog rule. The name must not contain any spaces.
      - `description` string: A brief description of the purpose of a catalog rule.
      - `account_ids` string[]: The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.
      - `account_tag_ids` string[]: The list of account tag UUIDs. Accounts must have at least one of these tags to see this catalog. If this field is empty, the rule matches all accounts regardless of tags.
      - `customer_ids` string[]: The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.
      - `channels` string[]: The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.
      - `tags` string[]: A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.
      - `schedules` RuleSchedule[]: Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. The schedules attribute must include the following. - `valid_from` matches the date and time that the catalog is displayed from. - `valid_to` matches the date and time the catalog is displayed to. Commerce runs on UTC time. You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`.
        - `valid_from` string, date-time, nullable: Matches the date and time that the catalog is displayed from.
        - `valid_to` string, date-time, nullable: Matches the date and time the catalog is displayed to.
      - `catalog_id` string, required: The unique identifier of a catalog.
      - `created_at` string, date-time, required: The date and time a catalog rule was created.
      - `updated_at` string, date-time, required: The date and time a catalog release is updated.
      - `pricebook_ids` object[]: If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books.
        - `id` string, uuid, required: A unique identifier of a price book.
        - `priority` integer, required: Priority is a number and the price book with the highest number has the highest priority.
      - `search_profile_slug` string, nullable: Optional slug of a Catalog Search profile to apply when this rule is selected for a shopper. This is configuration on the rule (same role as `pricebook_ids`), not a shopper-context matching dimension. Omitted from responses when unset.
    - `type` 'catalog_rule', required: This represents the type of object being returned. Always `catalog_rule`.
    - `meta` RuleMeta: A rule's metadata.
      - `similarity_score` integer, nullable: Indicates the similarity score of the rule to the supplied validation request. The score is calculated based on matching criteria: - **Name match**: 100 points (exact match) - **Account IDs**: 5 points per matching account - **Customer IDs**: 5 points per matching customer - **Channels**: 5 points per matching channel - **Tags**: 5 points per matching tag - **Catalog ID**: 3 points (exact match) - **Pricebook IDs**: 2 points per matching pricebook - **Schedules**: 2 points per overlapping schedule Higher scores indicate greater similarity. Rules are sorted by similarity score in descending order.
      - `active` boolean: will the rule be active at the supplied match date/time?
      - `resolved_for_shopper` boolean: Indicates whether this rule will be the one resolved for a shopper viewing the catalog at the supplied match date/time
      - `release_id` string, nullable: The unique identifier of the published release of the catalog for the rule
  - `links` Links: Links allow you to move between requests.
    - `self` string, uri-reference, nullable: Single entities use a `self` parameter with a link the specific resource.
    - `first` string, uri-reference, nullable: Always the first page.
    - `last` string, uri-reference, nullable: This is `null` if there is only one page.
    - `prev` string, uri-reference, nullable: This is `null` if there is only one page.
    - `next` string, uri-reference, nullable: This is `null` if there is only one page.

## Other responses

- `default`: Unexpected error.

---

[API](https://skmtc.dev/elasticpath/apis/catalogs-introduction.md) - [All operations](https://skmtc.dev/elasticpath/apis/catalogs-introduction/llms.txt) - [OpenAPI document](https://skmtc.dev/elasticpath/apis/catalogs-introduction/revisions/eb541d5dea51?raw)
