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

# Create or replace a conversation target config

> Create or replace the per-target config for ``(target_kind, target_name)`` — an
UPSERT, so this is the create path AND the edit path for a config of that key.

The target must merely EXIST — the agent (``target_kind=agent``) or tool
(``target_kind=tool``) — exactly as the route create checks it. ``greeting_template``
may reference at most the ``{pairing_code}`` placeholder and a blank template is refused
(``null`` = no greeting), both enforced by the model. No key is bound and no authority
delegated: this is inert operator config. Returns
``{"created", "target_kind", "target_name", "config"}``.



## OpenAPI

````yaml /openapi.json put /api/conversation-configs/{target_kind}/{target_name}
openapi: 3.1.0
info:
  description: The operator HTTP surface served under /api/*.
  title: tai42-skeleton API
  version: 14.0.2
servers: []
security: []
paths:
  /api/conversation-configs/{target_kind}/{target_name}:
    put:
      tags:
        - conversations
      summary: Create or replace a conversation target config
      description: >-
        Create or replace the per-target config for ``(target_kind,
        target_name)`` — an

        UPSERT, so this is the create path AND the edit path for a config of
        that key.


        The target must merely EXIST — the agent (``target_kind=agent``) or tool

        (``target_kind=tool``) — exactly as the route create checks it.
        ``greeting_template``

        may reference at most the ``{pairing_code}`` placeholder and a blank
        template is refused

        (``null`` = no greeting), both enforced by the model. No key is bound
        and no authority

        delegated: this is inert operator config. Returns

        ``{"created", "target_kind", "target_name", "config"}``.
      operationId: put_api_conversation_configs_target_kind_target_name
      parameters:
        - in: path
          name: target_kind
          required: true
          schema:
            type: string
        - in: path
          name: target_name
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TargetConversationConfig'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/ConversationConfigSetResult'
                required:
                  - data
                type: object
          description: Success.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Malformed request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid api key.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '501':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Error.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TargetConversationConfig:
      description: >-
        Per-target configuration for the conversation bridge, keyed by

        ``(target_kind, target_name)`` — the agent or tool an inbound turn is
        routed to.


        ``multichannel`` opts the target into person linking;
        ``greeting_template`` is the

        first-contact greeting, which may reference at most the
        ``{pairing_code}`` placeholder

        (minted at greeting time). The row carries no server-derived fields, so
        it IS its own

        create payload — no Create/stored split. An unknown ``{...}``
        placeholder is refused so

        a typo cannot render literally; a blank template string is refused,
        because ``None`` is

        the explicit spelling for "no greeting". Frozen.
      properties:
        greeting_template:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Greeting Template
        multichannel:
          default: false
          title: Multichannel
          type: boolean
        state_binding:
          anyOf:
            - $ref: '#/components/schemas/StateBinding'
            - type: 'null'
          default: null
        target_kind:
          enum:
            - agent
            - tool
          title: Target Kind
          type: string
        target_name:
          minLength: 1
          title: Target Name
          type: string
      required:
        - target_kind
        - target_name
      title: TargetConversationConfig
      type: object
    ConversationConfigSetResult:
      description: The created/replaced per-target conversation config.
      properties:
        config:
          $ref: '#/components/schemas/TargetConversationConfig'
        created:
          title: Created
          type: boolean
        target_kind:
          title: Target Kind
          type: string
        target_name:
          title: Target Name
          type: string
      required:
        - created
        - target_kind
        - target_name
        - config
      title: ConversationConfigSetResult
      type: object
    Error:
      properties:
        code:
          description: >-
            Stable machine-readable reason a client keys a dedicated error state
            on, present on refusals that opt in (e.g. a 501 not-configured
            refusal). Optional: absent when the error carries only a
            human-readable message.
          type: string
        error:
          type: string
      required:
        - error
      type: object
    StateBinding:
      additionalProperties: false
      description: >-
        The optional binding a door carries: one or more :class:`StateAttach`
        entries. Frozen.


        The same shape is stored on ``PresetBody``/``PresetSeed``,
        ``TargetConversationConfig``,

        ``HookRegister`` and ``ScheduleCreate``, deposited on ``ToolInvocation``
        through the

        ambient dispatch context, and repeated per node by a flow engine.
      properties:
        states:
          items:
            $ref: '#/components/schemas/StateAttach'
          minItems: 1
          title: States
          type: array
      required:
        - states
      title: StateBinding
      type: object
    StateAttach:
      additionalProperties: false
      description: >-
        One state attached by a binding: the ``state`` name, the ``templates``
        to attach on it

        (attach-on-use, idempotent at save), the ``subject_expr`` (a templated
        text rendering to a

        jq over the run input → a full subject object or the record KEY, its
        scope taken from the

        ambient door context and its kind from the state's declared subject
        kind), an optional

        ``scope_expr`` (a templated text rendering to a BOOLEAN predicate over
        the run input

        evaluated first — ``false`` skips this state for the run, a non-boolean
        is a loud error,

        absent engages), and the ordered ``input_injections`` / ``updates``.
        Frozen.
      properties:
        input_injections:
          items:
            $ref: '#/components/schemas/StateInjection'
          title: Input Injections
          type: array
        scope_expr:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - type: 'null'
          default: null
        state:
          title: State
          type: string
        subject_expr:
          $ref: '#/components/schemas/TemplatedText'
        templates:
          items:
            type: string
          title: Templates
          type: array
        updates:
          items:
            $ref: '#/components/schemas/StateUpdate'
          title: Updates
          type: array
      required:
        - state
        - subject_expr
      title: StateAttach
      type: object
    StateInjection:
      additionalProperties: false
      description: >-
        One input injection placed into the run input under ``into`` before the
        dispatch.


        Exactly one source is set: ``template_jq`` names an ``input``-purpose
        template jq

        (``name`` or ``<template>.<name>``) evaluated over the record, or ``jq``
        is a templated

        text rendering to a custom program over ``{record, input}``. ``into`` IS
        the adapter for

        an injection — the run-input field the value lands under. Frozen.
      properties:
        into:
          minLength: 1
          title: Into
          type: string
        jq:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - type: 'null'
          default: null
        template_jq:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Template Jq
      required:
        - into
      title: StateInjection
      type: object
    TemplatedText:
      additionalProperties: false
      description: >-
        A renderable text: its source plus the parameters its render takes.


        EXACTLY ONE source is set — ``content`` (the text inline) or ``id`` (the
        id of a

        stored resource holding the text); neither and both are refused at
        construction.

        ``kwargs`` are the render parameters for the TEXT and apply either way,
        so moving a

        text from inline to stored (or back) leaves its parameters untouched.
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Content
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        kwargs:
          additionalProperties: true
          title: Kwargs
          type: object
      title: TemplatedText
      type: object
      x-tai42-templated-text:
        language: jinja
    StateUpdate:
      additionalProperties: false
      description: >-
        One update applied through the store after the dispatch.


        Exactly one source is set: ``template_jq`` names an ``update``-purpose
        template jq

        (``name`` or ``<template>.<name>``) whose ``.input`` object the optional
        ``adapter`` (a

        templated text rendering to a jq over ``{output, input}``) shapes from
        the run's

        output/input; or ``jq`` is a templated text rendering to a custom
        program over ``{record,

        output, input}`` authoring the whole op batch itself (a custom update
        carries no adapter).

        ``op_id`` is an optional templated text rendering to an idempotency-key
        expression.

        Frozen.
      properties:
        adapter:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - type: 'null'
          default: null
        jq:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - type: 'null'
          default: null
        op_id:
          anyOf:
            - $ref: '#/components/schemas/TemplatedText'
            - type: 'null'
          default: null
        template_jq:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Template Jq
      title: StateUpdate
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: x-api-key
      type: apiKey

````