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

# Action aktualisieren

> Eine bestehende Action in einer Integration aktualisieren

<Info>
  **Nutzt du unsere API über ein Dedicated Deployment?** Ersetze einfach `api.langdock.com` mit der Basis-URL deines Deployments: **`<deployment-url>/api/public`**
</Info>

Aktualisiert eine bestehende Action in einer Integration. Dabei wird die Action-Konfiguration mit den angegebenen Werten ersetzt.

## Erforderliche Scopes

Dieser Endpoint erfordert den `INTEGRATION_API` Scope.

## Pfad-Parameter

| Parameter       | Typ    | Erforderlich | Beschreibung                        |
| --------------- | ------ | ------------ | ----------------------------------- |
| `integrationId` | string | Ja           | UUID der Integration                |
| `actionId`      | string | Ja           | UUID der zu aktualisierenden Action |

## Request Body

| Parameter              | Typ     | Erforderlich | Beschreibung                                                               |
| ---------------------- | ------- | ------------ | -------------------------------------------------------------------------- |
| `name`                 | string  | Ja           | Action-Name (max. 100 Zeichen)                                             |
| `description`          | string  | Nein         | Action-Beschreibung (max. 1.000 Zeichen)                                   |
| `code`                 | string  | Nein         | Auszuführender JavaScript-Code                                             |
| `inputFields`          | array   | Nein         | Eingabefelder für die Action                                               |
| `requiresConfirmation` | boolean | Nein         | Ob die Action vor der Ausführung eine Bestätigung durch den User erfordert |

Das vollständige Eingabefeld-Schema findest du unter [Action erstellen](/de/developer/integrations-api/create-action).

<Info>
  Beim Aktualisieren einer Action werden die Eingabefelder durch die gesendeten Werte ersetzt. Wenn ein Eingabefeld `jsonSchema` weglässt, bleibt das bestehende JSON Schema dieses Feldes (anhand des `slug` zugeordnet) erhalten. Um ein JSON Schema zu entfernen, sende `jsonSchema: null` explizit.
</Info>

## Beispiel

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

async function updateAction(integrationId, actionId) {
  const response = await axios.put(
    `https://api.langdock.com/integrations/v1/${integrationId}/actions/${actionId}`,
    {
      name: "Get User Data v2",
      description: "Updated action with additional fields",
      code: `
        const response = await fetch('https://api.example.com/v2/users/' + inputs.userId);
        return await response.json();
      `,
      inputFields: [
        {
          label: "User ID",
          type: "TEXT",
          required: true
        },
        {
          label: "Format",
          type: "SELECT",
          options: [
            { label: "JSON", value: "json" },
            { label: "XML", value: "xml" }
          ],
          required: false
        }
      ]
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Updated action:", response.data.action);
}

updateAction("550e8400-e29b-41d4-a716-446655440000", "660e8400-e29b-41d4-a716-446655440001");
```

## Antwortformat

### Erfolgreiche Antwort (200 OK)

```typescript theme={null}
{
  action: {
    id: string;
    name: string;
    slug: string;
    description: string;
    code: string | null;
    order: number;
    requiresConfirmation: boolean;
    inputFields: Array<{
      slug: string;
      label: string;
      type: string;
      description: string;
      placeholder: string | null;
      required: boolean;
      order: number;
      options: Array<{label: string, value: string}> | null;
      allowMultiSelect: boolean | null;
      contextActionId: string | null;
      jsonSchema: string | null;
    }>;
  };
}
```

## Fehlerbehandlung

| Status Code | Beschreibung                                   |
| ----------- | ---------------------------------------------- |
| 400         | Ungültiger Request Body oder ungültige IDs     |
| 401         | Ungültiger oder fehlender API-Schlüssel        |
| 403         | Kein Zugriff auf diese Integration             |
| 404         | Integration oder Action nicht gefunden         |
| 409         | Eine Action mit diesem Namen existiert bereits |
| 429         | Rate Limit überschritten                       |

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