> ## 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 into the project. Submit the full desired set of resources; resources already managed by config are updated, new ones created, and (unless prune is false) config-managed resources absent from the bundle are deleted. Identity is by name — no ids in the bundle.



## 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 Run Plan Job
  - name: Simulation Job
  - name: HTTP Request Definition
  - name: Webhook
  - name: Issue
  - name: Knowledge Base
  - name: Config
  - name: Call Analysis
  - name: Health
paths:
  /v1/config/apply:
    post:
      tags:
        - Config
      summary: Apply a config bundle
      description: >-
        Reconcile a config-as-code bundle into the project. Submit the full
        desired set of resources; resources already managed by config are
        updated, new ones created, and (unless prune is false) config-managed
        resources absent from the bundle are deleted. Identity is by name — no
        ids in the bundle.
      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:
              - $ref: '#/components/schemas/AgentConfig'
              - $ref: '#/components/schemas/PersonaConfig'
              - $ref: '#/components/schemas/ImprovFlowConfig'
              - $ref: '#/components/schemas/ScriptedFlowConfig'
              - $ref: '#/components/schemas/CollectorConfig'
              - $ref: '#/components/schemas/MetricConfig'
        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
        description:
          type:
            - string
            - 'null'
        customId:
          type:
            - string
            - 'null'
        endpoints:
          type: array
          items:
            type: object
            properties:
              name:
                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
              environment:
                type: string
            required:
              - name
              - value
              - direction
      required:
        - kind
        - name
    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
            - DRIVING
            - OFFICE
            - THUNDERSTORM
          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
          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
          default: NORMAL
        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:
            path: /v1/integrations/livekit-sdk/chunk-upload-url
      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
        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
        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
    ConfigApplyChange:
      allOf:
        - $ref: '#/components/schemas/ConfigDiffChange'
      properties:
        status:
          type: string
          enum:
            - applied
            - skipped
            - failed
        id:
          type: string
        error:
          type: string
      required:
        - status
    ConfigApplySummary:
      allOf:
        - $ref: '#/components/schemas/ConfigDiffSummary'
      properties:
        failed:
          type: integer
      required:
        - failed
    ConfigFlowStep:
      type: object
      properties:
        ref:
          type: string
          minLength: 1
          maxLength: 64
        type:
          type: string
          enum:
            - AGENT_TURN
            - CUSTOMER_TURN
            - CUSTOMER_FIRST_MESSAGE
            - CUSTOMER_SILENCE
            - CUSTOMER_DTMF
            - VOICEMAIL
            - SCENARIO_LINK
        content:
          type: string
        silenceDurationSeconds:
          type: integer
          exclusiveMinimum: 0
        dtmfDigits:
          type: string
        flow:
          type: string
          pattern: ^[a-z0-9][a-z0-9-_.]*$
          minLength: 1
        mergeInto:
          type: array
          items:
            type: string
            minLength: 1
        steps:
          type: array
          items:
            $ref: '#/components/schemas/ConfigFlowStep'
      required:
        - type
    ConfigDiffChange:
      type: object
      properties:
        configKey:
          type: string
        kind:
          type: string
          enum:
            - agent
            - persona
            - flow
            - collector
            - metric
        name:
          type: string
        op:
          type: string
          enum:
            - create
            - update
            - delete
            - noop
        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
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````