openapi: 3.0.1 info: title: Coveo Activity Activities Facet API description: API for Coveo Platform termsOfService: https://www.coveo.com/en/support/terms-agreements contact: name: Coveo url: https://connect.coveo.com/s/discussions version: 1.0.0 servers: - url: https://platform.cloud.coveo.com description: Coveo public API endpoint security: - oauth2: - full tags: - name: Facet paths: /rest/organizations/{organizationId}/commerce/v2/facet: post: tags: - Facet summary: Executes a Facet Search Query description: 'Returns facet values for a given query.

**Required privilege:** Execute Query

Privilege required ``` {"owner":"SEARCH_API","targetDomain":"EXECUTE_QUERY","targetId":"*"} ```
' operationId: facet parameters: - name: organizationId in: path description: The unique identifier of the target [organization](https://docs.coveo.com/en/185/).
**Example:** `acmecorporation8tp8wu3` required: true schema: type: string - name: type in: query description: 'Solution type. Possible values are: LISTING, SEARCH.' required: false schema: type: string enum: - LISTING - SEARCH example: LISTING requestBody: content: application/json: schema: $ref: '#/components/schemas/FacetSearchRequestModel' required: true responses: '200': description: OK content: '*/*': schema: $ref: '#/components/schemas/FacetSearchResponseModel' x-pretty-name: facet x-required-privilege: owner: SEARCH_API targetDomain: EXECUTE_QUERY targetId: '*' x-required-privileges: - owner: SEARCH_API targetDomain: EXECUTE_QUERY targetId: '*' x-ui-operation-id: /rest/organizations/paramId/commerce/v2/facet_post components: schemas: HierarchicalValueModel: required: - value type: object properties: state: type: string description: The current facet value state in the search interface. enum: - idle - selected preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. value: minLength: 1 type: string description: This represents a single path segment. children: type: array description: The children of this hierarchical facet value. items: $ref: '#/components/schemas/HierarchicalValueModel' retrieveCount: type: integer description: The maximum number of children to retrieve for this hierarchical facet value. Ignored if retrieveChildren is false. format: int32 description: The values displayed by the facet in the search interface at the moment of the request. SortByRelevanceRequestResponseModel: type: object allOf: - $ref: '#/components/schemas/AbstractSortRequestResponseModel' CartItemModel: type: object properties: productId: type: string description: The id of the product. example: shoe-a1-red quantity: type: integer description: The product quantity. format: int32 example: 2 description: A cart item. SortByFieldRequestResponseModel: required: - field type: object properties: field: minLength: 1 type: string description: The name of a field to sort by. direction: type: string description: 'Sort order:
Default: `ascending`
' enum: - asc - desc displayName: type: string description: The display name of a field. description: Defines the fields and, optionally, their sort order. FacetSearchResponseModel: type: object properties: values: type: array description: The returned facet values. items: $ref: '#/components/schemas/FacetValuesModel' moreValuesAvailable: type: boolean description: Whether additional facet values matching the request are available. ViewModel: required: - url type: object properties: url: minLength: 1 type: string description: The URL used to retrieve the products. Used as `documentLocation` for analytics purposes, which indicates the URL of the resource where the request originated. example: https://acme.com/summersale referrer: type: string description: Typically the URL of the page that linked to the interface from which the request originates (e.g., in JavaScript, this would correspond to the `document.referrer` value).\n\nCoveo Machine Learning models may use this information to provide contextually relevant output. Used as `documentReferrer` for analytics purposes. nullable: true example: https://example.com/ description: 'A collection of data points describing the view. Note: The term ''view'' is used instead of ''page'' to accommodate usage in contexts such as mobile apps.' ContextModel: required: - view type: object properties: user: $ref: '#/components/schemas/UserModel' view: $ref: '#/components/schemas/ViewModel' cart: type: array description: The cart information. items: $ref: '#/components/schemas/CartItemModel' source: type: array description: Defines one or more client side libraries that generated the analytics event. The format should be the library's name followed by '@', and then the version. For example, '[custom.library.js@2.0.0]'. example: - '@coveo/headless@2.61.0' - custom.library.js@2.0.0 items: minLength: 1 pattern: ^[^@]*@.*$ type: string description: A context source example: '@coveo/headless@2.61.0' capture: type: boolean description: Whether the request should be tracked for analytics and machine learning purposes. When set to `true`, this will trigger a server-side event to be logged. When set to `false`, the server-side event will not be logged. example: true labels: type: object additionalProperties: type: string description: Deprecated - The context labels. example: '{"category":"garden > garden-tools > chainsaws","brand":"ACME"}' description: Deprecated - The context labels. example: category: garden > garden-tools > chainsaws brand: ACME custom: type: object additionalProperties: type: object description: Custom context values under context.custom. Use this for context mapping. example: fitmentProducts: - sku_123 - sku_456 description: Custom context values under context.custom. Use this for context mapping. example: fitmentProducts: - sku_123 - sku_456 description: Contextual information about the query. UserModel: type: object properties: userAgent: type: string description: 'The user agent of the request. If not present, the user agent is obtained from the [User-Agent](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent) header.\n\n**Note**: This information is required when endpoints are behind a proxy.' example: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 description: The user information. RequestFacetBaseObject: required: - field - values type: object properties: facetId: type: string description: Name of the field to execute the facet search request against. example: color field: minLength: 1 type: string description: The facet field name. example: ec_brand displayName: type: string description: The facet display name. example: Brand values: minItems: 1 type: array description: The values displayed by the facet in the search interface at the moment of the request. items: type: object description: The values displayed by the facet in the search interface at the moment of the request. numberOfValues: type: object properties: empty: type: boolean present: type: boolean asInt: type: integer format: int32 description: 'The maximum number of facet values to fetch. It should typically be set to the value last received in the `numberOfValues` property of the facet response.

An exception to this guideline is the case where the last response had `moreValuesAvailable=true` and the user asks to see more values for this facet. In this case, the front-end is expected to send a value greater than the `numberOfValues` that it last received in the response. This ensures that more values are fetched from the index.

When not provided, the default number of values configured for this facet is used. ' type: type: string description: 'One of: `regular`, `dateRange`, `numericalRange`, `hierarchical`. For more information, see the [facet types](https://docs.coveo.com/en/p3oa0420#facet-types) documentation.' enum: - regular - dateRange - numericalRange - hierarchical - regular description: The facet operations to perform on the query. Note that this parameter is ignored in the '/productSuggest' endpoint. example: - field: ec_category type: regular values: - value: shoes state: idle discriminator: propertyName: type RangeDomain: required: - max - min type: object properties: min: minimum: 0 type: integer format: int32 max: maximum: 1000000 type: integer format: int32 increment: maximum: 1000000 minimum: 0 type: integer format: int32 description: Limits the range values to the specified domain. HierarchicalFacetModel: required: - field - values type: object description: Hierarchical (tree-like) facet. example: facetId: ec_category field: ec_category displayNames: - value: Category language: en - value: Catégorie language: fr values: - state: selected preventAutoSelect: true value: Canoes & Kayaks children: - state: selected preventAutoSelect: true value: Kayaks children: - state: selected preventAutoSelect: true value: Folding Kayaks - state: idle preventAutoSelect: true value: Sea Kayaks - state: selected preventAutoSelect: false value: Canoes numberOfValues: 5 preventAutoSelect: true sortCriteria: score isFieldExpanded: true type: hierarchical delimitingCharacter: '|' basePath: - Boats filterByBasePath: true allOf: - $ref: '#/components/schemas/RequestFacetBaseObject' - type: object properties: values: minItems: 1 type: array description: The values displayed by the facet in the search interface at the moment of the request. items: $ref: '#/components/schemas/HierarchicalValueModel' preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. sortCriteria: type: string description: The criterion to use for sorting returned facet values. enum: - score - alphanumericNatural - alphanumeric - occurrences delimitingCharacter: type: string description: The character to use to split field values into a hierarchical sequence. filterByBasePath: type: boolean description: Whether to use basePath as a filter for the results. retrieveCount: type: object properties: empty: type: boolean present: type: boolean asInt: type: integer format: int32 description: The maximum number of children to retrieve for this hierarchical facet values. isFieldExpanded: type: boolean description: The value provided is only copied back in the `isFieldExpanded` property of the response. It does not affect the behaviour of the Commerce Service in any way. AbstractSortRequestResponseModel: type: object properties: sortCriteria: type: string description: The criterion to use for sorting the results. enum: - relevance - fields description: Determines the order in which to retrieve the results. example: - sortCriteria: fields fields: - field: ec_price direction: asc displayNames: - value: Price language: en - value: Prix language: fr discriminator: propertyName: sortCriteria default: relevance LegacyFacetOptions: type: object properties: freezeFacetOrder: type: boolean description: 'Default: `false`
Whether facets should be returned in the same order in which they were requested.' description: Facet Options for legacy (v1) facets. FacetValuesModel: type: object properties: displayValue: type: string description: Custom display name. rawValue: type: string description: Facet value. path: type: array description: Base path of the facet value. items: type: string description: Base path of the facet value. count: type: integer description: Estimated number of products matching the query. format: int32 description: The returned facet values. FacetSearchRequestModel: required: - context - country - currency - language - query - trackingId type: object properties: facetId: type: string description: Name of the field to execute the facet search request against. example: color facetQuery: type: string description: Should be set to the text entered by the end-user in the facet search box, to which one or more wildcard characters (*) may be added. example: blue numberOfValues: type: integer description: The maximum number of facet values to fetch when performing facet search format: int32 example: 10 ignorePaths: type: array description: Paths to ignore when searching for hierarchical values. example: - Accessories items: type: string description: Paths to ignore when searching for hierarchical values. example: '["Accessories"]' trackingId: minLength: 1 type: string description: The unique identifier of the tracking target. example: acmecorporation_ca language: minLength: 1 type: string description: An ISO 639-1 language code. example: en country: minLength: 1 type: string description: An ISO 3166-1 alpha-2 country code. example: US currency: minLength: 1 type: string description: An ISO 4217 currency code. example: USD clientId: type: string description: A GUID which represents the current client.\n\nIf your implementation uses the Atomic or Headless libraries, then the [client ID](https://docs.coveo.com/en/masb0234/) is generated automatically in client-side code.\n\nIf you have a custom Coveo implementation, you will have to generate a [UUID v4]()-formatted GUID. You will need to send this ID in every request that is sent to the Commerce API.\n\nCoveo Machine Learning models may use this information to provide contextually relevant output. example: 58bb4b98-1daa-4767-8c15-90a0ea67645c facets: type: array description: The facet operations to perform on the query. Note that this parameter is ignored in the '/productSuggest' endpoint. example: - field: ec_category type: regular values: - value: shoes state: idle items: oneOf: - $ref: '#/components/schemas/DateRangeFacetModel' - $ref: '#/components/schemas/HierarchicalFacetModel' - $ref: '#/components/schemas/NumericalRangeFacetModel' - $ref: '#/components/schemas/RegularFacetModel' page: minimum: 0 type: integer description: The page of products to request. format: int32 example: 7 perPage: maximum: 1000 minimum: 1 type: integer description: The number of products per page. Note that a value greater than 100 may be rejected in the future. format: int32 example: 30 sort: oneOf: - $ref: '#/components/schemas/SortByFieldsRequestResponseModel' - $ref: '#/components/schemas/SortByRelevanceRequestResponseModel' debug: type: boolean description: Whether to include the execution report on a successful response. example: true query: type: string description: The query expression, typically the keywords entered by the end user in a search box. example: blue shoes context: $ref: '#/components/schemas/ContextModel' legacyFacetOptions: $ref: '#/components/schemas/LegacyFacetOptions' enableResults: type: boolean description: Enable spotlight content in the results. When enabled, the products list in the response will always be empty and the results list should be used instead. description: The facet query to be executed. DateRangeFacetModel: required: - field - values type: object description: Date range facet. example: facetId: year field: year displayNames: - value: Year language: en - value: Année language: fr values: - state: idle preventAutoSelect: false start: 2023/10/01@00:00:00 end: 2023/10/31@23:59:59 endInclusive: true - state: idle preventAutoSelect: true start: 2023/11/01@00:00:00 end: 2023/11/30@23:59:59 endInclusive: false - state: selected preventAutoSelect: true start: 2023/12/01@00:00:00 end: 2023/12/31@23:59:59 endInclusive: true numberOfValues: 3 preventAutoSelect: false sortCriteria: score isFieldExpanded: true type: dateRange generateAutomaticRanges: true allOf: - $ref: '#/components/schemas/RequestFacetBaseObject' - type: object properties: values: minItems: 1 type: array description: The values displayed by the facet in the search interface at the moment of the request. items: $ref: '#/components/schemas/DateRangeValueModel' preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. sortCriteria: type: string description: The criterion to use for sorting returned facet values. enum: - score - alphanumericNatural - alphanumeric - occurrences generateAutomaticRanges: type: boolean description: Whether to automatically generate range values for this facet. freezeCurrentValues: type: boolean description: Should always be set to `false` except when selecting/unselecting facet values. See [here](https://docs.coveo.com/en/3199/build-a-search-ui/implement-facets#toggle-facet-values) for more guidance. isFieldExpanded: type: boolean description: The value provided is only copied back in the `isFieldExpanded` property of the response. It does not affect the behaviour of the Commerce Service in any way. NumericalRangeValueModel: required: - end - start type: object properties: state: type: string description: The current facet value state in the search interface. enum: - idle - selected preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. start: type: number description: The value to start the range at. end: type: number description: The value to end the range at. Must be greater (or later) than the start value. endInclusive: type: boolean description: Whether to include the end value in the range. It should typically be set to the value last received in the `endInclusive` property of the facet response. description: The values displayed by the facet in the search interface at the moment of the request. RegularFacetModel: required: - field - values type: object description: Regular (single string value) facet. example: facetId: ec_brand field: ec_brand displayNames: - value: Brand language: en - value: Marque language: fr values: - state: selected preventAutoSelect: false value: Aqua Sports - state: idle preventAutoSelect: false value: Aqua Marina - state: idle preventAutoSelect: false value: HO Sports numberOfValues: 3 preventAutoSelect: false sortCriteria: score isFieldExpanded: true type: regular customOrder: - string allOf: - $ref: '#/components/schemas/RequestFacetBaseObject' - type: object properties: values: minItems: 1 type: array description: The values displayed by the facet in the search interface at the moment of the request. items: $ref: '#/components/schemas/RegularValueModel' preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. sortCriteria: type: string description: The criterion to use for sorting returned facet values. enum: - score - alphanumericNatural - alphanumeric - occurrences customOrder: type: array description: A custom sort order for the facet values. items: type: string freezeCurrentValues: type: boolean description: Should always be set to `false` except when selecting/unselecting facet values. See [here](https://docs.coveo.com/en/3199/build-a-search-ui/implement-facets#toggle-facet-values) for more guidance. resultsMustMatch: type: string description: Specifies how a result must match the selected values. default: atLeastOneValue enum: - atLeastOneValue - allValues isFieldExpanded: type: boolean description: The value provided is only copied back in the `isFieldExpanded` property of the response. It does not affect the behaviour of the Commerce Service in any way. DateRangeValueModel: required: - end - start type: object properties: state: type: string description: The current facet value state in the search interface. enum: - idle - selected preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. start: minLength: 1 type: string description: The value to start the range at. end: minLength: 1 type: string description: The value to end the range at. Must be greater (or later) than the start value. endInclusive: type: boolean description: Whether to include the end value in the range. description: The values displayed by the facet in the search interface at the moment of the request. SortByFieldsRequestResponseModel: required: - fields type: object allOf: - $ref: '#/components/schemas/AbstractSortRequestResponseModel' - type: object properties: fields: minItems: 1 type: array description: Defines the fields and, optionally, their sort order. items: $ref: '#/components/schemas/SortByFieldRequestResponseModel' RegularValueModel: required: - value type: object properties: state: type: string description: The current facet value state in the search interface. enum: - idle - selected preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. value: minLength: 1 type: string description: The facet value name. description: The values displayed by the facet in the search interface at the moment of the request. NumericalRangeFacetModel: required: - field - values type: object description: Numerical range facet. example: facetId: ec_price field: ec_price displayNames: - value: Price language: en - value: Prix language: fr values: - state: idle preventAutoSelect: true start: '0' end: '999' endInclusive: 'true' - state: selected preventAutoSelect: true start: '1000' end: '2000' endInclusive: 'false' - state: selected preventAutoSelect: true start: '2001' end: '3000' endInclusive: 'false' numberOfValues: 3 preventAutoSelect: true sortCriteria: score isFieldExpanded: true type: numericalRange allOf: - $ref: '#/components/schemas/RequestFacetBaseObject' - type: object properties: values: minItems: 1 type: array description: The values displayed by the facet in the search interface at the moment of the request. items: $ref: '#/components/schemas/NumericalRangeValueModel' preventAutoSelect: type: boolean description: Whether to prevent Coveo ML from automatically selecting facet values. sortCriteria: type: string description: The criterion to use for sorting returned facet values. enum: - score - alphanumericNatural - alphanumeric - occurrences interval: type: string description: Determines the range interval type. Default is `continuous`. default: continuous enum: - continuous - discrete - even - equiprobable domain: $ref: '#/components/schemas/RangeDomain' freezeCurrentValues: type: boolean description: Should always be set to `false` except when selecting/unselecting facet values. See [here](https://docs.coveo.com/en/3199/build-a-search-ui/implement-facets#toggle-facet-values) for more guidance. isFieldExpanded: type: boolean description: The value provided is only copied back in the `isFieldExpanded` property of the response. It does not affect the behaviour of the Commerce Service in any way. securitySchemes: oauth2: type: oauth2 flows: authorizationCode: authorizationUrl: https://platform.cloud.coveo.com/oauth/authorize tokenUrl: https://platform.cloud.coveo.com/oauth/token scopes: full: required