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

# Update Action

> Update an existing action in an integration

Updates an existing action in an integration. Changing `name` does not change the action slug.

## Base URL

```
https://api.langdock.com/integrations/v1/{integrationId}/actions/{actionId}
```

> [!WARNING]
>
> **Dedicated deployments**
>
> Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.

## Required Scopes

This endpoint requires the `INTEGRATION_API` scope.

## Parameters

### Path Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `integrationId` | string | Yes | UUID of the integration |
| `actionId` | string | Yes | UUID of the action to update |

### Request Body

| Parameter | Type | Required | Description |
| - | - | - | - |
| `name` | string | Yes | Action name (max 100 characters) |
| `description` | string | No | Action description (max 1,024 characters) |
| `code` | string | No | JavaScript code to execute (max 150,000 characters) |
| `inputFields` | array | No | Input fields for the action |
| `requiresConfirmation` | boolean | No | Whether the action requires user confirmation before running |
| `activeLabel` | string | No | Label shown in chat while the action runs (max 100 characters) |
| `doneLabel` | string | No | Label shown in chat after the action succeeds (max 100 characters) |
| `failedLabel` | string | No | Label shown in chat when the action fails (max 100 characters) |

See [Create Action](https://docs.langdock.com/en/developer/integrations-api/create-action.md) for the full input field schema.

> [!NOTE]
>
> Sending the same field label keeps the field's stored `data.input` key when that key is the camelCase form of the label. This includes the older casing from earlier Integrations API versions, such as `userID` for User ID, so existing action code keeps working.

> [!NOTE]
>
> If you omit `description`, it is cleared. If you omit `inputFields`, all existing input fields are removed. If you omit `code`, `requiresConfirmation`, or a label, the current value is preserved. To remove a label, send it as `null`. Supplying `inputFields` replaces the complete field list. If an input field omits `jsonSchema`, the existing JSON Schema is preserved when the field keeps its stored key. To remove a JSON Schema, send `jsonSchema: null` explicitly.

## Example

```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 ld.request({
          method: "GET",
          url: "https://api.example.com/v2/users/" + data.input.userId
        });
        return 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");
```

## Response Format

### Success Response (200 OK)

```typescript theme={null}
{
  action: {
    id: string;
    name: string;
    slug: string;
    description: string;
    code: string | null;
    order: number;
    requiresConfirmation: boolean;
    activeLabel: string | null;
    doneLabel: string | null;
    failedLabel: string | null;
    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;
    }>;
  };
}
```

## Error Handling

| Status Code | Description |
| - | - |
| 400 | Invalid request body or IDs |
| 401 | Invalid or missing API key |
| 403 | No access to this integration |
| 404 | Integration or action not found |
| 422 | Unsupported integration type. Update actions only on a workspace owned API integration. |
| 429 | Rate limit exceeded |

> [!NOTE]
>
> Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](https://docs.langdock.com/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices.md).


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