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

# Apply a config bundle

> Reconcile a config-as-code bundle. With a PROJECT API key, submit project-scoped resources (agents, personas, flows, collectors, metrics, ...). With an ORGANIZATION API key, submit `kind: project` resources, each optionally carrying its members and its own nested `resources`. Submit the full desired set; managed resources are updated, new ones created, and (unless prune is false) managed resources absent from the bundle are deleted. Identity is by name.



## OpenAPI

````yaml /api-reference/openapi.documented.json post /v1/config/apply
openapi: 3.1.0
info:
  title: Roark Analytics API
  description: >-
    The Roark Analytics API gives you access to the same API that powers the
    award winning Roark Analytics platform.
  version: 1.0.0
servers:
  - description: Production
    url: https://api.roark.ai
security:
  - Bearer: []
tags:
  - name: Agent
  - name: Agent Endpoint
  - name: Call
  - name: Chat
  - name: Metric
  - name: Metric Policy
  - name: Metric Collection Job
  - name: Customer Flow
  - name: Customer Flow Edge Case
  - name: Simulation
  - name: Simulation Persona
  - name: Simulation Environment
  - name: Simulation Scenario
  - name: Simulation Run Plan
  - name: Simulation Template
  - name: Simulation Run Plan Job
  - name: Simulation Job
  - name: HTTP Request Definition
  - name: Webhook
  - name: Issue
  - name: Autoimprove
  - name: Agent Config
  - name: Knowledge Base
  - name: Config
  - name: Organization Project
  - name: Organization Project Member
  - name: Organization Project API Key
  - name: Organization Config
  - name: CLI Auth
  - name: Me
  - name: Project
  - name: Usage
  - name: Benchmark
  - name: Health
  - name: Prospect Simulation
paths:
  /v1/config/apply:
    post:
      tags:
        - Config
      summary: Apply a config bundle
      description: >-
        Reconcile a config-as-code bundle. With a PROJECT API key, submit
        project-scoped resources (agents, personas, flows, collectors, metrics,
        ...). With an ORGANIZATION API key, submit `kind: project` resources,
        each optionally carrying its members and its own nested `resources`.
        Submit the full desired set; managed resources are updated, new ones
        created, and (unless prune is false) managed resources absent from the
        bundle are deleted. Identity is by name.
      operationId: postV1ConfigApply
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigBundle'
      responses:
        '200':
          description: The applied changes
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ConfigApplyResponse'
                required:
                  - data
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Validation error
              example:
                type: validation
                code: invalid_parameter
                message: The request was invalid
                param: email
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Authentication error
              example:
                type: authentication
                code: unauthorized
                message: Authentication required
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Permission error
              example:
                type: forbidden
                code: permission_denied
                message: You do not have permission to access this resource
          description: Forbidden
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Rate limit error
              example:
                type: rate_limit
                code: too_many_requests
                message: Rate limit exceeded
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Server error
              example:
                type: internal
                code: internal_error
                message: Internal server error
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Roark from '@roarkanalytics/sdk';


            const client = new Roark({
              bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
            });


            const response = await client.config.apply({ resources: [{ kind:
            'agent', name: 'x' }] });


            console.log(response.data);
        - lang: Python
          source: |-
            import os
            from roark_analytics import Roark

            client = Roark(
                bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"),  # This is the default and can be omitted
            )
            response = client.config.apply(
                resources=[{
                    "kind": "agent",
                    "name": "x",
                }],
            )
            print(response.data)
components:
  schemas:
    ConfigBundle:
      type: object
      properties:
        resources:
          type: array
          items:
            anyOf:
              - anyOf:
                  - $ref: '#/components/schemas/AgentConfig'
                  - $ref: '#/components/schemas/HttpRequestDefinitionConfig'
                  - $ref: '#/components/schemas/PersonaConfig'
                  - $ref: '#/components/schemas/ImprovFlowConfig'
                  - $ref: '#/components/schemas/ScriptedFlowConfig'
                  - $ref: '#/components/schemas/CollectorConfig'
                  - $ref: '#/components/schemas/MetricConfig'
                  - $ref: '#/components/schemas/SimulationPlanConfig'
                  - $ref: '#/components/schemas/QaSimulationPlanConfig'
                  - $ref: '#/components/schemas/AlertConfig'
                  - $ref: '#/components/schemas/ToolConfig'
              - $ref: '#/components/schemas/ProjectConfig'
        prune:
          type: boolean
          default: true
      required:
        - resources
    ConfigApplyResponse:
      type: object
      properties:
        changes:
          type: array
          items:
            $ref: '#/components/schemas/ConfigApplyChange'
        summary:
          $ref: '#/components/schemas/ConfigApplySummary'
      required:
        - changes
        - summary
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - validation
            - authentication
            - forbidden
            - not_found
            - conflict
            - payment_required
            - rate_limit
            - internal
          description: The error type category
          examples:
            - validation
            - authentication
        code:
          type: string
          description: Machine-readable error code identifier
          examples:
            - invalid_parameter
            - missing_required_field
            - unauthorized
        message:
          type: string
          description: Human-readable error message
          examples:
            - The request was invalid
            - Authentication required
        param:
          type: string
          description: The parameter that caused the error (if applicable)
          examples:
            - email
            - user_id
        details:
          description: Additional error context information
      required:
        - type
        - code
        - message
    AgentConfig:
      type: object
      properties:
        kind:
          type: string
          const: agent
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        displayName:
          type: string
        description:
          type:
            - string
            - 'null'
        customId:
          type:
            - string
            - 'null'
        endpoints:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
                minLength: 1
              type:
                type: string
                enum:
                  - PHONE
                  - WEBSOCKET
                default: PHONE
              direction:
                type: string
                enum:
                  - INCOMING
                  - OUTGOING
                  - INCOMING_AND_OUTGOING
                default: INCOMING
              environment:
                type: string
              outboundDialType:
                type: string
                enum:
                  - NONE
                  - HTTP_REQUEST
                default: NONE
              outboundDialHttpRequestDefinition:
                type: string
                pattern: ^[a-z0-9][a-z0-9-_.]*$
                minLength: 1
            required:
              - value
        prompt:
          type:
            - string
            - 'null'
      required:
        - kind
        - name
    HttpRequestDefinitionConfig:
      type: object
      properties:
        kind:
          type: string
          const: httpRequestDefinition
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        description:
          type:
            - string
            - 'null'
        url:
          type: string
          format: uri
        method:
          type: string
          enum:
            - POST
            - PUT
            - PATCH
            - GET
          default: POST
        body:
          type: string
        headers:
          type: object
          additionalProperties:
            type: string
      required:
        - kind
        - name
        - url
    PersonaConfig:
      type: object
      properties:
        kind:
          type: string
          const: persona
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        displayName:
          type: string
        description:
          type:
            - string
            - 'null'
        language:
          type: string
          enum:
            - EN
            - ES
            - DE
            - HI
            - FR
            - NL
            - AR
            - EL
            - IT
            - ID
            - TH
            - JA
            - TL
            - MS
            - ZH
            - TR
            - PT
            - HE
        secondaryLanguage:
          type:
            - string
            - 'null'
          const: EN
        understoodLanguages:
          type: array
          items:
            type: string
            enum:
              - EN
              - ES
              - DE
              - HI
              - FR
              - NL
              - AR
              - EL
              - IT
              - ID
              - TH
              - JA
              - TL
              - MS
              - ZH
              - TR
              - PT
              - HE
          minItems: 1
        accent:
          type: string
          enum:
            - US
            - US_X_SOUTH
            - GB
            - ES
            - DE
            - IN
            - FR
            - NL
            - SA
            - GR
            - AU
            - IT
            - ID
            - TH
            - JP
            - NZ
            - PH
            - SG
            - MY
            - HK
            - TR
            - PT
            - IL
        age:
          type: string
          enum:
            - CHILD
            - TEENAGER
            - ADULT
            - ELDERLY
          default: ADULT
        gender:
          type: string
          enum:
            - MALE
            - FEMALE
        backgroundNoise:
          type: string
          enum:
            - NONE
            - AIRPORT
            - CHILDREN_PLAYING
            - CITY
            - COFFEE_SHOP
            - CONSTRUCTION
            - CRYING_BABY
            - DRIVING
            - LIBRARY
            - OFFICE
            - THUNDERSTORM
            - TRAIN
          default: NONE
        speechPace:
          type: string
          enum:
            - SUPER_SLOW
            - SLOW
            - NORMAL
            - FAST
            - SUPER_FAST
          default: NORMAL
        speechClarity:
          type: string
          enum:
            - CLEAR
            - VAGUE
            - RAMBLING
          default: CLEAR
        hasDisfluencies:
          type: boolean
          default: false
        baseEmotion:
          type: string
          enum:
            - NEUTRAL
            - CHEERFUL
            - CONFUSED
            - FRUSTRATED
            - SKEPTICAL
            - RUSHED
            - DISTRACTED
            - ANGRY
            - ANXIOUS
            - SAD
          default: NEUTRAL
        intentClarity:
          type: string
          enum:
            - CLEAR
            - INDIRECT
            - VAGUE
          default: CLEAR
        confirmationStyle:
          type: string
          enum:
            - EXPLICIT
            - VAGUE
          default: EXPLICIT
        memoryReliability:
          type: string
          enum:
            - HIGH
            - LOW
          default: HIGH
        responseTiming:
          type: string
          enum:
            - RELAXED
            - NORMAL
            - QUICK
            - BARGE_IN
          default: NORMAL
        interruption:
          type: string
          enum:
            - 'OFF'
            - BACKCHANNEL
            - OCCASIONAL
            - HEAVY
        backstoryPrompt:
          type:
            - string
            - 'null'
        idleMessages:
          type:
            - array
            - 'null'
          items:
            type: string
        idleTimeoutSeconds:
          type: integer
          minimum: 5
          maximum: 60
          default: 10
        idleMessageMaxSpokenCount:
          type: integer
          minimum: 1
          maximum: 10
          default: 3
        idleMessageResetCountOnUserSpeechEnabled:
          type: boolean
          default: true
        properties:
          type: object
          additionalProperties: {}
      required:
        - kind
        - name
        - language
        - accent
        - gender
    ImprovFlowConfig:
      type: object
      properties:
        kind:
          type: string
          const: flow
        type:
          type: string
          const: improv
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        title:
          type: string
        description:
          type:
            - string
            - 'null'
        agents:
          type: array
          items:
            type: string
            pattern: ^[a-z0-9][a-z0-9-_.]*$
            minLength: 1
          minItems: 1
        expectations:
          type: array
          items:
            type: string
        happyPath:
          type: object
          properties:
            persona:
              type: string
              pattern: ^[a-z0-9][a-z0-9-_.]*$
              minLength: 1
            environment:
              type: string
            prompt:
              type: string
            expectations:
              type: array
              items:
                type: string
            title:
              type: string
          required:
            - persona
            - environment
        edgeCases:
          type: array
          items:
            type: object
            properties:
              persona:
                type: string
                pattern: ^[a-z0-9][a-z0-9-_.]*$
                minLength: 1
              environment:
                type: string
              prompt:
                type: string
              expectations:
                type: array
                items:
                  type: string
              name:
                type: string
                pattern: ^[a-z0-9][a-z0-9-_.]*$
                minLength: 1
              title:
                type: string
            required:
              - name
      required:
        - kind
        - type
        - name
        - agents
        - happyPath
    ScriptedFlowConfig:
      type: object
      properties:
        kind:
          type: string
          const: flow
        type:
          type: string
          const: scripted
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        title:
          type: string
        description:
          type:
            - string
            - 'null'
        agents:
          type: array
          items:
            type: string
            pattern: ^[a-z0-9][a-z0-9-_.]*$
            minLength: 1
        branchingMode:
          type: string
          enum:
            - DETERMINISTIC
            - ADAPTIVE
        adherence:
          type: string
          enum:
            - LOOSE
            - STRICT
        offScript:
          $ref: '#/components/schemas/ConfigOffScript'
        expectations:
          type: array
          items:
            type: string
        graph:
          type: array
          items:
            $ref: '#/components/schemas/ConfigFlowStep'
          minItems: 1
      required:
        - kind
        - type
        - name
        - graph
    CollectorConfig:
      type: object
      properties:
        kind:
          type: string
          const: collector
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        displayName:
          type: string
        modality:
          type: string
          enum:
            - call
            - chat
        status:
          type: string
          enum:
            - ACTIVE
            - INACTIVE
          default: ACTIVE
        metrics:
          type: array
          items:
            type: string
            minLength: 1
          minItems: 1
        filters:
          type: array
          items:
            type: object
            properties:
              conditions:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - AGENT
                        - CALL_SOURCE
                        - CALL_PROPERTY
                        - INTEGRATION
                    key:
                      type: string
                      minLength: 1
                    operator:
                      type: string
                      enum:
                        - EQUALS
                        - NOT_EQUALS
                        - CONTAINS
                        - STARTS_WITH
                        - GREATER_THAN
                        - LESS_THAN
                        - GREATER_THAN_OR_EQUALS
                        - LESS_THAN_OR_EQUALS
                    value:
                      type: string
                  required:
                    - type
                    - key
                minItems: 1
            required:
              - conditions
      required:
        - kind
        - name
        - modality
        - metrics
    MetricConfig:
      type: object
      properties:
        kind:
          type: string
          const: metric
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        displayName:
          type: string
          minLength: 1
          maxLength: 100
        type:
          type: string
          enum:
            - BOOLEAN
            - SCALE
            - NUMERIC
            - TEXT
            - CLASSIFICATION
        prompt:
          type: string
          minLength: 1
        scope:
          type: string
          enum:
            - GLOBAL
            - PER_PARTICIPANT
          default: GLOBAL
        participantRole:
          type: string
          enum:
            - AGENT
            - CUSTOMER
        contexts:
          type: array
          items:
            type: string
            enum:
              - CALL
              - SEGMENT
              - TURN
          minItems: 1
          default:
            - CALL
        trueLabel:
          type: string
        falseLabel:
          type: string
        scaleMin:
          type: integer
        scaleMax:
          type: integer
        scaleLabels:
          type: array
          items:
            type: object
            properties:
              rangeMin:
                type: number
              rangeMax:
                type: number
              label:
                type: string
                minLength: 1
              description:
                type: string
              displayOrder:
                type: integer
              colorHex:
                type: string
            required:
              - rangeMin
              - rangeMax
              - label
              - displayOrder
        options:
          type: array
          items:
            type: object
            properties:
              label:
                type: string
                minLength: 1
              description:
                type: string
              displayOrder:
                type: integer
            required:
              - label
              - displayOrder
          minItems: 1
        maxSelections:
          type: integer
          minimum: 1
      required:
        - kind
        - name
        - type
        - prompt
    SimulationPlanConfig:
      type: object
      properties:
        kind:
          type: string
          const: simulationPlan
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        description:
          type:
            - string
            - 'null'
        direction:
          type: string
          enum:
            - INBOUND
            - OUTBOUND
        agentEndpoints:
          type: array
          items:
            $ref: '#/components/schemas/SimulationPlanAgentEndpointConfig'
          minItems: 1
        maxDurationSeconds:
          type: integer
          minimum: 1
        iterations:
          type: integer
          minimum: 1
          maximum: 10000
          default: 1
        maxConcurrentJobs:
          type: integer
          minimum: 1
          default: 1
        executionMode:
          type: string
          enum:
            - PARALLEL
            - SEQUENTIAL_SAME_RUN_PLAN
            - SEQUENTIAL_PROJECT
          default: PARALLEL
        silenceTimeoutSeconds:
          type: integer
          minimum: 1
          default: 30
        maxNoResponseRetries:
          type: integer
          minimum: 0
          maximum: 10
          default: 0
        noResponseRetryBackoffSeconds:
          type: integer
          minimum: 30
          maximum: 600
          default: 90
        endCallPhrases:
          type: array
          items:
            type: string
            minLength: 1
          maxItems: 10
          default:
            - goodbye
        endCallReasons:
          type: array
          items:
            type: string
            minLength: 1
          maxItems: 10
          default: []
        includeFlowMetrics:
          type: boolean
          default: true
        includeAutomaticMetrics:
          type: boolean
          default: true
        enrichWithLiveConversation:
          type: boolean
          default: false
        template:
          type: string
          const: manual
          default: manual
        metrics:
          type: array
          items:
            type: string
            minLength: 1
          minItems: 1
        flows:
          type: array
          items:
            $ref: '#/components/schemas/SimulationPlanFlowConfig'
          minItems: 1
      required:
        - kind
        - name
        - direction
        - agentEndpoints
        - maxDurationSeconds
        - metrics
        - flows
    QaSimulationPlanConfig:
      type: object
      properties:
        kind:
          type: string
          const: simulationPlan
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        description:
          type:
            - string
            - 'null'
        direction:
          type: string
          enum:
            - INBOUND
            - OUTBOUND
        agentEndpoints:
          type: array
          items:
            $ref: '#/components/schemas/SimulationPlanAgentEndpointConfig'
          minItems: 1
        maxDurationSeconds:
          type: integer
          minimum: 1
        iterations:
          type: integer
          minimum: 1
          maximum: 10000
          default: 1
        maxConcurrentJobs:
          type: integer
          minimum: 1
          default: 1
        executionMode:
          type: string
          enum:
            - PARALLEL
            - SEQUENTIAL_SAME_RUN_PLAN
            - SEQUENTIAL_PROJECT
          default: PARALLEL
        silenceTimeoutSeconds:
          type: integer
          minimum: 1
          default: 30
        maxNoResponseRetries:
          type: integer
          minimum: 0
          maximum: 10
          default: 0
        noResponseRetryBackoffSeconds:
          type: integer
          minimum: 30
          maximum: 600
          default: 90
        endCallPhrases:
          type: array
          items:
            type: string
            minLength: 1
          maxItems: 10
          default:
            - goodbye
        endCallReasons:
          type: array
          items:
            type: string
            minLength: 1
          maxItems: 10
          default: []
        includeFlowMetrics:
          type: boolean
          default: true
        includeAutomaticMetrics:
          type: boolean
          default: true
        enrichWithLiveConversation:
          type: boolean
          default: false
        template:
          type: string
          const: question-answer-check
        persona:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        environment:
          type: string
        gradeWithKnowledgeBase:
          type: boolean
          default: false
        metrics:
          type: array
          items:
            type: string
            minLength: 1
          default: []
        questions:
          type: array
          items:
            $ref: '#/components/schemas/SimulationPlanQaQuestion'
          minItems: 1
      required:
        - kind
        - name
        - direction
        - agentEndpoints
        - maxDurationSeconds
        - template
        - persona
        - environment
        - questions
    AlertConfig:
      type: object
      properties:
        kind:
          type: string
          const: alert
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        displayName:
          type: string
        enabled:
          type: boolean
          default: true
        trigger:
          oneOf:
            - $ref: '#/components/schemas/AlertThresholdTrigger'
            - $ref: '#/components/schemas/AlertEventTrigger'
            - $ref: '#/components/schemas/AlertSimulationTrigger'
          discriminator:
            propertyName: type
            mapping:
              threshold: '#/components/schemas/AlertThresholdTrigger'
              event: '#/components/schemas/AlertEventTrigger'
              simulation: '#/components/schemas/AlertSimulationTrigger'
        actions:
          $ref: '#/components/schemas/AlertActions'
      required:
        - kind
        - name
        - trigger
    ToolConfig:
      type: object
      properties:
        kind:
          type: string
          const: tool
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        description:
          type:
            - string
            - 'null'
        parameters:
          type: object
          additionalProperties:
            type: string
            enum:
              - string
              - number
              - boolean
        invocationCriteria:
          type:
            - string
            - 'null'
        expectedResult:
          type:
            - string
            - 'null'
        agent:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
      required:
        - kind
        - name
    ProjectConfig:
      type: object
      properties:
        kind:
          type: string
          const: project
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        displayName:
          type: string
          minLength: 1
          maxLength: 255
        description:
          type: string
          maxLength: 2000
        category:
          type: string
          enum:
            - HEALTHCARE
            - FINANCIAL
            - RETAIL
            - HOSPITALITY
            - AUTOMOTIVE
            - GOVERNMENT
            - EDUCATION
            - REAL_ESTATE
            - OTHER
        dataStorageRegion:
          type: string
          enum:
            - US_EAST_1
            - EU_WEST_1
        members:
          type: array
          items:
            $ref: '#/components/schemas/OrgProjectMemberConfig'
        resources:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/AgentConfig'
              - $ref: '#/components/schemas/HttpRequestDefinitionConfig'
              - $ref: '#/components/schemas/PersonaConfig'
              - $ref: '#/components/schemas/ImprovFlowConfig'
              - $ref: '#/components/schemas/ScriptedFlowConfig'
              - $ref: '#/components/schemas/CollectorConfig'
              - $ref: '#/components/schemas/MetricConfig'
              - $ref: '#/components/schemas/SimulationPlanConfig'
              - $ref: '#/components/schemas/QaSimulationPlanConfig'
              - $ref: '#/components/schemas/AlertConfig'
              - $ref: '#/components/schemas/ToolConfig'
      required:
        - kind
        - name
    ConfigApplyChange:
      allOf:
        - $ref: '#/components/schemas/ConfigDiffChange'
      properties:
        status:
          type: string
          enum:
            - applied
            - skipped
            - failed
        id:
          type: string
        signingSecret:
          type: string
        error:
          type: string
      required:
        - status
    ConfigApplySummary:
      allOf:
        - $ref: '#/components/schemas/ConfigDiffSummary'
      properties:
        failed:
          type: integer
      required:
        - failed
    ConfigOffScript:
      type: object
      properties:
        reaction:
          type: string
          enum:
            - STAY_SILENT
            - REPEAT
            - RESPOND
            - SAY
        sayLine:
          type: string
          minLength: 1
          maxLength: 2000
        maxAttempts:
          type: integer
          minimum: 1
          maximum: 20
        then:
          type: string
          enum:
            - HANG_UP
            - MOVE_ON
            - ADAPT
            - HANG_UP_INVALIDATE
        waitSeconds:
          type: integer
          minimum: 1
          maximum: 600
    ConfigFlowStep:
      type: object
      properties:
        ref:
          type: string
          minLength: 1
          maxLength: 64
        type:
          type: string
          enum:
            - AGENT_TURN
            - CUSTOMER_TURN
            - CUSTOMER_FIRST_MESSAGE
            - CUSTOMER_VERBATIM_TURN
            - CUSTOMER_SILENCE
            - CUSTOMER_DTMF
            - AGENT_DTMF
            - VOICEMAIL
            - SCENARIO_LINK
            - CUSTOMER_HANDOFF
        content:
          type: string
        offScript:
          $ref: '#/components/schemas/ConfigOffScript'
        silenceDurationSeconds:
          type: integer
          exclusiveMinimum: 0
        dtmfDigits:
          type: string
        flow:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        handoffPersona:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        stage:
          anyOf:
            - type: string
              minLength: 1
              maxLength: 80
            - type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 80
                required:
                  type: boolean
                analyze:
                  type: boolean
              required:
                - name
              additionalProperties: false
        requiredForValidRun:
          type: boolean
          description: 'Removed. Use `stage` with `required: true`.'
        mergeInto:
          type: array
          items:
            type: string
            minLength: 1
        steps:
          type: array
          items:
            $ref: '#/components/schemas/ConfigFlowStep'
      required:
        - type
    SimulationPlanAgentEndpointConfig:
      type: object
      properties:
        agent:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        value:
          type: string
          minLength: 1
        direction:
          type: string
          enum:
            - INCOMING
            - OUTGOING
            - INCOMING_AND_OUTGOING
      required:
        - agent
    SimulationPlanFlowConfig:
      type: object
      properties:
        flow:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        system:
          type: string
          minLength: 1
        happyPath:
          type: boolean
        edgeCases:
          type: array
          items:
            type: string
            minLength: 1
        personaOverride:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
    SimulationPlanQaQuestion:
      type: object
      properties:
        ask:
          type: string
          minLength: 1
        expect:
          type: string
          minLength: 1
        name:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
      required:
        - ask
    AlertThresholdTrigger:
      type: object
      properties:
        type:
          type: string
          const: threshold
        metric:
          type: string
          minLength: 1
        metricVariant:
          type: string
          minLength: 1
        aggregation:
          type: string
          enum:
            - COUNT
            - RATE_PER_MINUTE
            - MEAN
        windowMinutes:
          type: integer
          exclusiveMinimum: 0
        operator:
          type: string
          enum:
            - GT
            - GTE
            - LT
            - LTE
        thresholdValue:
          type: number
        grouping:
          type: string
          enum:
            - NONE
            - BY_AGENT
          default: NONE
        minSampleSize:
          type: integer
          minimum: 1
          default: 1
        consecutiveOpen:
          type: integer
          minimum: 1
          default: 2
        consecutiveResolve:
          type: integer
          minimum: 1
          default: 3
      required:
        - type
        - metric
        - aggregation
        - windowMinutes
        - operator
        - thresholdValue
    AlertEventTrigger:
      type: object
      properties:
        type:
          type: string
          const: event
        events:
          type: array
          items:
            type: string
            enum:
              - CALL_ANALYSIS_COMPLETED
              - CALL_ANALYSIS_FAILED
              - CALL_ANALYSIS_CANCELLED
              - SIMULATION_RUN_PLAN_JOB_STARTED
              - SIMULATION_RUN_PLAN_JOB_COMPLETED
              - SIMULATION_RUN_PLAN_JOB_FAILED
              - SIMULATION_RUN_PLAN_JOB_CANCELLED
              - SIMULATION_JOB_STARTED
              - SIMULATION_JOB_COMPLETED
              - SIMULATION_JOB_FAILED
              - SIMULATION_JOB_CANCELLED
              - METRIC_COLLECTION_JOB_COMPLETED
              - METRIC_COLLECTION_JOB_FAILED
              - CHAT_ANALYSIS_COMPLETED
              - CHAT_ANALYSIS_FAILED
              - ISSUE_OPENED
              - ISSUE_RESOLVED
          minItems: 1
      required:
        - type
        - events
    AlertSimulationTrigger:
      type: object
      properties:
        type:
          type: string
          const: simulation
        conditions:
          type: array
          items:
            type: string
            enum:
              - SUCCESS
              - FAILURE
              - THRESHOLD_FAILED
          minItems: 1
        plan:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        deliveryFormat:
          type: string
          enum:
            - MESSAGE
            - PDF
          default: MESSAGE
      required:
        - type
        - conditions
    AlertActions:
      type: object
      properties:
        slack:
          type: array
          items:
            $ref: '#/components/schemas/AlertSlackChannel'
        webhooks:
          type: array
          items:
            type: string
            format: uri
    OrgProjectMemberConfig:
      type: object
      properties:
        email:
          type: string
          format: email
        role:
          type: string
          enum:
            - OWNER
            - ADMIN
            - MEMBER
            - VIEWER
      required:
        - email
        - role
    ConfigDiffChange:
      type: object
      properties:
        configKey:
          type: string
        kind:
          type: string
          enum:
            - agent
            - persona
            - httpRequestDefinition
            - flow
            - collector
            - metric
            - simulationPlan
            - alert
            - tool
            - project
            - member
        name:
          type: string
        op:
          type: string
          enum:
            - create
            - update
            - delete
            - noop
        project:
          type: string
        detail:
          type: string
      required:
        - configKey
        - kind
        - name
        - op
    ConfigDiffSummary:
      type: object
      properties:
        create:
          type: integer
        update:
          type: integer
        delete:
          type: integer
        noop:
          type: integer
      required:
        - create
        - update
        - delete
        - noop
    AlertSlackChannel:
      type: object
      properties:
        channelId:
          type: string
          minLength: 1
        channelName:
          type: string
          minLength: 1
      required:
        - channelId
        - channelName
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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