> ## 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 Create API

> Einen neuen Assistenten programmatisch erstellen

<Warning>
  **Die Assistants API wird am 30. April eingestellt.**

  Für neue Projekte empfehlen wir die [Agents API](/de/developer/agents-api/agent-create). 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>

Erstellt einen neuen Assistenten in deinem Workspace programmatisch. Der erstellte Assistent kann über den Chat-Completions-Endpunkt verwendet oder über die Langdock-Benutzeroberfläche aufgerufen werden.

<Info>
  Erfordert einen API-Schlüssel mit dem `AGENT_API` Scope. Erstellte Assistenten werden automatisch mit dem API-Schlüssel geteilt, um sie in Chat-Completions zu verwenden.
</Info>

## Anfrageparameter

| Parameter              | Typ       | Erforderlich | Beschreibung                                                                   |
| ---------------------- | --------- | ------------ | ------------------------------------------------------------------------------ |
| `name`                 | string    | Ja           | Name des Assistenten (1-80 Zeichen)                                            |
| `description`          | string    | Nein         | Beschreibung der Assistentenfunktion (max. 500 Zeichen)                        |
| `emoji`                | string    | Nein         | Emoji-Icon für den Assistenten (z.B. "🤖")                                     |
| `instruction`          | string    | Nein         | Systemanweisung/Instruktionen für den Assistenten (max. 40000 Zeichen)         |
| `inputType`            | string    | Nein         | Eingabetyp: "PROMPT" oder "STRUCTURED" (Standard: "PROMPT")                    |
| `model`                | string    | Nein         | Zu verwendende Modell-UUID (verwendet Workspace-Standard wenn nicht angegeben) |
| `creativity`           | number    | Nein         | Temperatur zwischen 0-1 (Standard: 0.3)                                        |
| `conversationStarters` | string\[] | Nein         | Array von vorgeschlagenen Prompts zum Einstieg                                 |
| `actions`              | array     | Nein         | Array von Action-Objekten für benutzerdefinierte Integrationen                 |
| `inputFields`          | array     | Nein         | Array von Formularfeld-Definitionen (für STRUCTURED Eingabetyp)                |
| `attachments`          | string\[] | Nein         | Array von Anhang-UUIDs für den Assistenten                                     |
| `webSearch`            | boolean   | Nein         | Websuche-Fähigkeit aktivieren (Standard: false)                                |
| `imageGeneration`      | boolean   | Nein         | Bildgenerierungs-Fähigkeit aktivieren (Standard: false)                        |
| `dataAnalyst`          | boolean   | Nein         | Zur Kompatibilität akzeptiert. Siehe Warnhinweis unten                         |
| `canvas`               | boolean   | Nein         | Canvas-Fähigkeit aktivieren (Standard: false)                                  |
| `extendedThinking`     | boolean   | Nein         | Extended-Thinking-Modus aktivieren (Standard: false)                           |

<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>

### 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 (Standard: true)

<Info>
  Nur Actions von in deinem Workspace aktivierten Integrationen können verwendet werden.
</Info>

### Eingabefelder-Konfiguration

Bei Verwendung von `inputType: "STRUCTURED"` kannst du Formularfelder im `inputFields` Array definieren:

| Feld          | Typ       | Erforderlich | Beschreibung                                   |
| ------------- | --------- | ------------ | ---------------------------------------------- |
| `slug`        | string    | Ja           | Eindeutiger Bezeichner für das Feld            |
| `type`        | string    | Ja           | Feldtyp (siehe unterstützte Typen unten)       |
| `label`       | string    | Ja           | Anzeigebezeichnung für das Feld                |
| `description` | string    | Nein         | Hilfetext für das Feld                         |
| `required`    | boolean   | Nein         | Ob das Feld erforderlich ist (Standard: false) |
| `order`       | number    | Ja           | Anzeigereihenfolge (0-indiziert)               |
| `options`     | string\[] | Nein         | Optionen für SELECT-Feldtypen                  |
| `fileTypes`   | string\[] | Nein         | Erlaubte Dateitypen für FILE-Feldtypen         |
| `emailDomain` | string    | Nein         | Erlaubte E-Mail-Domain für EMAIL-Feldtypen     |

**Unterstützte Feldtypen:**

* `TEXT` - Einzeilige Texteingabe
* `MULTI_LINE_TEXT` - Mehrzeiliger Textbereich
* `NUMBER` - Numerische Eingabe
* `CHECKBOX` - Boolean-Checkbox
* `FILE` - Datei-Upload
* `SELECT` - Dropdown-Auswahl
* `DATE` - Datumsauswahl
* `EMAIL` - E-Mail-Adresse

## Anhangs-IDs abrufen

Um Anhänge in deinen Assistenten einzubinden, lade zuerst Dateien mit der [Upload Attachment API](/de/developer/assistants-api/upload-attachments) hoch. Dies gibt Anhang-UUIDs zurück, die du im `attachments` Array verwenden kannst.

## Beispiele

### Einen einfachen Assistenten erstellen

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

async function createBasicAssistant() {
  const response = await axios.post(
    "https://api.langdock.com/assistant/v1/create",
    {
      name: "Dokumentenanalyse",
      description: "Analysiert und fasst Dokumente zusammen",
      emoji: "📄",
      instruction: "Du bist ein hilfreicher Assistent, der Dokumente analysiert und klare Zusammenfassungen der wichtigsten Informationen liefert.",
      creativity: 0.5,
      conversationStarters: [
        "Fasse dieses Dokument zusammen",
        "Was sind die wichtigsten Punkte?",
        "Extrahiere Aktionspunkte"
      ],
      webSearch: false
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Assistent erstellt:", response.data.assistant.id);
}
```

## Validierungsregeln

Die API wendet mehrere Validierungsregeln an:

* **Modell** - Muss in der Liste der aktiven Modelle deines Workspaces sein
* **Actions** - Müssen zu in deinem Workspace aktivierten Integrationen gehören
* **Anhänge** - Müssen in deinem Workspace existieren und nicht gelöscht sein
* **Berechtigungen** - Dein API-Schlüssel muss die `createAssistants` Berechtigung haben
* **Name** - Muss zwischen 1-80 Zeichen sein
* **Beschreibung** - Maximal 500 Zeichen
* **Instruktion** - Maximal 40000 Zeichen
* **Creativity** - Muss zwischen 0 und 1 liegen

## Wichtige Hinweise

<Warning>
  Vorausgewählte OAuth-Verbindungen werden über die API nicht unterstützt. Benutzer müssen OAuth-Verbindungen über die Langdock-Benutzeroberfläche konfigurieren.
</Warning>

* Erstellte Assistenten werden automatisch mit deinem API-Schlüssel für die Verwendung in Chat-Completions geteilt
* Der Ersteller des API-Schlüssels wird zum Eigentümer und kann den Assistenten in der Benutzeroberfläche verwalten
* Anhänge sind bidirektional mit dem Assistenten verknüpft
* Der Assistenten-Typ wird auf `AGENT` gesetzt (nicht `WORKFLOW` oder `PROJECT`)
* `createdBy` und `workspaceId` werden automatisch aus deinem API-Schlüssel übernommen

## Antwortformat

### Erfolgreiche Antwort (201 Created)

```typescript theme={null}
{
  status: "success";
  message: "Assistant created 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;
      emailDomain: string | null;
    }>;
    attachments: string[];
    createdAt: string;
    updatedAt: string;
  };
}
```

## Fehlerbehandlung

```typescript theme={null}
try {
  const response = await axios.post('https://api.langdock.com/assistant/v1/create', ...);
} 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 - erfordert AGENT_API Scope');
        break;
      case 404:
        console.error('Ressource nicht gefunden (Modell, Action oder Anhang)');
        break;
      case 500:
        console.error('Server-Fehler');
        break;
    }
  }
}
```

## Migration zur Agents API

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

Siehe den entsprechenden Endpunkt in der Agents API:

* [Agent Create API](/de/developer/agents-api/agent-create) - 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 POST /assistant/v1/create
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
security:
  - bearerAuth: []
paths:
  /assistant/v1/create:
    post:
      tags:
        - Assistant Build
      summary: '[Deprecated] Creates a new assistant'
      description: >-
        This endpoint is deprecated. Please use /agent/v1/create for new
        integrations. Creates a new assistant in your workspace
        programmatically.
      operationId: createAgent
      requestBody:
        required: true
        content:
          application/json:
            examples:
              basicAgent:
                summary: Basic agent with minimal configuration
                value:
                  name: Document Analyzer
                  description: Analyzes and summarizes documents
                  emoji: 📄
                  instruction: You are a helpful agent that analyzes documents.
                  creativity: 0.5
              agentWithActions:
                summary: Agent with actions and capabilities
                value:
                  name: Email Agent
                  description: Helps manage and send emails
                  emoji: 📧
                  instruction: You are an email agent.
                  model: gpt-5-mini
                  creativity: 0.7
                  conversationStarters:
                    - Send an email to my team
                    - Draft a follow-up email
                  actions:
                    - actionId: action-uuid
                      requiresConfirmation: true
                  webSearch: true
              structuredInputAgent:
                summary: Agent with structured input fields
                value:
                  name: Invoice Analyzer
                  description: Analyzes invoices
                  emoji: 🧾
                  instruction: You are an invoice analysis agent.
                  inputType: STRUCTURED
                  inputFields:
                    - slug: customer_name
                      type: TEXT
                      label: Customer Name
                      description: Enter customer name
                      required: true
                      order: 0
                      options: []
                    - slug: invoice_date
                      type: DATE
                      label: Invoice Date
                      required: true
                      order: 1
                      options: []
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Name of the agent
                description:
                  type: string
                  maxLength: 256
                  description: Description of what the agent does
                emoji:
                  type: string
                  description: Emoji icon for the agent (e.g., "🤖")
                instruction:
                  type: string
                  maxLength: 16384
                  description: System prompt/instructions for the agent
                inputType:
                  type: string
                  enum:
                    - PROMPT
                    - STRUCTURED
                  default: PROMPT
                  description: 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
                  default: 0.3
                  description: Temperature for response generation
                conversationStarters:
                  type: array
                  items:
                    type: string
                  description: Array of suggested prompts to help users get started
                actions:
                  type: array
                  items:
                    type: object
                    required:
                      - actionId
                    properties:
                      actionId:
                        type: string
                        format: uuid
                        description: UUID of the action from an enabled integration
                      requiresConfirmation:
                        type: boolean
                        default: false
                        description: Whether to require user confirmation before executing
                  description: Array of action objects for custom integrations
                inputFields:
                  type: array
                  items:
                    type: object
                    required:
                      - slug
                      - type
                      - label
                      - 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
                        default: false
                        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
                        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 to include with the agent
                webSearch:
                  type: boolean
                  default: false
                  description: Enable web search capability
                imageGeneration:
                  type: boolean
                  default: false
                  description: Enable image generation capability
                dataAnalyst:
                  type: boolean
                  default: false
                  deprecated: true
                  description: Deprecated. Accepted for compatibility and ignored.
                canvas:
                  type: boolean
                  default: false
                  description: Enable canvas capability
      responses:
        '201':
          description: Agent created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                  - agent
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  message:
                    type: string
                    example: Assistant created 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 - requires AGENT_API scope
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: Resource not found (model, action, or 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"

````