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

# Assistant Update API

> Einen vorhandenen Assistenten programmatisch aktualisieren

<Warning>
  **Die Assistants API wird am 16. August eingestellt.**

  Für neue Systeme empfehlen wir die [Agents API](/de/developer/agents-api/agent-update). Die Agents API bietet native Vercel AI SDK Kompatibilität und entfernt benutzerdefinierte Transformationen.

  Siehe den [Migrations-Guide](/de/developer/assistants-api/assistant-to-agent-migration) für Details zu den Unterschieden.
</Warning>

Aktualisiert einen vorhandenen Assistenten in deinem Workspace. Nur die von dir angegebenen Felder werden aktualisiert, was partielle Updates ermöglicht, ohne andere Konfigurationen zu beeinflussen.

<Info>
  Erfordert einen API-Schlüssel mit dem `AGENT_API` Scope und Zugriff auf den Assistenten, den du aktualisieren möchtest.
</Info>

## Aktualisierungsverhalten

Der Update-Endpunkt verwendet partielle Update-Semantik mit spezifischem Verhalten für verschiedene Feldtypen:

* **Partielle Updates** - Nur in der Anfrage enthaltene Felder werden aktualisiert; ausgelassene Felder bleiben unverändert
* **Array-Felder ersetzen** - `actions`, `inputFields`, `conversationStarters` und `attachments` ersetzen bei Angabe vollständig die vorhandenen Werte
* **Leere Arrays** - Sende `[]` um alle Actions/Felder/Anhänge zu entfernen
* **Null-Behandlung** - Sende `null` für `emoji` um es zu löschen. Für `description` und `instruction` sende einen leeren String `""` zum Löschen
* **Unveränderte Felder** - Felder, die nicht in der Anfrage enthalten sind, behalten ihre aktuellen Werte

## Anfrageparameter

Setze einen der folgenden Parameter, um die aktuellen Einstellungen des Assistenten zu überschreiben. Felder, die du weglässt, bleiben unverändert. Nur `assistantId` ist erforderlich.

| Parameter              | Typ       | Erforderlich | Beschreibung                                           |
| ---------------------- | --------- | ------------ | ------------------------------------------------------ |
| `assistantId`          | string    | Ja           | UUID des zu aktualisierenden Assistenten               |
| `name`                 | string    | Nein         | Name des Assistenten (1-80 Zeichen)                    |
| `description`          | string    | Nein         | Beschreibung (max. 500 Zeichen, `""` zum Löschen)      |
| `emoji`                | string    | Nein         | Emoji-Icon (null zum Löschen)                          |
| `instruction`          | string    | Nein         | Systemanweisung (max. 40000 Zeichen, `""` zum Löschen) |
| `model`                | string    | Nein         | Modell-UUID                                            |
| `creativity`           | number    | Nein         | Temperatur zwischen 0 und 1                            |
| `conversationStarters` | string\[] | Nein         | Vorgeschlagene Prompts (ersetzt vorhandene)            |
| `actions`              | array     | Nein         | Actions (ersetzt vorhandene)                           |
| `inputFields`          | array     | Nein         | Formularfelder (ersetzt vorhandene)                    |
| `attachments`          | string\[] | Nein         | Anhang-UUIDs (ersetzt vorhandene)                      |
| `webSearch`            | boolean   | Nein         | Websuche aktivieren                                    |
| `imageGeneration`      | boolean   | Nein         | Bildgenerierung aktivieren                             |
| `dataAnalyst`          | boolean   | Nein         | Zur Kompatibilität akzeptiert. Siehe Warnhinweis unten |
| `canvas`               | boolean   | Nein         | Canvas aktivieren                                      |
| `extendedThinking`     | boolean   | Nein         | Extended Thinking aktivieren                           |

<Warning>
  Der Parameter `dataAnalyst` ist veraltet und hat keine Wirkung. Anfragen mit diesem Parameter sind aus Gründen der Abwärtskompatibilität weiterhin erfolgreich, aber Langdock ignoriert den Wert und aktiviert weder Dateiarbeit noch Codeausführung. Lass diesen Parameter in neuen Integrationen weg.
</Warning>

<Warning>
  Array-Felder (`actions`, `inputFields`, `conversationStarters`, `attachments`) werden **vollständig ersetzt**, nicht zusammengeführt. Gib immer das vollständige gewünschte Array an, einschließlich aller vorhandenen Elemente, die du behalten möchtest.
</Warning>

### Actions-Konfiguration

Jede Action im `actions` Array sollte enthalten:

* `actionId` (erforderlich) - UUID der Action aus einer aktivierten Integration
* `requiresConfirmation` (optional) - Ob vor der Ausführung eine Benutzerbestätigung erforderlich ist

### Eingabefelder-Konfiguration

Für die `inputFields` Array-Struktur, siehe die [Assistant Create API](/de/developer/assistants-api/assistant-create) Dokumentation.

## Beispiele

### Grundlegende Eigenschaften aktualisieren

```javascript theme={null}
const axios = require("axios");

async function updateAssistantName() {
  const response = await axios.patch(
    "https://api.langdock.com/assistant/v1/update",
    {
      assistantId: "550e8400-e29b-41d4-a716-446655440000",
      name: "Erweiterter Dokumentenanalyst",
      description: "Analysiert Dokumente mit erweiterten Fähigkeiten",
      creativity: 0.7
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Assistent aktualisiert:", response.data.message);
}
```

## Validierungsregeln

Die API wendet mehrere Validierungsregeln an:

* **Assistenten-Zugriff** - Dein API-Schlüssel muss Zugriff auf den Assistenten haben
* **Workspace-Übereinstimmung** - Der Assistent muss zum selben Workspace wie dein API-Schlüssel gehören
* **Modell** - Falls angegeben, muss es in der Liste der aktiven Modelle deines Workspaces sein
* **Actions** - Falls angegeben, müssen sie zu in deinem Workspace aktivierten Integrationen gehören
* **Anhänge** - Falls angegeben, müssen sie in deinem Workspace existieren und nicht gelöscht sein
* **Name** - Falls angegeben, muss zwischen 1-80 Zeichen sein
* **Beschreibung** - Falls angegeben, maximal 500 Zeichen
* **Instruktion** - Falls angegeben, maximal 40000 Zeichen
* **Creativity** - Falls angegeben, muss zwischen 0 und 1 liegen

## Antwortformat

### Erfolgreiche Antwort (200 OK)

```typescript theme={null}
{
  status: "success";
  message: "Assistant updated successfully";
  assistant: {
    id: string;
    name: string;
    description: string;
    instruction: string;
    emojiIcon: string;
    model: string;
    temperature: number;
    conversationStarters: string[];
    inputType: "PROMPT" | "STRUCTURED";
    webSearchEnabled: boolean;
    imageGenerationEnabled: boolean;
    canvasEnabled: boolean;
    extendedThinking: boolean;
    actions: Array<{
      actionId: string;
      requiresConfirmation: boolean;
    }>;
    inputFields: Array<{
      slug: string;
      type: string;
      label: string;
      description: string;
      required: boolean;
      order: number;
      options: string[];
      fileTypes: string[] | null;
    }>;
    attachments: string[];
    createdAt: string;
    updatedAt: string;
  };
}
```

## Fehlerbehandlung

```typescript theme={null}
try {
  const response = await axios.patch('https://api.langdock.com/assistant/v1/update', ...);
} catch (error) {
  if (error.response) {
    switch (error.response.status) {
      case 400:
        console.error('Ungültige Parameter:', error.response.data.message);
        break;
      case 401:
        console.error('Ungültiger oder fehlender API-Schlüssel');
        break;
      case 403:
        console.error('Unzureichende Berechtigungen - kein Zugriff auf diesen Assistenten');
        break;
      case 404:
        console.error('Assistent nicht gefunden oder Ressource nicht gefunden (Modell, Action, Anhang)');
        break;
      case 500:
        console.error('Server-Fehler');
        break;
    }
  }
}
```

## Best Practices

<Info>
  **Vorhandene Werte beibehalten**: Wenn du Array-Felder wie `actions` oder `attachments` aktualisierst, füge immer vorhandene Elemente ein, die du behalten möchtest, da das gesamte Array ersetzt wird.
</Info>

1. **Vor dem Update abrufen** - Wenn du vorhandene Array-Werte beibehalten musst, rufe zuerst die aktuelle Assistenten-Konfiguration ab
2. **Inkrementelle Updates** - Aktualisiere nur die Felder, die geändert werden müssen
3. **Anhänge validieren** - Stelle sicher, dass Anhang-UUIDs gültig sind, bevor du sie einfügst
4. **Actions testen** - Überprüfe, dass Actions zu aktivierten Integrationen gehören, bevor du aktualisierst
5. **Fehler elegant behandeln** - Implementiere eine ordnungsgemäße Fehlerbehandlung für Validierungsfehler

## Migration zur Agents API

Die neue Agents API bietet verbesserte Kompatibilität mit modernen AI SDKs. Der Update-Endpunkt hat ähnliche Funktionalität mit aktualisierten Parameternamen.

Siehe den entsprechenden Endpunkt in der Agents API:

* [Agent Update API](/de/developer/agents-api/agent-update) - Verwendet `agentId` statt `assistantId`

<Info>
  Langdock blockiert bewusst Browser-basierte Anfragen, um deinen API-Schlüssel zu schützen und die Sicherheit deiner Anwendungen zu gewährleisten. Weitere Informationen findest du in unserem Guide zu [Best Practices für API-Schlüssel](/de/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>


## OpenAPI

````yaml PATCH /assistant/v1/update
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /assistant/v1/update:
    patch:
      tags:
        - Assistant Build
      summary: '[Deprecated] Updates an existing assistant'
      description: >-
        This endpoint is deprecated. Please use /agent/v1/update for new
        integrations. Updates an existing assistant in your workspace. Only
        provided fields will be updated.
      operationId: updateAgent
      requestBody:
        required: true
        content:
          application/json:
            examples:
              updateBasicProperties:
                summary: Update name and description
                value:
                  assistantId: 550e8400-e29b-41d4-a716-446655440000
                  name: Advanced Document Analyzer
                  description: Analyzes documents with enhanced capabilities
                  creativity: 0.7
              enableCapabilities:
                summary: Enable web search
                value:
                  assistantId: 550e8400-e29b-41d4-a716-446655440000
                  webSearch: true
                  conversationStarters:
                    - Search the web for recent news
                    - Analyze this data
              updateActions:
                summary: Replace actions array
                value:
                  assistantId: 550e8400-e29b-41d4-a716-446655440000
                  actions:
                    - actionId: action-uuid-1
                      requiresConfirmation: true
                    - actionId: action-uuid-2
                      requiresConfirmation: false
              clearFields:
                summary: Clear optional fields with null
                value:
                  assistantId: 550e8400-e29b-41d4-a716-446655440000
                  description: null
                  emoji: null
            schema:
              type: object
              required:
                - assistantId
              properties:
                assistantId:
                  type: string
                  format: uuid
                  description: UUID of the agent to update
                name:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Updated name
                description:
                  type: string
                  maxLength: 256
                  nullable: true
                  description: Updated description (null to clear)
                emoji:
                  type: string
                  nullable: true
                  description: Updated emoji icon (null to clear)
                instruction:
                  type: string
                  maxLength: 16384
                  nullable: true
                  description: Updated system prompt (null to clear)
                inputType:
                  type: string
                  enum:
                    - PROMPT
                    - STRUCTURED
                  description: Updated input type for the agent
                model:
                  type: string
                  description: Model ID to use (see Models for Agent API)
                creativity:
                  type: number
                  minimum: 0
                  maximum: 1
                  description: Updated temperature
                conversationStarters:
                  type: array
                  items:
                    type: string
                  description: Updated array of suggested prompts (replaces existing)
                actions:
                  type: array
                  items:
                    type: object
                    required:
                      - actionId
                    properties:
                      actionId:
                        type: string
                        format: uuid
                      requiresConfirmation:
                        type: boolean
                        default: false
                  description: Updated array of actions (replaces existing)
                inputFields:
                  type: array
                  items:
                    type: object
                    required:
                      - slug
                      - type
                      - label
                      - order
                    properties:
                      slug:
                        type: string
                      type:
                        type: string
                        enum:
                          - TEXT
                          - MULTI_LINE_TEXT
                          - NUMBER
                          - CHECKBOX
                          - FILE
                          - SELECT
                          - DATE
                      label:
                        type: string
                      description:
                        type: string
                      required:
                        type: boolean
                        default: false
                      order:
                        type: integer
                        minimum: 0
                      options:
                        type: array
                        items:
                          type: string
                      fileTypes:
                        type: array
                        items:
                          type: string
                  description: Updated array of form fields (replaces existing)
                attachments:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: Updated array of attachment UUIDs (replaces existing)
                webSearch:
                  type: boolean
                  description: Updated web search capability setting
                imageGeneration:
                  type: boolean
                  description: Updated image generation capability setting
                dataAnalyst:
                  type: boolean
                  deprecated: true
                  description: Deprecated. Accepted for compatibility and ignored.
                canvas:
                  type: boolean
                  description: Updated canvas capability setting
      responses:
        '200':
          description: Agent updated successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                  - agent
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  message:
                    type: string
                    example: Assistant updated successfully
                  assistant:
                    $ref: '#/components/schemas/AssistantDetails'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: object
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '403':
          description: Insufficient permissions - no access to this agent
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: Agent not found or resource not found (model, action, attachment)
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
      deprecated: true
components:
  schemas:
    AssistantDetails:
      type: object
      required:
        - id
        - name
        - emojiIcon
        - model
        - temperature
        - inputType
        - webSearchEnabled
        - imageGenerationEnabled
        - canvasEnabled
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the agent
        name:
          type: string
          description: Name of the agent
        description:
          type: string
          nullable: true
          description: Description of what the agent does
        instruction:
          type: string
          nullable: true
          description: System prompt/instructions for the agent
        emojiIcon:
          type: string
          nullable: true
          description: Emoji icon for the agent
        model:
          type: string
          description: Model ID to use (see Models for Agent API)
        temperature:
          type: number
          minimum: 0
          maximum: 1
          description: Temperature/creativity setting for response generation
        conversationStarters:
          type: array
          items:
            type: string
          description: Array of suggested prompts to help users get started
        inputType:
          type: string
          enum:
            - PROMPT
            - STRUCTURED
          description: Input type for the agent
        webSearchEnabled:
          type: boolean
          description: Whether web search capability is enabled
        imageGenerationEnabled:
          type: boolean
          description: Whether image generation capability is enabled
        canvasEnabled:
          type: boolean
          description: Whether canvas capability is enabled
        extendedThinking:
          type: boolean
          description: >-
            Whether extended thinking is enabled. Only supported on models that
            expose this capability; enabling it on an unsupported model returns
            a 400 error.
        actions:
          type: array
          items:
            type: object
            required:
              - actionId
              - requiresConfirmation
            properties:
              actionId:
                type: string
                format: uuid
                description: UUID of the action from an enabled integration
              requiresConfirmation:
                type: boolean
                description: Whether user confirmation is required before executing
          description: Array of action objects for custom integrations
        inputFields:
          type: array
          items:
            type: object
            required:
              - slug
              - type
              - label
              - required
              - order
            properties:
              slug:
                type: string
                description: Unique identifier for the field
              type:
                type: string
                enum:
                  - TEXT
                  - MULTI_LINE_TEXT
                  - NUMBER
                  - CHECKBOX
                  - FILE
                  - SELECT
                  - DATE
                description: Field type
              label:
                type: string
                description: Display label for the field
              description:
                type: string
                description: Help text for the field
              required:
                type: boolean
                description: Whether the field is required
              order:
                type: integer
                minimum: 0
                description: Display order (0-indexed)
              options:
                type: array
                items:
                  type: string
                description: Options for SELECT type fields
              fileTypes:
                type: array
                items:
                  type: string
                nullable: true
                description: Allowed file types for FILE type fields
          description: Array of form field definitions (for STRUCTURED input type)
        attachments:
          type: array
          items:
            type: string
            format: uuid
          description: Array of attachment UUIDs associated with the agent
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the agent was created
        updatedAt:
          type: string
          format: date-time
          description: Timestamp when the agent was last updated
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````