Skilljar Promo Codes > Codes API

The Promo Codes > Codes API from Skilljar — 2 operation(s) for promo codes > codes.

OpenAPI Specification

skilljar-promo-codes-codes-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Skilljar Assets Promo Codes > Codes API
  version: 1.0.0
  description: 'The Skilljar API provides comprehensive access to our customer education platform, enabling you to programmatically manage courses, users, enrollments, and more.


    This interactive documentation is automatically generated from our codebase and stays current with the latest features and endpoints.


    ## Getting Started


    New to the Skilljar API? Check out these essential resources:


    - **[API Getting Started Guide](https://support.gainsight.com/Skilljar/Develop_and_Customize/API/Getting_started_with_the_Skilljar_API)** - Authentication, basic concepts, and your first API call

    - **[Token-based SSO](https://support.gainsight.com/Skilljar/Develop_and_Customize/Single_Sign_on_(SSO)/Configuring_Token-Based_Single_Sign-On_(SSO))** - Seamlessly integrate user authentication

    - **[Webhooks](https://support.gainsight.com/Skilljar/Develop_and_Customize/API/Using_Webhooks_API)** - Real-time notifications for platform events

    '
tags:
- name: Promo Codes > Codes
paths:
  /v1/promo-codes:
    get:
      operationId: promo_codes_list
      description: 'Retrieve a paginated list of Promo Codes for your organization.


        Supports filtering by pool ID, code, and active status. Results are paginated (1000 per page).'
      parameters:
      - in: query
        name: active
        schema:
          type: boolean
        description: Filter results by active (true or false)
      - in: query
        name: code
        schema:
          type: string
        description: Filter results by the code used - case sensitive
      - name: page
        required: false
        in: query
        description: A page number within the paginated result set.
        schema:
          type: integer
      - name: page_size
        required: false
        in: query
        description: Number of results to return per page.
        schema:
          type: integer
      - in: query
        name: promo_code_pool_id
        schema:
          type: string
        description: Filter results by the id of a Offer
      tags:
      - Promo Codes > Codes
      security:
      - OrganizationApiKey: []
      - tokenAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedPromoCodeList'
          description: ''
    post:
      operationId: promo_codes_create
      description: 'Create a new Promo Code.


        The associated Promo Code Pool must exist before creating a promo code.'
      tags:
      - Promo Codes > Codes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromoCodeRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PromoCodeRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PromoCodeRequest'
        required: true
      security:
      - OrganizationApiKey: []
      - tokenAuth: []
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromoCode'
          description: ''
  /v1/promo-codes/{promo_code_id}:
    get:
      operationId: promo_codes_retrieve
      description: 'Retrieve details for a specific Promo Code.


        Returns all configuration and status information for the promo code.'
      parameters:
      - in: path
        name: promo_code_id
        schema:
          type: string
          pattern: ^[0-9a-z]+$
        required: true
      tags:
      - Promo Codes > Codes
      security:
      - OrganizationApiKey: []
      - tokenAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromoCode'
          description: ''
    put:
      operationId: promo_codes_update
      description: 'Update one or more fields of a Promo Code.


        Both PUT and PATCH requests perform partial updates.'
      parameters:
      - in: path
        name: promo_code_id
        schema:
          type: string
          pattern: ^[0-9a-z]+$
        required: true
      tags:
      - Promo Codes > Codes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromoCodeUpdateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PromoCodeUpdateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PromoCodeUpdateRequest'
        required: true
      security:
      - OrganizationApiKey: []
      - tokenAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromoCodeUpdate'
          description: ''
    patch:
      operationId: promo_codes_partial_update
      description: 'Update one or more fields of a Promo Code.


        Both PUT and PATCH requests perform partial updates.'
      parameters:
      - in: path
        name: promo_code_id
        schema:
          type: string
          pattern: ^[0-9a-z]+$
        required: true
      tags:
      - Promo Codes > Codes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedPromoCodeUpdateRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedPromoCodeUpdateRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedPromoCodeUpdateRequest'
      security:
      - OrganizationApiKey: []
      - tokenAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromoCodeUpdate'
          description: ''
    delete:
      operationId: promo_codes_destroy
      description: 'Delete a Promo Code.


        This action cannot be undone.'
      parameters:
      - in: path
        name: promo_code_id
        schema:
          type: string
          pattern: ^[0-9a-z]+$
        required: true
      tags:
      - Promo Codes > Codes
      security:
      - OrganizationApiKey: []
      - tokenAuth: []
      responses:
        '204':
          description: No response body
components:
  schemas:
    PromoCodeUpdateRequest:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          maxLength: 40
        max_uses:
          type: integer
        active:
          type: boolean
          default: true
      required:
      - code
      - max_uses
    PatchedPromoCodeUpdateRequest:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          maxLength: 40
        max_uses:
          type: integer
        active:
          type: boolean
          default: true
    PromoCode:
      type: object
      properties:
        id:
          type: string
          readOnly: true
          description: Known as promo_code_id within the documentation
        code:
          type: string
          maxLength: 40
        use_count:
          type: integer
          readOnly: true
        max_uses:
          type: integer
        active:
          type: boolean
          default: true
        promo_code_pool_id:
          type: string
      required:
      - code
      - max_uses
      - promo_code_pool_id
    PromoCodeUpdate:
      type: object
      properties:
        id:
          type: string
          readOnly: true
          description: Known as promo_code_id within the documentation
        code:
          type: string
          maxLength: 40
        use_count:
          type: integer
          readOnly: true
        max_uses:
          type: integer
        active:
          type: boolean
          default: true
        promo_code_pool_id:
          type: string
          readOnly: true
      required:
      - code
      - max_uses
    PromoCodeRequest:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          maxLength: 40
        max_uses:
          type: integer
        active:
          type: boolean
          default: true
        promo_code_pool_id:
          type: string
          minLength: 1
      required:
      - code
      - max_uses
      - promo_code_pool_id
    PaginatedPromoCodeList:
      type: object
      required:
      - count
      - results
      properties:
        count:
          type: integer
          example: 123
        next:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?page=4
        previous:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?page=2
        results:
          type: array
          items:
            $ref: '#/components/schemas/PromoCode'
  securitySchemes:
    OrganizationApiKey:
      type: http
      scheme: basic
      description: API key authentication using HTTP Basic Auth. Use your API key as the username and leave password empty.
    tokenAuth:
      type: http
      scheme: bearer