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

> Update an existing trigger in an integration

<Info>
  **Using our API via a dedicated deployment?** Just replace `api.langdock.com` with your deployment's base URL: **`<deployment-url>/api/public`**
</Info>

Updates an existing trigger in an integration. This replaces the trigger configuration with the provided values.

## Required Scopes

This endpoint requires the `INTEGRATION_API` scope.

## Path Parameters

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

## Request Body

| Parameter     | Type   | Required | Description                                                   |
| ------------- | ------ | -------- | ------------------------------------------------------------- |
| `name`        | string | Yes      | Trigger name (max 100 characters)                             |
| `description` | string | No       | Trigger description (max 90 characters)                       |
| `pollingCode` | string | No       | JavaScript code to poll for new events (max 1,000 characters) |
| `inputFields` | array  | No       | Input fields for configuring the trigger                      |

See [Create Trigger](/en/developer/integrations-api/create-trigger) for the full input field schema.

## Example

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

async function updateTrigger(integrationId, triggerId) {
  const response = await axios.put(
    `https://api.langdock.com/integrations/v1/${integrationId}/triggers/${triggerId}`,
    {
      name: "New Issue Created v2",
      description: "Updated trigger with additional filtering options",
      pollingCode: `
        const url = new URL('https://api.example.com/v2/issues');
        url.searchParams.set('since', lastPollTime);
        url.searchParams.set('project', inputs.projectId);

        const response = await fetch(url, {
          headers: {
            'Authorization': 'Bearer ' + secrets.API_TOKEN
          }
        });

        return await response.json();
      `,
      inputFields: [
        {
          label: "Project ID",
          type: "TEXT",
          required: true
        },
        {
          label: "Status Filter",
          type: "SELECT",
          options: [
            { label: "All", value: "all" },
            { label: "Open", value: "open" },
            { label: "Closed", value: "closed" }
          ],
          required: false
        }
      ]
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

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

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

## Response Format

### Success Response (200 OK)

```typescript theme={null}
{
  trigger: {
    id: string;
    name: string;
    slug: string;
    description: string;
    type: string;
    pollingCode: string | null;
    inputFields: Array<{
      slug: string;
      label: string;
      type: string;
      description: string;
      placeholder: string | null;
      required: boolean;
      options: Array<{label: string, value: string}> | null;
      allowMultiSelect: boolean | 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 trigger not found |
| 429         | Rate limit exceeded              |

<Info>
  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](/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>
