Commerce Layer flex_promotions API

resource type

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

commerce-layer-flex-promotions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Commerce Layer addresses flex_promotions API
  version: 7.10.1
  contact:
    name: API Support
    url: https://commercelayer.io
    email: support@commercelayer.io
  description: Headless Commerce for Global Brands.
servers:
- url: https://{your_organization_slug}.commercelayer.io/api
  description: API
- url: https://core.commercelayer.io/users/sign_in
  description: Sign in
- url: https://docs.commercelayer.io/api
  description: API reference
security:
- bearerAuth: []
tags:
- name: flex_promotions
  description: resource type
paths:
  /flex_promotions:
    get:
      operationId: GET/flex_promotions
      summary: List all flex promotions
      description: List all flex promotions
      tags:
      - flex_promotions
      responses:
        '200':
          description: A list of flex promotion objects
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/flexPromotionResponseList'
    post:
      operationId: POST/flex_promotions
      summary: Create a flex promotion
      description: Create a flex promotion
      tags:
      - flex_promotions
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/flexPromotionCreate'
      responses:
        '201':
          description: The created flex promotion object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/flexPromotionResponse'
  /flex_promotions/{flexPromotionId}:
    get:
      operationId: GET/flex_promotions/flexPromotionId
      summary: Retrieve a flex promotion
      description: Retrieve a flex promotion
      tags:
      - flex_promotions
      parameters:
      - name: flexPromotionId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '200':
          description: The flex promotion object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/flexPromotionResponse'
    patch:
      operationId: PATCH/flex_promotions/flexPromotionId
      summary: Update a flex promotion
      description: Update a flex promotion
      tags:
      - flex_promotions
      parameters:
      - name: flexPromotionId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/flexPromotionUpdate'
      responses:
        '200':
          description: The updated flex promotion object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/flexPromotionResponse'
    delete:
      operationId: DELETE/flex_promotions/flexPromotionId
      summary: Delete a flex promotion
      description: Delete a flex promotion
      tags:
      - flex_promotions
      parameters:
      - name: flexPromotionId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '204':
          description: No content
components:
  schemas:
    flexPromotionCreate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - flex_promotions
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The promotion's internal name.
                  example: Personal promotion
                exclusive:
                  type: boolean
                  description: Indicates if the promotion will be applied exclusively, based on its priority score.
                  example: true
                priority:
                  type: integer
                  description: The priority assigned to the promotion (lower means higher priority).
                  example: 2
                starts_at:
                  type: string
                  description: The activation date/time of this promotion.
                  example: '2018-01-01T12:00:00.000Z'
                expires_at:
                  type: string
                  description: The expiration date/time of this promotion (must be after starts_at).
                  example: '2018-01-02T12:00:00.000Z'
                total_usage_limit:
                  type: integer
                  description: The total number of times this promotion can be applied. When 'null' it means promotion can be applied infinite times.
                  example: 5
                rules:
                  type: object
                  description: The discount rule to be applied.
                  example: {}
                _disable:
                  type: boolean
                  description: Send this attribute if you want to mark this resource as disabled.
                  example: true
                _enable:
                  type: boolean
                  description: Send this attribute if you want to mark this resource as enabled.
                  example: true
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
              required:
              - name
              - starts_at
              - expires_at
              - rules
            relationships:
              type: object
              properties:
                coupon_codes_promotion_rule:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - coupon_codes_promotion_rules
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                tags:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - tags
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
    flexPromotionResponseList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/flexPromotionResponse/properties/data'
    flexPromotion:
      properties:
        data:
          properties:
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The promotion's internal name.
                  example: Personal promotion
                  nullable: false
                type:
                  type: string
                  description: The promotion's type.
                  example: percentage_discount_promotions
                  nullable: false
                  enum:
                  - percentage_discount_promotions
                  - free_shipping_promotions
                  - buy_x_pay_y_promotions
                  - free_gift_promotions
                  - fixed_price_promotions
                  - external_promotions
                  - fixed_amount_promotions
                  - flex_promotions
                exclusive:
                  type: boolean
                  description: Indicates if the promotion will be applied exclusively, based on its priority score.
                  example: true
                  nullable: true
                priority:
                  type: integer
                  description: The priority assigned to the promotion (lower means higher priority).
                  example: 2
                  nullable: true
                starts_at:
                  type: string
                  description: The activation date/time of this promotion.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                expires_at:
                  type: string
                  description: The expiration date/time of this promotion (must be after starts_at).
                  example: '2018-01-02T12:00:00.000Z'
                  nullable: false
                total_usage_limit:
                  type: integer
                  description: The total number of times this promotion can be applied. When 'null' it means promotion can be applied infinite times.
                  example: 5
                  nullable: true
                total_usage_count:
                  type: integer
                  description: The number of times this promotion has been applied.
                  example: 2
                  nullable: true
                active:
                  type: boolean
                  description: Indicates if the promotion is active (enabled and not expired).
                  example: true
                  nullable: true
                status:
                  type: string
                  description: The promotion status. One of 'disabled', 'expired', 'pending', 'active', or 'inactive'.
                  example: pending
                  nullable: true
                  enum:
                  - disabled
                  - expired
                  - pending
                  - active
                  - inactive
                rules:
                  type: object
                  description: The discount rule to be applied.
                  example: {}
                  nullable: false
                rule_outcomes:
                  type: object
                  description: The rule outcomes.
                  example: []
                  nullable: true
                disabled_at:
                  type: string
                  description: Time at which this resource was disabled.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: true
                created_at:
                  type: string
                  description: Time at which the resource was created.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                updated_at:
                  type: string
                  description: Time at which the resource was last updated.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                resource_payload:
                  type: object
                  description: The payload used to evaluate the rules.
                  example: {}
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
    flexPromotionResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: Unique identifier for the resource (hash).
              example: XAyRWNUzyN
            type:
              type: string
              description: The resource's type
              enum:
              - flex_promotions
            links:
              type: object
              properties:
                self:
                  type: string
                  description: URL
            attributes:
              $ref: '#/components/schemas/flexPromotion/properties/data/properties/attributes'
            relationships:
              type: object
              properties:
                coupon_codes_promotion_rule:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - coupon_codes_promotion_rule
                        id:
                          type: string
                          description: The resource ID
                coupons:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - coupons
                        id:
                          type: string
                          description: The resource ID
                attachments:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - attachments
                        id:
                          type: string
                          description: The resource ID
                events:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - events
                        id:
                          type: string
                          description: The resource ID
                tags:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - tags
                        id:
                          type: string
                          description: The resource ID
                event_stores:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - event_stores
                        id:
                          type: string
                          description: The resource ID
    flexPromotionUpdate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - id
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - flex_promotions
            id:
              type: string
              description: Unique identifier for the resource (hash).
              example: XAyRWNUzyN
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: The promotion's internal name.
                  example: Personal promotion
                  nullable: false
                exclusive:
                  type: boolean
                  description: Indicates if the promotion will be applied exclusively, based on its priority score.
                  example: true
                  nullable: false
                priority:
                  type: integer
                  description: The priority assigned to the promotion (lower means higher priority).
                  example: 2
                  nullable: true
                starts_at:
                  type: string
                  description: The activation date/time of this promotion.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                expires_at:
                  type: string
                  description: The expiration date/time of this promotion (must be after starts_at).
                  example: '2018-01-02T12:00:00.000Z'
                  nullable: false
                total_usage_limit:
                  type: integer
                  description: The total number of times this promotion can be applied. When 'null' it means promotion can be applied infinite times.
                  example: 5
                  nullable: true
                rules:
                  type: object
                  description: The discount rule to be applied.
                  example: {}
                  nullable: false
                _disable:
                  type: boolean
                  description: Send this attribute if you want to mark this resource as disabled.
                  example: true
                  nullable: false
                _enable:
                  type: boolean
                  description: Send this attribute if you want to mark this resource as enabled.
                  example: true
                  nullable: false
                _add_tags:
                  type: string
                  description: Comma separated list of tags to be added. Duplicates, invalid and non existing ones are discarded. Cannot be passed by sales channels.
                _remove_tags:
                  type: string
                  description: Comma separated list of tags to be removed. Duplicates, invalid and non existing ones are discarded. Cannot be passed by sales channels.
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
            relationships:
              type: object
              properties:
                coupon_codes_promotion_rule:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - coupon_codes_promotion_rules
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
                tags:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - tags
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT