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

# Replace a branch's workflow

> Checks the workflow as the dashboard's builder does, then publishes it as a new version of the branch. A branch changed since `revision` is refused with `409`; read it again and retry. A protected branch is refused with `403`. Needs a Full access key.



## OpenAPI

````yaml /api-reference/openapi.json put /api/v2/agents/{agentId}/branches/{branchId}/workflow
openapi: 3.1.0
info:
  title: Centillion Labs API
  description: >-
    The public API of Centillion Labs: agents, their branches and versions,
    knowledge, tools and the secrets they send, chat, conversations, contacts,
    campaigns, batch calls, agent testing, issues and Helpdesk.
  version: 2.0.0
servers:
  - url: https://app.cntillion.com
security:
  - workspaceApiKey: []
  - workspaceApiKeyHeader: []
tags:
  - name: Agents
    description: Create, read, change, clone and delete agents.
  - name: Branches and versions
    description: Branches, drafts, immutable versions, merges, publishing and traffic.
  - name: Workflow and voice
    description: A branch's workflow and its voice settings.
  - name: Tools
    description: 'Workspace tools: HTTP, client, MCP server and code tools.'
  - name: Secrets
    description: >-
      Named credentials, such as an API key, that HTTP tools and MCP servers
      send as a header by naming the secret's id in
      `configuration.secretHeaders`. A value is encrypted when saved and never
      returned. A new value reaches every tool and published agent that uses the
      secret on its next call, with nothing to publish, and a secret can be
      deleted only once no tool and no published agent sends it.
  - name: Auth connections
    description: >-
      How the workspace's tools sign in to an API, kept once and named by id in
      an HTTP tool's or an MCP server's `configuration.authConnectionId` (or
      `configuration.page.authConnectionId` for a web form's link request).
      Secrets are encrypted when saved and never returned. A change reaches
      every tool and published agent that uses the connection on its next call,
      and a connection can be deleted only once nothing signs in with it.
  - name: Knowledge sources
    description: What an agent knows, and training it on that.
  - name: Chat
    description: Talk to an agent from your own systems.
  - name: Conversations
    description: Conversations, their messages, feedback and analysis.
  - name: Leads and contacts
    description: The leads and contacts an agent collected.
  - name: Contacts and enrollments
    description: Upsert contacts and enroll them in always-open campaigns.
  - name: Batch calls
    description: Outbound call batches, their recipients and their runs.
  - name: Campaigns
    description: >-
      Managed outbound calling: campaigns that call each lead within calling
      windows and retry, call back or redirect as their lead policy allows,
      their leads, calls and attention items, and the workspace's campaign
      settings.
  - name: WhatsApp
    description: WhatsApp templates and template messages.
  - name: Agent testing
    description: Workspace tests, agent suites, execution, and results.
  - name: Issues
    description: >-
      Issues an agent raised or a teammate flagged about how it behaves: triage,
      comment, merge and resolve.
  - name: Helpdesk
    description: Helpdesk tickets, their messages, teams and statuses.
  - name: Status
    description: Whether the API is up.
paths:
  /api/v2/agents/{agentId}/branches/{branchId}/workflow:
    put:
      tags:
        - Workflow and voice
      summary: Replace a branch's workflow
      description: >-
        Checks the workflow as the dashboard's builder does, then publishes it
        as a new version of the branch. A branch changed since `revision` is
        refused with `409`; read it again and retry. A protected branch is
        refused with `403`. Needs a Full access key.
      operationId: updateBranchWorkflow
      parameters:
        - name: agentId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 128
        - name: branchId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 128
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBranchWorkflowRequest'
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBranchWorkflowResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          $ref: '#/components/responses/Error409'
        '413':
          $ref: '#/components/responses/Error413'
        '415':
          $ref: '#/components/responses/Error415'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '504':
          $ref: '#/components/responses/Error504'
components:
  schemas:
    UpdateBranchWorkflowRequest:
      type: object
      properties:
        revision:
          type: integer
          minimum: 0
          description: The branch revision the settings were read at.
        message:
          description: The new version's message. Defaults to "Updated the workflow".
          type: string
          maxLength: 4000
        workflow:
          type: object
          properties:
            format:
              default: 1
              type: number
              const: 1
            preventInfiniteLoops:
              default: false
              type: boolean
            sensitiveVariables:
              default: []
              maxItems: 50
              type: array
              items:
                type: string
                pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
            nodes:
              type: array
              items:
                oneOf:
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: start
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: hangup
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: subagent
                      prompt:
                        default: ''
                        type: string
                        maxLength: 100000
                      overridePrompt:
                        default: false
                        type: boolean
                      model:
                        default: inherit
                        type: string
                        maxLength: 100
                      voiceId:
                        default: null
                        anyOf:
                          - type: string
                            maxLength: 200
                          - type: 'null'
                      entryBehavior:
                        default: auto
                        type: string
                        enum:
                          - auto
                          - generate
                          - wait
                      eagerness:
                        default: default
                        type: string
                        enum:
                          - default
                          - patient
                          - normal
                          - eager
                      spellingPatience:
                        default: default
                        type: string
                        enum:
                          - default
                          - auto
                          - 'off'
                      speculativeTurn:
                        default: null
                        type:
                          - boolean
                          - 'null'
                      interruptible:
                        default: null
                        type:
                          - boolean
                          - 'null'
                      inheritKnowledge:
                        default: true
                        type: boolean
                      knowledgeIds:
                        default: []
                        maxItems: 100
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      inheritTools:
                        default: true
                        type: boolean
                      toolIds:
                        default: []
                        maxItems: 100
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      builtInTools:
                        default: {}
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                          enum:
                            - default
                            - enabled
                            - disabled
                      testIds:
                        default: []
                        maxItems: 50
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      modelSettings:
                        default: null
                        anyOf:
                          - type: object
                            properties:
                              temperature:
                                default: null
                                anyOf:
                                  - type: number
                                    minimum: 0
                                    maximum: 1
                                  - type: 'null'
                              maxTokens:
                                default: -1
                                anyOf:
                                  - type: number
                                    const: -1
                                  - type: integer
                                    minimum: 16
                                    maximum: 32768
                              reasoningEffort:
                                default: null
                                anyOf:
                                  - type: string
                                    enum:
                                      - none
                                      - minimal
                                      - low
                                      - medium
                                      - high
                                      - xhigh
                                      - max
                                  - type: 'null'
                              parallelToolCalls:
                                default: true
                                type: boolean
                              backupModels:
                                default:
                                  mode: default
                                oneOf:
                                  - type: object
                                    properties:
                                      mode:
                                        type: string
                                        const: default
                                    required:
                                      - mode
                                  - type: object
                                    properties:
                                      mode:
                                        type: string
                                        const: custom
                                      models:
                                        maxItems: 6
                                        type: array
                                        items:
                                          type: string
                                          minLength: 1
                                          maxLength: 100
                                    required:
                                      - mode
                                      - models
                                  - type: object
                                    properties:
                                      mode:
                                        type: string
                                        const: disabled
                                    required:
                                      - mode
                              serviceTier:
                                default: standard
                                type: string
                                enum:
                                  - standard
                                  - fast
                          - type: 'null'
                      keypad:
                        default: null
                        anyOf:
                          - type: object
                            properties:
                              variable:
                                type: string
                                pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                              minDigits:
                                default: 4
                                type: integer
                                minimum: 1
                                maximum: 32
                              maxDigits:
                                default: 9
                                type: integer
                                minimum: 1
                                maximum: 32
                              terminator:
                                default: '#'
                                type: string
                                enum:
                                  - '#'
                                  - '*'
                                  - none
                              timeoutSeconds:
                                default: 15
                                type: integer
                                minimum: 3
                                maximum: 60
                            required:
                              - variable
                          - type: 'null'
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: say
                      mode:
                        default: literal
                        type: string
                        enum:
                          - literal
                          - prompt
                      message:
                        default: ''
                        type: string
                        maxLength: 4000
                      translations:
                        type: object
                        propertyNames:
                          type: string
                          pattern: ^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$
                        additionalProperties:
                          type: string
                          maxLength: 4000
                      voiceId:
                        default: null
                        anyOf:
                          - type: string
                            maxLength: 200
                          - type: 'null'
                      knowledgeIds:
                        default: []
                        maxItems: 100
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      waitForCompletion:
                        default: false
                        type: boolean
                      waitForUser:
                        default: false
                        type: boolean
                      testIds:
                        default: []
                        maxItems: 50
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: update_state
                      updates:
                        default: []
                        maxItems: 20
                        type: array
                        items:
                          type: object
                          properties:
                            variable:
                              type: string
                              pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                            value:
                              $ref: '#/components/schemas/WorkflowExpression'
                            required:
                              default: true
                              type: boolean
                          required:
                            - variable
                            - value
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: agent_transfer
                      targetAgentId:
                        default: null
                        anyOf:
                          - type: string
                            minLength: 1
                            maxLength: 140
                          - type: 'null'
                      targetNodeId:
                        default: null
                        anyOf:
                          - type: string
                            minLength: 1
                            maxLength: 140
                          - type: 'null'
                      delayMs:
                        default: 0
                        type: integer
                        minimum: 0
                        maximum: 60000
                      transferMessage:
                        default: ''
                        type: string
                        maxLength: 2000
                      targetSpeaksFirst:
                        default: false
                        type: boolean
                      keepVoice:
                        default: true
                        type: boolean
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: phone_transfer
                      transferType:
                        default: conference
                        type: string
                        enum:
                          - conference
                          - blind
                          - sip_refer
                      destinationType:
                        default: phone
                        type: string
                        enum:
                          - phone
                          - sip
                      destination:
                        default: ''
                        type: string
                        maxLength: 256
                      destinationSource:
                        default:
                          kind: literal
                        oneOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: literal
                            required:
                              - kind
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: variable
                              variable:
                                default: ''
                                type: string
                                maxLength: 64
                            required:
                              - kind
                      playRingingTone:
                        default: null
                        type:
                          - boolean
                          - 'null'
                      postDialDigits:
                        default: null
                        anyOf:
                          - type: string
                            maxLength: 64
                          - type: 'null'
                      postDialDigitsSource:
                        default:
                          kind: literal
                        oneOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: literal
                            required:
                              - kind
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: variable
                              variable:
                                default: ''
                                type: string
                                maxLength: 64
                            required:
                              - kind
                      requireAcceptDigit:
                        default: false
                        type: boolean
                      transferMessage:
                        default: ''
                        type: string
                        maxLength: 2000
                      sipHeaders:
                        default: []
                        maxItems: 20
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              minLength: 1
                              maxLength: 140
                            name:
                              type: string
                              maxLength: 64
                            value:
                              oneOf:
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: literal
                                    value:
                                      type: string
                                      maxLength: 512
                                  required:
                                    - kind
                                    - value
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: variable
                                    variable:
                                      default: ''
                                      type: string
                                      maxLength: 64
                                  required:
                                    - kind
                          required:
                            - name
                            - value
                      sipUserToUser:
                        default: null
                        anyOf:
                          - type: object
                            properties:
                              data:
                                default: ''
                                type: string
                                maxLength: 8192
                              protocolDiscriminator:
                                default: null
                                anyOf:
                                  - type: string
                                    maxLength: 2
                                  - type: 'null'
                              protocolDiscriminatorMode:
                                default: prefix
                                type: string
                                enum:
                                  - prefix
                                  - pd_parameter
                          - type: 'null'
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: tool
                      toolIds:
                        default: []
                        maxItems: 10
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      mcpTools:
                        default: {}
                        type: object
                        propertyNames:
                          type: string
                          minLength: 1
                          maxLength: 140
                        additionalProperties:
                          type: string
                          minLength: 1
                          maxLength: 128
                      arguments:
                        default: {}
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          $ref: '#/components/schemas/WorkflowExpression'
                      resultVariable:
                        default: null
                        anyOf:
                          - type: string
                            pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                          - type: 'null'
                      responseMappings:
                        default: []
                        maxItems: 20
                        type: array
                        items:
                          type: object
                          properties:
                            variable:
                              type: string
                              pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                            path:
                              type: string
                              maxLength: 200
                          required:
                            - variable
                            - path
                      collectAnswers:
                        default: []
                        maxItems: 10
                        type: array
                        items:
                          type: object
                          properties:
                            input:
                              type: string
                              minLength: 1
                              maxLength: 100
                            format:
                              default: questions
                              type: string
                              enum:
                                - questions
                                - values
                            fields:
                              default: {}
                              type: object
                              propertyNames:
                                type: string
                                minLength: 1
                                maxLength: 200
                                pattern: ^[A-Za-z0-9_]+(\.[A-Za-z0-9_]+)*$
                              additionalProperties:
                                type: string
                                pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                          required:
                            - input
                      collectFieldErrors:
                        default: null
                        anyOf:
                          - type: object
                            properties:
                              path:
                                type: string
                                maxLength: 200
                            required:
                              - path
                          - type: 'null'
                      collectFollowUps:
                        default: null
                        anyOf:
                          - type: object
                            properties:
                              path:
                                type: string
                                maxLength: 200
                              nodeId:
                                type: string
                                minLength: 1
                                maxLength: 140
                            required:
                              - path
                              - nodeId
                          - type: 'null'
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: switch
                      input:
                        default: ''
                        anyOf:
                          - type: string
                            const: ''
                          - type: string
                            pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: wait_event
                      prompt:
                        default: >-
                          Tell the customer you are waiting for this to come
                          through, keep them company and answer their questions.
                          Do not say it has happened until the workflow moves
                          on.
                        type: string
                        maxLength: 4000
                      timeoutSeconds:
                        default: 900
                        type: integer
                        minimum: 30
                        maximum: 604800
                      checkInSeconds:
                        default: 60
                        type: integer
                        minimum: 15
                        maximum: 60
                      checkInMessage:
                        default: I'm still here. Take your time.
                        type: string
                        maxLength: 500
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: collect
                      prompt:
                        default: ''
                        type: string
                        maxLength: 100000
                      questions:
                        default: []
                        maxItems: 200
                        type: array
                        items:
                          type: object
                          properties:
                            key:
                              type: string
                              pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                            ask:
                              type: string
                              minLength: 1
                              maxLength: 500
                            type:
                              default: text
                              type: string
                              enum:
                                - text
                                - number
                                - yes_no
                                - date
                                - month
                                - email
                                - phone
                            required:
                              default: true
                              type: boolean
                            when:
                              default: null
                              anyOf:
                                - type: object
                                  properties:
                                    key:
                                      type: string
                                      pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                                    equals:
                                      type:
                                        - string
                                        - number
                                        - boolean
                                  required:
                                    - key
                                    - equals
                                - type: 'null'
                            parent:
                              default: null
                              anyOf:
                                - type: string
                                  pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                                - type: 'null'
                            confirm:
                              default: none
                              type: string
                              enum:
                                - none
                                - spell
                                - changed
                            hint:
                              default: ''
                              type: string
                              maxLength: 300
                            why:
                              default: ''
                              type: string
                              maxLength: 500
                            known:
                              default: null
                              anyOf:
                                - type: string
                                  pattern: ^[A-Za-z_][A-Za-z0-9_.]{0,63}$
                                - type: 'null'
                          required:
                            - key
                            - ask
                      lookAhead:
                        default: true
                        type: boolean
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: end
                      outcome:
                        default: success
                        type: string
                        enum:
                          - success
                          - failure
                      message:
                        default: ''
                        type: string
                        maxLength: 2000
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: group
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: group_start
                    required:
                      - id
                      - type
                  - type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 140
                      label:
                        default: ''
                        type: string
                        maxLength: 140
                      position:
                        default:
                          x: 0
                          'y': 0
                        type: object
                        properties:
                          x:
                            type: number
                          'y':
                            type: number
                        required:
                          - x
                          - 'y'
                      parentId:
                        type: string
                        minLength: 1
                        maxLength: 140
                      edgeOrder:
                        default: []
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 140
                      type:
                        type: string
                        const: group_end
                    required:
                      - id
                      - type
            edges:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                    maxLength: 140
                  source:
                    type: string
                    minLength: 1
                    maxLength: 140
                  target:
                    type: string
                    minLength: 1
                    maxLength: 140
                  forward:
                    anyOf:
                      - oneOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                const: none
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: llm
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              condition:
                                default: ''
                                type: string
                                maxLength: 4000
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: expression
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              expression:
                                $ref: '#/components/schemas/WorkflowExpression'
                            required:
                              - type
                              - expression
                          - type: object
                            properties:
                              type:
                                type: string
                                const: result
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              success:
                                type: boolean
                            required:
                              - type
                              - success
                          - type: object
                            properties:
                              type:
                                type: string
                                const: case
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              value:
                                default: ''
                                type: string
                                maxLength: 200
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: otherwise
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: event
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              event:
                                type: string
                                enum:
                                  - esign.viewed
                                  - esign.signed
                                  - esign.completed
                                  - esign.declined
                                  - esign.voided
                                  - esign.expired
                                  - message.delivered
                                  - message.undelivered
                                  - message.failed
                            required:
                              - type
                              - event
                          - type: object
                            properties:
                              type:
                                type: string
                                const: timeout
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                            required:
                              - type
                      - type: 'null'
                  backward:
                    default: null
                    anyOf:
                      - oneOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                const: none
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: llm
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              condition:
                                default: ''
                                type: string
                                maxLength: 4000
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: expression
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              expression:
                                $ref: '#/components/schemas/WorkflowExpression'
                            required:
                              - type
                              - expression
                          - type: object
                            properties:
                              type:
                                type: string
                                const: result
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              success:
                                type: boolean
                            required:
                              - type
                              - success
                          - type: object
                            properties:
                              type:
                                type: string
                                const: case
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              value:
                                default: ''
                                type: string
                                maxLength: 200
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: otherwise
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                            required:
                              - type
                          - type: object
                            properties:
                              type:
                                type: string
                                const: event
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                              event:
                                type: string
                                enum:
                                  - esign.viewed
                                  - esign.signed
                                  - esign.completed
                                  - esign.declined
                                  - esign.voided
                                  - esign.expired
                                  - message.delivered
                                  - message.undelivered
                                  - message.failed
                            required:
                              - type
                              - event
                          - type: object
                            properties:
                              type:
                                type: string
                                const: timeout
                              label:
                                default: ''
                                type: string
                                maxLength: 140
                            required:
                              - type
                      - type: 'null'
                  sourceExitId:
                    type: string
                    minLength: 1
                    maxLength: 140
                  targetEntryId:
                    type: string
                    minLength: 1
                    maxLength: 140
                required:
                  - id
                  - source
                  - target
                  - forward
            groups:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                    maxLength: 140
                  collapsed:
                    type: boolean
                  label:
                    type: string
                    maxLength: 200
                  nodeIds:
                    minItems: 1
                    type: array
                    items:
                      type: string
                      minLength: 1
                      maxLength: 140
                required:
                  - id
                  - label
                  - nodeIds
          required:
            - nodes
            - edges
      required:
        - revision
        - workflow
      additionalProperties: false
    UpdateBranchWorkflowResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/BranchWorkflow'
      required:
        - data
    WorkflowExpression:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              const: string
            value:
              type: string
              maxLength: 2000
          required:
            - type
            - value
        - type: object
          properties:
            type:
              type: string
              const: number
            value:
              type: number
          required:
            - type
            - value
        - type: object
          properties:
            type:
              type: string
              const: boolean
            value:
              type: boolean
          required:
            - type
            - value
        - type: object
          properties:
            type:
              type: string
              const: 'null'
          required:
            - type
        - type: object
          properties:
            type:
              type: string
              const: variable
            name:
              type: string
              maxLength: 64
          required:
            - type
            - name
        - type: object
          properties:
            type:
              type: string
              const: exists
            name:
              type: string
              maxLength: 64
          required:
            - type
            - name
        - type: object
          properties:
            type:
              type: string
              const: llm
            description:
              type: string
              maxLength: 2000
            valueType:
              type: string
              enum:
                - string
                - number
                - boolean
          required:
            - type
            - description
            - valueType
        - type: object
          properties:
            type:
              type: string
              const: binary
            operator:
              type: string
              enum:
                - eq
                - neq
                - gt
                - gte
                - lt
                - lte
                - contains
                - and
                - or
                - add
                - sub
                - mul
                - div
            left:
              $ref: '#/components/schemas/WorkflowExpression'
            right:
              $ref: '#/components/schemas/WorkflowExpression'
          required:
            - type
            - operator
            - left
            - right
        - type: object
          properties:
            type:
              type: string
              const: conditional
            condition:
              $ref: '#/components/schemas/WorkflowExpression'
            whenTrue:
              $ref: '#/components/schemas/WorkflowExpression'
            whenFalse:
              $ref: '#/components/schemas/WorkflowExpression'
          required:
            - type
            - condition
            - whenTrue
            - whenFalse
    BranchWorkflow:
      type: object
      properties:
        agentId:
          type: string
        branchId:
          type: string
        revision:
          type: integer
        versionId:
          description: The branch's current version, or null when it has none.
          type:
            - string
            - 'null'
        workflow:
          anyOf:
            - $ref: '#/components/schemas/JsonValue'
            - type: 'null'
          description: >-
            The workflow, in the shape a write's `workflow` takes, with every
            default filled in. Null when the branch has none.
      required:
        - agentId
        - branchId
        - revision
        - versionId
        - workflow
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable code, such as `NOT_FOUND`.
            message:
              type: string
              description: What went wrong, for a person.
            details:
              description: More about the failure, on some endpoints.
          required:
            - code
            - message
      required:
        - error
    JsonValue:
      anyOf:
        - type: string
        - type: number
        - type: boolean
        - type: 'null'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        - type: object
          propertyNames:
            type: string
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
  responses:
    Error400:
      description: The request is invalid. `error.message` names the first problem.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error401:
      description: No valid workspace API key was sent.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error403:
      description: The key or the workspace's plan does not allow this request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error404:
      description: The endpoint, or a record it names, was not found in this workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error409:
      description: The record changed since it was read, or its state does not allow this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error413:
      description: The request body is too large.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error415:
      description: The request body is not of a media type this endpoint accepts.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error429:
      description: Too many requests. Wait for `Retry-After` seconds.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error500:
      description: The request could not be completed. Try again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Error504:
      description: The request took too long. Try again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    workspaceApiKey:
      type: http
      scheme: bearer
      bearerFormat: cl_api_...
      description: >-
        A workspace API key from Workspace settings > API keys, sent as
        `Authorization: Bearer cl_api_...`. A Read only key can call the GET
        endpoints; every other method needs a Full access key.
    workspaceApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        The same workspace API key, for a gateway that keeps `Authorization` for
        itself.

````

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