> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voucherify.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Product Collection

> This method creates a new product collection.



## OpenAPI

````yaml /openapi/product-collections.json post /v1/product-collections
openapi: 3.0.1
info:
  title: Voucherify API - Product Collections
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v1/product-collections:
    post:
      tags:
        - Product Collections
      summary: Create Product Collection
      description: This method creates a new product collection.
      operationId: create-product-collection
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductCollectionsCreateRequestBody'
            examples:
              Create static collection:
                value:
                  type: STATIC
                  name: Static collection example
                  products:
                    - id: prod_0a41dd45dc85fcab40
                      object: product
              Create dynamic collection:
                value:
                  type: AUTO_UPDATE
                  name: Voucherify example collection
                  filter:
                    junction: and
                    metadata.brand:
                      conditions:
                        $is:
                          - Voucherify
                    price:
                      conditions:
                        $more_than:
                          - 5000
        required: true
      responses:
        '200':
          description: >-
            Returns information about the newly created collection, as well as
            an array containing the products.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductCollectionsCreateResponseBody'
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - product-collections
components:
  schemas:
    ProductCollectionsCreateRequestBody:
      title: Product Collections Create Request Body
      description: Request body schema for **POST** `v1/product-collections`.
      oneOf:
        - $ref: '#/components/schemas/ProductCollectionsCreateStaticRequestBody'
        - $ref: '#/components/schemas/ProductCollectionsCreateDynamicRequestBody'
    ProductCollectionsCreateResponseBody:
      type: object
      title: Product Collections Create Response Body
      description: Response body schema for **POST** `v1/product-collections`.
      allOf:
        - $ref: '#/components/schemas/ProductCollectionsItem'
    ProductCollectionsCreateStaticRequestBody:
      title: Product Collections Create Static Request Body
      description: Request body schema for **POST** `v1/product-collections`.
      type: object
      properties:
        type:
          type: string
          description: >-
            Show that the product collection is static (manually selected
            products).
          default: STATIC
          enum:
            - STATIC
        name:
          type: string
          description: Unique user-defined product collection name.
        products:
          type: array
          description: Defines a set of products for a `STATIC` product collection type.
          items:
            title: Product Collections Create Dynamic Request Body Products Item
            type: object
            properties:
              id:
                type: string
                description: The product ID.
              product_id:
                type: string
                description: Product ID for SKUs.
              object:
                description: Denotes the type of the object represented by the ID.
                enum:
                  - sku
                  - product
            required:
              - id
              - object
      required:
        - type
        - name
    ProductCollectionsCreateDynamicRequestBody:
      title: Product Collections Create Dynamic (Auto Update) Request Body
      description: Request body schema for **POST** `v1/product-collections`.
      type: object
      properties:
        type:
          type: string
          description: >-
            Show that the product collection is dynamic (products come in and
            leave based on set criteria).
          default: AUTO_UPDATE
          enum:
            - AUTO_UPDATE
        name:
          type: string
          description: Unique user-defined product collection name.
        filter:
          type: object
          description: >-
            Defines a set of criteria and boundary conditions for an
            `AUTO_UPDATE` product collection type.
          required:
            - junction
          properties:
            junction:
              $ref: '#/components/schemas/Junction'
          additionalProperties:
            allOf:
              - $ref: '#/components/schemas/FieldConditions'
            description: >-
              Valid keys: `id`, `product_id`, `source_id`, `name`, `price`,
              `object`, `attributes`, `image_url`, `skus`, `created_at`,
              `updated_at` and `metadata.*`
      required:
        - type
        - name
        - filter
    ProductCollectionsItem:
      title: Product Collection Base
      description: 'This is an object representing a product collection base. '
      type: object
      properties:
        id:
          type: string
          description: Product collection ID.
        name:
          type: string
          example: All Products
          description: Unique user-defined product collection name.
        type:
          type: string
          description: >-
            Describes whether the product collection is dynamic (products come
            in and leave based on set criteria) or static (manually selected
            products).
          enum:
            - STATIC
            - AUTO_UPDATE
        filter:
          type: object
          description: >-
            Defines a set of criteria and boundary conditions for an
            `AUTO_UPDATE` product collection type.
          required:
            - junction
          properties:
            junction:
              $ref: '#/components/schemas/Junction'
          additionalProperties:
            allOf:
              - $ref: '#/components/schemas/FieldConditions'
            description: >-
              Valid keys: `id`, `product_id`, `source_id`, `name`, `price`,
              `object`, `attributes`, `image_url`, `skus`, `created_at`,
              `updated_at` and `metadata.*`
        products:
          description: Defines a set of products for a `STATIC` product collection type.
          type: array
          items:
            title: Product Collections Item Products Item
            type: object
            properties:
              id:
                type: string
                example: prod_0a41bcf807c5fcaaf6
                description: The product ID.
              product_id:
                type: string
                description: Product ID for SKUs.
              object:
                type: string
                enum:
                  - sku
                  - product
                description: Denotes the type of the object represented by the ID.
            required:
              - id
              - object
        created_at:
          type: string
          example: '2021-12-09T12:51:29.898Z'
          description: >-
            Timestamp representing the date and time when the product collection
            was created. The value is shown in the ISO 8601 format.
          format: date-time
        object:
          type: string
          description: >-
            The type of the object represented by JSON. This object stores
            information about the static product collection.
          default: products_collection
          enum:
            - products_collection
      required:
        - id
        - name
        - type
        - created_at
        - object
    Junction:
      title: Junction
      description: >-
        Logical Operator Between Filters. Filter by conditions set on the
        `junction` parameter indicating how the `conditions` should be accounted
        for in the query. An `AND` is an all-inclusive logical operator, meaning
        the `AND` operator displays a record if **ALL** the conditions separated
        by AND are TRUE, while  an `OR` operator displays a record if **ANY** of
        the conditions separated by OR is TRUE.
      enum:
        - and
        - or
      type: string
    FieldConditions:
      title: Field Conditions
      type: object
      properties:
        conditions:
          description: >-
            Data filters used to narrow down the data records to be returned in
            the result.
          allOf:
            - $ref: '#/components/schemas/FiltersCondition'
    FiltersCondition:
      title: Filters Condition
      type: object
      properties:
        $in:
          $ref: '#/components/schemas/Any'
        $not_in:
          $ref: '#/components/schemas/Any'
        $is:
          $ref: '#/components/schemas/Any'
        $is_days_ago:
          $ref: '#/components/schemas/Any'
        $is_days_in_future:
          $ref: '#/components/schemas/Any'
        $is_not:
          $ref: '#/components/schemas/Any'
        $has_value:
          $ref: '#/components/schemas/Any'
        $is_unknown:
          $ref: '#/components/schemas/Any'
        $contains:
          $ref: '#/components/schemas/Any'
        $not_contain:
          $ref: '#/components/schemas/Any'
        $starts_with:
          $ref: '#/components/schemas/Any'
        $ends_with:
          $ref: '#/components/schemas/Any'
        $more_than:
          $ref: '#/components/schemas/Any'
        $less_than:
          $ref: '#/components/schemas/Any'
        $more_than_ago:
          $ref: '#/components/schemas/Any'
        $less_than_ago:
          $ref: '#/components/schemas/Any'
        $more_than_future:
          $ref: '#/components/schemas/Any'
        $less_than_future:
          $ref: '#/components/schemas/Any'
        $more_than_equal:
          $ref: '#/components/schemas/Any'
        $less_than_equal:
          $ref: '#/components/schemas/Any'
        $after:
          $ref: '#/components/schemas/Any'
        $before:
          $ref: '#/components/schemas/Any'
        $count:
          $ref: '#/components/schemas/Any'
        $count_less:
          $ref: '#/components/schemas/Any'
        $count_more:
          $ref: '#/components/schemas/Any'
    Any:
      title: Any
      type: array
      items:
        oneOf:
          - title: string
            type: string
          - title: string - date
            type: string
            format: date
          - title: string - date-time
            type: string
            format: date-time
          - title: number
            type: number
          - title: object
            type: object
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    X-Voucherify-OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://api.voucherify.io/v1/oauth/token
          scopes:
            api: Gives access to whole server-side API.
            vouchers: >-
              Gives access to all endpoints and methods starting with
              `v1/vouchers`.
            client_api: Gives access to whole client-side API.
            client_vouchers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/vouchers`.
            promotions: >-
              Gives access to all endpoints and methods starting with
              `/v1/promotions`.
            client_promotions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/promotions`
            campaigns: >-
              Gives access to all endpoints and methods starting with
              `v1/campaigns`.
            client_publish: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/publish`.
            exports: >-
              Gives access to all endpoints and methods starting with
              `/v1/exports`.
            publications: >-
              Gives access to all endpoints and methods starting with
              `/v1/publications`.
            client_validate: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validate`.
            validations: >-
              Gives access to all endpoints and methods starting with
              `/v1/validations`.
            client_validations: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validations`.
            qualifications: >-
              Gives access to all endpoints and methods starting with
              `/v1/qualifications`.
            client_qualifications: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/qualifications`.
            client_redeem: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redeem
            redemptions: >-
              Gives access to all endpoints and methods starting with
              `/v1/redemptions`.
            client_redemptions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redemptions`
            customers: >-
              Gives access to all endpoints and methods starting with
              `/v1/customers`.
            client_customers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/customers`.
            orders: >-
              Gives access to all endpoints and methods starting with
              `/v1/orders`.
            products: >-
              Gives access to all endpoints and methods starting with
              `/v1/products`.
            skus: >-
              Gives access to all endpoints and methods starting with
              `/v1/SKUs`.
            validation-rules: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules`.
            validation-rules-assignments: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules-assignments
            segments: >-
              Gives access to all endpoints and methods starting with
              `/v1/segments`.
            events: >-
              Gives access to all endpoints and methods starting with
              `/v1/events`.
            client_events: >-
              Gives access to all endpoints and methods starting with
              `client/v1/events`.
            rewards: >-
              Gives access to all endpoints and methods starting with
              `/v1/rewards`.
            assets: >-
              Gives access to all endpoints and methods starting with
              `/v1/assets`.
            task-results: >-
              Gives access to all endpoints and methods starting with
              `/v1/task-results`.
            loyalties: >-
              Gives access to all endpoints and methods starting with
              `/v1/loyalties`.
            client_consents: >-
              Gives access to all endpoints and methods starting with
              `client/v1/consents`.
            consents: >-
              Gives access to all endpoints and methods starting with
              `/v1/consents`.
            async-actions: >-
              Gives access to all endpoints and methods starting with
              `/v1/async-actions`.
            product-collections: >-
              Gives access to all endpoints and methods starting with
              `/v1/product-collections`.
            categories: >-
              Gives access to all endpoints and methods starting with
              `/v1/categories`.
            metadata-schemas: >-
              Gives access to all endpoints and methods starting with
              `/v1/metadata-schemas`.
            locations: >-
              Gives access to all endpoints and methods starting with
              `/v1/locations`.
            referrals: >-
              Gives access to all endpoints and methods starting with
              `/v1/referrals`.
            trash-bin: >-
              Gives access to all endpoints and methods starting with
              `/v1/trash-bin`.
            templates: >-
              Gives access to all endpoints and methods starting with
              `/v1/templates`.

````