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

# Upsert Group And Usecases

> Create or update a UseCaseGroup and REPLACE its use-case configs with the provided list in one call.

- If payload.group_id is provided, update the existing group; otherwise create a new one.
- The set of configs under the group will be made to exactly match payload.use_cases.
  • If payload.use_cases is empty, all existing configs for the group are deleted.



## OpenAPI

````yaml https://api-qa.interactly.ai/api-docs/integrations/api.json post /integrations/v1/integrations/{integration}/use-case-groups
openapi: 3.1.0
info:
  title: Interactly API
  description: API for building interactly.ai services
  version: 1.1.0
  contact:
    name: Interactly
    url: https://interactly.ai
    email: developers@interactly.ai
servers:
  - url: https://api-qa.interactly.ai
    description: API Server
security: []
paths:
  /integrations/v1/integrations/{integration}/use-case-groups:
    post:
      tags:
        - Use Cases
      summary: Upsert Group And Usecases
      description: >-
        Create or update a UseCaseGroup and REPLACE its use-case configs with
        the provided list in one call.


        - If payload.group_id is provided, update the existing group; otherwise
        create a new one.

        - The set of configs under the group will be made to exactly match
        payload.use_cases.
          • If payload.use_cases is empty, all existing configs for the group are deleted.
      operationId: >-
        integrations_service_upsert_group_and_usecases_v1_integrations__integration__use_case_groups_post
      parameters:
        - name: integration
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/IntegrationType'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UseCaseGroupUpsertRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - bearer: []
components:
  schemas:
    IntegrationType:
      type: string
      enum:
        - microsoft
        - google
      title: IntegrationType
    UseCaseGroupUpsertRequest:
      properties:
        name:
          type: string
          title: Name
          description: Human friendly group name
        slug:
          anyOf:
            - type: string
            - type: 'null'
          title: Slug
          description: Optional explicit slug; if omitted will be generated
        sheet_link:
          anyOf:
            - type: string
            - type: 'null'
          title: Sheet Link
          description: Associated sheet link for this group
        assistant_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Assistant Id
          description: Assistant identifier bound to this group
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
          description: Timezone identifier e.g. America/Chicago
        start_time:
          anyOf:
            - type: string
              format: time
            - type: 'null'
          title: Start Time
          description: Time of day to run the use-case group (HH:MM:SS)
        group_id:
          anyOf:
            - type: string
              maxLength: 24
              minLength: 24
              pattern: ^[0-9a-f]{24}$
              example: 5eb7cf5a86d9755df3a6c593
            - type: 'null'
          title: Group Id
          description: >-
            If provided, updates the existing group; otherwise creates a new
            group
        use_cases:
          items:
            $ref: '#/components/schemas/UseCaseConfigPayload'
          type: array
          title: Use Cases
          description: List of use-case configurations to upsert under this group
      type: object
      required:
        - name
      title: UseCaseGroupUpsertRequest
      example:
        assistant_id: 68a8652f82513625d1c21a85
        name: Appointment Reminders
        sheet_link: https://1drv.ms/x/...
        start_time: '08:00:00'
        timezone: America/Chicago
        use_cases:
          - actions:
              - action_type: SMS
                context: reminder_7d
                day: 7
                template_name: First SMS
              - action_type: CALL
                context: reminder_1d
                day: 1
                template_name: Day 1 Call
            enabled: true
            use_case: NEW_PATIENT_APPOINTMENT_REMINDER
          - actions:
              - action_type: SMS
                context: lab_result_sms
                day: 0
                template_name: Lab Result SMS
            enabled: true
            use_case: LAB_REMINDER
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UseCaseConfigPayload:
      properties:
        use_case:
          $ref: '#/components/schemas/UseCaseType'
        enabled:
          type: boolean
          title: Enabled
          default: true
        actions:
          items:
            $ref: '#/components/schemas/ActionConfig'
          type: array
          title: Actions
      type: object
      required:
        - use_case
        - actions
      title: UseCaseConfigPayload
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    UseCaseType:
      type: string
      enum:
        - NEW_PATIENT_APPOINTMENT_REMINDER
        - LAB_REMINDER
        - REFERRAL
        - FINAL_APPOINTMENT_NOTIFICATION
      title: UseCaseType
    ActionConfig:
      properties:
        day:
          type: integer
          title: Day
          description: >-
            Numeric day value interpreted according to day_mode. day_before /
            day_after: simple day offset (e.g. 7 = 7 days before/after reference
            date). weekday_before / weekday_after: week+weekday encoding — 1=1st
            Mon, 2=1st Tue, ..., 7=1st Sun, 8=2nd Mon, etc.
        day_mode:
          $ref: '#/components/schemas/DayMode'
          description: >-
            How to interpret the day field. 'day_before': X days before
            reference date (default). 'day_after': X days after reference date.
            'weekday_before': week+weekday encoding before reference date.
            'weekday_after': week+weekday encoding after reference date.
          default: day_before
        weekend_behavior:
          $ref: '#/components/schemas/WeekendBehavior'
          description: >-
            How to handle target dates that fall on weekends. 'none': no
            adjustment (default). 'next_weekday': Sat/Sun → Monday.
            'previous_weekday': Sat/Sun → Friday.
          default: none
        action_type:
          $ref: '#/components/schemas/ActionType'
        template_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Name
          description: >-
            Optional human-friendly label for the action (e.g. 'First SMS',
            'Second Call')
        context:
          anyOf:
            - type: string
            - type: 'null'
          title: Context
          description: Optional template / script / channel identifier as a simple string
      type: object
      required:
        - day
        - action_type
      title: ActionConfig
    DayMode:
      type: string
      enum:
        - day_before
        - day_after
        - weekday_before
        - weekday_after
      title: DayMode
    WeekendBehavior:
      type: string
      enum:
        - none
        - next_weekday
        - previous_weekday
      title: WeekendBehavior
    ActionType:
      type: string
      enum:
        - CALL
        - SMS
      title: ActionType
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: Bearer
      type: http
      description: >-
        Retrieve your API Key from [Dashboard API Keys
        Section](https://dashboard-qa.interactly.ai/api-keys).

````