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

# Create a Promotion

> Creates a Promotion



## OpenAPI

````yaml /api-reference/platform.yaml post /api/v2/platform/promotions
openapi: 3.0.3
info:
  title: Platform API
  contact:
    name: Vendo Connect Inc.
    url: https://getvendo.com
    email: sales@getvendo.com
  description: Spree Platform API
  version: v2
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Addresses
  - name: Adjustments
  - name: Classifications
  - name: Countries
  - name: CMS Pages
  - name: CMS Sections
  - name: Digital Assets
  - name: Digital Links
  - name: Line Items
  - name: Menus
  - name: Menu Items
  - name: Option Types
  - name: Option Values
  - name: Orders
  - name: Payments
  - name: Payment Methods
  - name: Products
  - name: Promotions
  - name: Promotion Actions
  - name: Promotion Categories
  - name: Promotion Rules
  - name: Roles
  - name: Shipments
  - name: Shipping Categories
  - name: Shipping Methods
  - name: States
  - name: Stock Items
  - name: Stock Locations
  - name: Store Credit Categories
  - name: Store Credit Types
  - name: Store Credits
  - name: Tax Categories
  - name: Tax Rates
  - name: Taxons
  - name: Taxonomies
  - name: Users
  - name: Variants
  - name: Vendors
  - name: Webhook Events
  - name: Webhook Subscribers
  - name: Wishlists
  - name: Wished Items
  - name: Zones
paths:
  /api/v2/platform/promotions:
    post:
      tags:
        - Promotions
      summary: Create a Promotion
      description: Creates a Promotion
      operationId: create-promotion
      parameters:
        - name: include
          in: query
          description: >-
            Select which associated resources you would like to fetch, see: <a
            href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
          example: promotion_category,promotion_rules,promotion_actions,stores
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create_promotion_params'
      responses:
        '201':
          description: Record created
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    data:
                      id: '35'
                      type: promotion
                      attributes:
                        description: First 1000 Customers Save 20%
                        expires_at: '2022-11-12T19:35:03.283Z'
                        starts_at: '2022-11-08T19:35:03.283Z'
                        name: Black Friday 20% Off
                        type: Spree::Promotion
                        usage_limit: 1000
                        match_policy: any
                        code: BLK-20
                        advertise: true
                        path: /black-fri/today
                        created_at: '2022-11-08T19:35:03.521Z'
                        updated_at: '2022-11-08T19:35:03.533Z'
                        public_metadata: {}
                        private_metadata: {}
                      relationships:
                        promotion_category:
                          data:
                            id: '15'
                            type: promotion_category
                        promotion_rules:
                          data: []
                        promotion_actions:
                          data: []
                        stores:
                          data:
                            - id: '382'
                              type: store
                            - id: '383'
                              type: store
                            - id: '381'
                              type: store
              schema:
                $ref: '#/components/schemas/resource'
        '422':
          description: Invalid request
          content:
            application/vnd.api+json:
              examples:
                Example:
                  value:
                    error: Name can't be blank
                    errors:
                      name:
                        - can't be blank
              schema:
                $ref: '#/components/schemas/validation_errors'
      security:
        - bearer_auth: []
components:
  schemas:
    create_promotion_params:
      type: object
      properties:
        promotion:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              example: Promotions Used in 2021
              description: Give the promotion a name.
            code:
              type: string
              example: BLK-FRI
              nullable: true
              description: >-
                Set the promotion code. Promotions without a code are
                automatically applied if the order meets the Promotion Rule
                requirements.
            description:
              type: string
              example: Save today with discount code XYZ at checkout.
              nullable: true
              description: Give the promotion a description.
            usage_limit:
              type: integer
              example: 100
              nullable: true
              description: If you wish you can set a usage limit for this promotion.
            advertise:
              type: boolean
            starts_at:
              type: string
              format: date_time
              nullable: true
              description: Set a date and time that this promotion begins.
            ends_at:
              type: string
              format: date_time
              nullable: true
              description: Set a date and time that this promotion ends.
            store_ids:
              type: array
              items:
                allOf:
                  - type: string
                    example: '2'
      required:
        - promotion
      title: Create a Promotion
      x-internal: false
    resource:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/resource_properties'
      required:
        - data
      x-internal: false
    validation_errors:
      type: object
      properties:
        error:
          type: string
        errors:
          type: object
      required:
        - error
        - errors
      x-internal: false
    resource_properties:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
        attributes:
          type: object
        relationships:
          type: object
      required:
        - id
        - type
        - attributes
      x-internal: false
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````