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

# Create an Offer

> Creates an offer with its settings, accesses and prices. Offers are unpublished by default.



## OpenAPI

````yaml post /offers
openapi: 3.0.1
info:
  title: SchoolMaker API V1
  description: API for managing your SchoolMaker school
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://schoolmaker.co/api/v1
    description: Production API
security:
  - bearerAuth: []
paths:
  /offers:
    post:
      tags:
        - Offers
      summary: Create an Offer
      description: >-
        Creates an offer with its settings, accesses and prices. Offers are
        unpublished by default.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - type: object
                  properties:
                    name:
                      type: string
                      maxLength: 255
                      minLength: 1
                      description: Offer name. Required when creating and cannot be blank.
                    title:
                      type: string
                      maxLength: 255
                      nullable: true
                    description:
                      type: string
                      maxLength: 200000
                      nullable: true
                    long_description:
                      type: string
                      maxLength: 200000
                      description: >-
                        Formatted offer description. Omit to keep the current
                        description or use null to clear it.
                      nullable: true
                    is_published:
                      type: boolean
                      description: >-
                        Whether the offer and payment pages are published.
                        Unpublishing keeps member accesses. Deleting the offer
                        removes them.
                    is_access_program_shown:
                      type: boolean
                      nullable: true
                      description: >-
                        Omit to keep the current value. Cannot be null on
                        update.
                    is_search_engine_indexing_enabled:
                      type: boolean
                      nullable: true
                      description: >-
                        Omit to keep the current value. Cannot be null on
                        update.
                    max_purchase_amount:
                      type: integer
                      minimum: 0
                      nullable: true
                      description: >-
                        Omit to keep the current value. Cannot be null on
                        update.
                    trial_period_days:
                      type: integer
                      minimum: 0
                      nullable: true
                    trial_period_days_multiplier:
                      type: integer
                      minimum: 0
                      nullable: true
                    settings_allow_multiple_purchase:
                      type: boolean
                    accesses_attributes:
                      type: array
                      maxItems: 100
                      items:
                        type: object
                        additionalProperties: false
                        properties:
                          id:
                            type: string
                            minLength: 1
                            maxLength: 255
                          element_type:
                            type: string
                            enum:
                              - Product
                              - Forums::Category
                              - Meetings::Category
                              - Lives::Category
                              - Coachings::Type
                              - AiAssistant
                          element_id:
                            type: string
                            minLength: 1
                            maxLength: 255
                          access_type:
                            type: string
                            enum:
                              - lifetime
                              - subscription
                              - limited
                          end_delay:
                            type: integer
                            minimum: 1
                          quantity:
                            type: integer
                            minimum: 1
                          quantity_hours:
                            type: integer
                            minimum: 0
                          quantity_minutes:
                            type: integer
                            minimum: 0
                          _destroy:
                            type: boolean
                          lesson_ids:
                            type: array
                            items:
                              type: string
                              minLength: 1
                              maxLength: 255
                            maxItems: 100
                            description: >-
                              Program lessons to enable. Omit to include all
                              current lessons when creating or keep the
                              selection when updating. An empty array disables
                              all current lessons.
                    prices_attributes:
                      type: array
                      maxItems: 20
                      items:
                        type: object
                        additionalProperties: false
                        properties:
                          id:
                            type: string
                            minLength: 1
                            maxLength: 255
                          price_type:
                            type: string
                            enum:
                              - one-time
                              - recurring
                              - multiple-installments
                          recurring_interval:
                            type: string
                            enum:
                              - day
                              - week
                              - month
                              - year
                          recurring_interval_count:
                            type: integer
                            minimum: 1
                          recurring_iterations:
                            type: integer
                            minimum: 2
                          amount:
                            type: number
                            minimum: 0
                          _destroy:
                            type: boolean
                      description: >-
                        Add prices without an ID. Existing amounts and billing
                        terms cannot be changed. To archive a price, supply its
                        id and _destroy: true. Existing purchases are kept.
                    content_format:
                      type: string
                      enum:
                        - html
                        - markdown
                      description: >-
                        Format of long_description. Defaults to HTML. Markdown
                        is also supported.
                  additionalProperties: false
                  description: Offer details, accesses and prices.
                  required:
                    - name
                - type: object
                  required:
                    - attributes
                  properties:
                    attributes:
                      type: object
                      properties:
                        name:
                          type: string
                          maxLength: 255
                          minLength: 1
                          description: >-
                            Offer name. Required when creating and cannot be
                            blank.
                        title:
                          type: string
                          maxLength: 255
                          nullable: true
                        description:
                          type: string
                          maxLength: 200000
                          nullable: true
                        long_description:
                          type: string
                          maxLength: 200000
                          description: >-
                            Formatted offer description. Omit to keep the
                            current description or use null to clear it.
                          nullable: true
                        is_published:
                          type: boolean
                          description: >-
                            Whether the offer and payment pages are published.
                            Unpublishing keeps member accesses. Deleting the
                            offer removes them.
                        is_access_program_shown:
                          type: boolean
                          nullable: true
                          description: >-
                            Omit to keep the current value. Cannot be null on
                            update.
                        is_search_engine_indexing_enabled:
                          type: boolean
                          nullable: true
                          description: >-
                            Omit to keep the current value. Cannot be null on
                            update.
                        max_purchase_amount:
                          type: integer
                          minimum: 0
                          nullable: true
                          description: >-
                            Omit to keep the current value. Cannot be null on
                            update.
                        trial_period_days:
                          type: integer
                          minimum: 0
                          nullable: true
                        trial_period_days_multiplier:
                          type: integer
                          minimum: 0
                          nullable: true
                        settings_allow_multiple_purchase:
                          type: boolean
                        accesses_attributes:
                          type: array
                          maxItems: 100
                          items:
                            type: object
                            additionalProperties: false
                            properties:
                              id:
                                type: string
                                minLength: 1
                                maxLength: 255
                              element_type:
                                type: string
                                enum:
                                  - Product
                                  - Forums::Category
                                  - Meetings::Category
                                  - Lives::Category
                                  - Coachings::Type
                                  - AiAssistant
                              element_id:
                                type: string
                                minLength: 1
                                maxLength: 255
                              access_type:
                                type: string
                                enum:
                                  - lifetime
                                  - subscription
                                  - limited
                              end_delay:
                                type: integer
                                minimum: 1
                              quantity:
                                type: integer
                                minimum: 1
                              quantity_hours:
                                type: integer
                                minimum: 0
                              quantity_minutes:
                                type: integer
                                minimum: 0
                              _destroy:
                                type: boolean
                              lesson_ids:
                                type: array
                                items:
                                  type: string
                                  minLength: 1
                                  maxLength: 255
                                maxItems: 100
                                description: >-
                                  Program lessons to enable. Omit to include all
                                  current lessons when creating or keep the
                                  selection when updating. An empty array
                                  disables all current lessons.
                        prices_attributes:
                          type: array
                          maxItems: 20
                          items:
                            type: object
                            additionalProperties: false
                            properties:
                              id:
                                type: string
                                minLength: 1
                                maxLength: 255
                              price_type:
                                type: string
                                enum:
                                  - one-time
                                  - recurring
                                  - multiple-installments
                              recurring_interval:
                                type: string
                                enum:
                                  - day
                                  - week
                                  - month
                                  - year
                              recurring_interval_count:
                                type: integer
                                minimum: 1
                              recurring_iterations:
                                type: integer
                                minimum: 2
                              amount:
                                type: number
                                minimum: 0
                              _destroy:
                                type: boolean
                          description: >-
                            Add prices without an ID. Existing amounts and
                            billing terms cannot be changed. To archive a price,
                            supply its id and _destroy: true. Existing purchases
                            are kept.
                        content_format:
                          type: string
                          enum:
                            - html
                            - markdown
                          description: >-
                            Format of long_description. Defaults to HTML.
                            Markdown is also supported.
                      additionalProperties: false
                      description: Offer details, accesses and prices.
                      required:
                        - name
                  additionalProperties: false
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                  title:
                    type: string
                    nullable: true
                  long_description:
                    type: string
                    nullable: true
                  is_published:
                    type: boolean
                  is_access_program_shown:
                    type: boolean
                    nullable: true
                  is_search_engine_indexing_enabled:
                    type: boolean
                    nullable: true
                  max_purchase_amount:
                    type: integer
                    nullable: true
                  trial_period_days:
                    type: integer
                    nullable: true
                  trial_period_days_multiplier:
                    type: integer
                    nullable: true
                  settings_allow_multiple_purchase:
                    type: boolean
                  id:
                    type: string
                  image_cover_url:
                    type: string
                    nullable: true
                  accesses:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        element_id:
                          type: string
                        element_type:
                          type: string
                        access_type:
                          type: string
                        end_delay:
                          type: integer
                        quantity:
                          type: integer
                        lessons:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              is_enabled:
                                type: boolean
                  prices:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        amount:
                          oneOf:
                            - type: number
                            - type: string
                        price_type:
                          type: string
                        recurring_interval:
                          type: string
                        recurring_interval_count:
                          type: integer
                        recurring_iterations:
                          type: integer
        '401':
          description: Missing or invalid API credentials.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                error: Access denied
        '404':
          description: Record not found in your school.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                error: Record not found
        '422':
          description: Invalid offer details.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                error: 'Invalid arguments: /attributes/name minLength'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.