---
title: "Create facet campaign"
method: POST
path: "/v1/facet_rule_campaigns"
tags: ["Facet campaigns"]
---

# Create facet campaign

`POST /v1/facet_rule_campaigns`

**🔐 This endpoint requires [HTTP authentication](https://docs.constructor.com/reference/main-authentication) (either [Basic](https://docs.constructor.com/reference/main-authentication#basic-authentication) or [Bearer](https://docs.constructor.com/reference/main-authentication#bearer-authentication)).**
For authenticating with Bearer token, required scopes are: `facets.refined_filters(w)`, `facets.refined_queries(w)`.

Create a facet campaign

## Query parameters

- `key` string, required — The key of the index to use.
- `section` string — The section of the index to use. Defaults to `Products`.

## Request body

- FacetRuleCampaignListPostBody
  - `slot_rules` union[]
    - union
      - SlotFacetRuleBase
        - `target` 'facet_group', required
        - `request_tag_name` 'client_ip' | 'client_version' | 'geo_city' | 'geo_country' | 'geo_country_iso_code' | 'geo_region' | 'dt_weekday' | 'dt_timeofday' | 'user_segment' | 'autogenerated_user_segment' | 'dynamic_segment'
        - `request_tag_value` string — Request tag value to be used to activate this entity for, used only with request_tag_name.
        - `active` boolean — Indicates whether this rule is active or not.
        - `start_time` string, date-time — Date and time when the rule should be enabled.
        - `end_time` string, date-time — Date and time when the rule should be disabled.
        - `campaign_id` integer
        - `automatically_generated` boolean — Boolean to indicate if this rule is automatically generated or not.
        - `rule` SlotFacetRuleParameters, required
          - `name` string, required — The name of the facet to place in position.
          - `position` integer, required — The position of facet to place in.
        - `rule_type` 'slot' — Type of the rule.
      - SlotFacetOptionRuleBase
        - `target` 'facet_option', required
        - `facet_group_name` string, required
        - `request_tag_name` 'client_ip' | 'client_version' | 'geo_city' | 'geo_country' | 'geo_country_iso_code' | 'geo_region' | 'dt_weekday' | 'dt_timeofday' | 'user_segment' | 'autogenerated_user_segment' | 'dynamic_segment'
        - `request_tag_value` string — Request tag value to be used to activate this entity for, used only with request_tag_name.
        - `active` boolean — Indicates whether this rule is active or not.
        - `start_time` string, date-time — Date and time when the rule should be enabled.
        - `end_time` string, date-time — Date and time when the rule should be disabled.
        - `campaign_id` integer
        - `automatically_generated` boolean — Boolean to indicate if this rule is automatically generated or not.
        - `rule` SlotFacetRuleParameters, required
          - `name` string, required — The name of the facet to place in position.
          - `position` integer, required — The position of facet to place in.
        - `rule_type` 'slot' — Type of the rule.
  - `blacklist_rules` union[]
    - union
      - BlacklistFacetRuleBase
        - `target` 'facet_group', required
        - `request_tag_name` 'client_ip' | 'client_version' | 'geo_city' | 'geo_country' | 'geo_country_iso_code' | 'geo_region' | 'dt_weekday' | 'dt_timeofday' | 'user_segment' | 'autogenerated_user_segment' | 'dynamic_segment'
        - `request_tag_value` string — Request tag value to be used to activate this entity for, used only with request_tag_name.
        - `active` boolean — Indicates whether this rule is active or not.
        - `start_time` string, date-time — Date and time when the rule should be enabled.
        - `end_time` string, date-time — Date and time when the rule should be disabled.
        - `campaign_id` integer
        - `automatically_generated` boolean — Boolean to indicate if this rule is automatically generated or not.
        - `rule` BlacklistFacetRuleParameters, required
          - `name` string, required — The name of the facet to block.
        - `rule_type` 'blacklist' — Type of the rule.
      - BlacklistFacetOptionRuleBase
        - `target` 'facet_option', required
        - `facet_group_name` string, required
        - `request_tag_name` 'client_ip' | 'client_version' | 'geo_city' | 'geo_country' | 'geo_country_iso_code' | 'geo_region' | 'dt_weekday' | 'dt_timeofday' | 'user_segment' | 'autogenerated_user_segment' | 'dynamic_segment'
        - `request_tag_value` string — Request tag value to be used to activate this entity for, used only with request_tag_name.
        - `active` boolean — Indicates whether this rule is active or not.
        - `start_time` string, date-time — Date and time when the rule should be enabled.
        - `end_time` string, date-time — Date and time when the rule should be disabled.
        - `campaign_id` integer
        - `automatically_generated` boolean — Boolean to indicate if this rule is automatically generated or not.
        - `rule` BlacklistFacetRuleParameters, required
          - `name` string, required — The name of the facet to block.
        - `rule_type` 'blacklist' — Type of the rule.
  - `name` string, required
  - `description` string — The description of the facet campaign.
  - `refined_queries` RefinedQuery[] — A list of refined queries.
    - `query` string, required — A refined query string
  - `refined_filters` RefinedFilter[] — A list of refined filters.
    - `filter_name` string, required — The name of the refined filter.
    - `filter_value` string, required — The value of the refined filter.

## Response `201`

Created

- FacetRuleCampaignListPostResponse
  - `id` integer, required — The ID of the facet rule campaign.
  - `name` string, required — The name of the facet rule campaign.
  - `description` string — The description of the facet rule campaign.
  - `created_at` string, date-time, required — The creation time of the facet rule campaign.
  - `updated_at` string, date-time, required — The last updated time of the facet rule campaign.
  - `slot_rules` SlotFacetRuleResponse[], required — A list of slot rules.
    - `target` 'facet_group' | 'facet_option', required
    - `facet_group_name` string
    - `id` integer, required — The ID of the rule, must be unique.
    - `request_tag_name` 'client_ip' | 'client_version' | 'geo_city' | 'geo_country' | 'geo_country_iso_code' | 'geo_region' | 'dt_weekday' | 'dt_timeofday' | 'user_segment' | 'autogenerated_user_segment' | 'dynamic_segment'
    - `request_tag_value` string — Request tag value to be used to activate this entity for, used only with request_tag_name.
    - `active` boolean — Indicates whether this rule is active or not.
    - `start_time` string, date-time — Date and time when the rule should be enabled.
    - `end_time` string, date-time — Date and time when the rule should be disabled.
    - `campaign_id` integer
    - `automatically_generated` boolean — Boolean to indicate if this rule is automatically generated or not.
    - `rule` SlotFacetRuleParameters, required
      - `name` string, required — The name of the facet to place in position.
      - `position` integer, required — The position of facet to place in.
    - `rule_type` 'slot', required
    - `created_at` string, date-time — Date & time in ISO 8601 format for the creation of this rule.
    - `updated_at` string, date-time — Date & time in ISO 8601 format for last update for this rule.
  - `blacklist_rules` BlacklistFacetRuleResponse[], required — A list of blacklist rules.
    - `target` 'facet_group' | 'facet_option', required
    - `facet_group_name` string
    - `id` integer, required — The ID of the rule, must be unique.
    - `request_tag_name` 'client_ip' | 'client_version' | 'geo_city' | 'geo_country' | 'geo_country_iso_code' | 'geo_region' | 'dt_weekday' | 'dt_timeofday' | 'user_segment' | 'autogenerated_user_segment' | 'dynamic_segment'
    - `request_tag_value` string — Request tag value to be used to activate this entity for, used only with request_tag_name.
    - `active` boolean — Indicates whether this rule is active or not.
    - `start_time` string, date-time — Date and time when the rule should be enabled.
    - `end_time` string, date-time — Date and time when the rule should be disabled.
    - `campaign_id` integer
    - `automatically_generated` boolean — Boolean to indicate if this rule is automatically generated or not.
    - `rule` BlacklistFacetRuleParameters, required
      - `name` string, required — The name of the facet to block.
    - `rule_type` 'blacklist', required
    - `created_at` string, date-time — Date & time in ISO 8601 format for the creation of this rule.
    - `updated_at` string, date-time — Date & time in ISO 8601 format for last update for this rule.
  - `refined_queries` RefinedQuery[] — A list of refined queries.
    - `query` string, required — A refined query string
  - `refined_filters` RefinedFilter[] — A list of refined filters.
    - `filter_name` string, required — The name of the refined filter.
    - `filter_value` string, required — The value of the refined filter.

## Other responses

- `400` — Validation Error
- `401` — Credentials are not passed or action is forbidden.
- `403` — The supplied token does not have the required permissions.
- `409` — Conflict
- `429` — Rate limit breached

---

[API](https://skmtc.net/constructor/apis/autocomplete.md) · [All operations](https://skmtc.net/constructor/apis/autocomplete/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/constructor/autocomplete/versions/2d33330633b6/schema)
