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

# Update Action

> Updates an existing actions configuration. This includes modifying the action name, description, trigger conditions, and behavior settings.

Updates an existing action's configuration. This includes modifying the action name, description, trigger conditions, and behavior settings.

```http theme={null}
PUT https://services.leadconnectorhq.com/conversation-ai/agents/{agentId}/actions/{actionId}
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Path parameters

<ParamField path="actionId" type="string" required>
  The unique identifier of the action ID Attached to the agent
</ParamField>

<ParamField path="agentId" type="string" required />

## Body

<ParamField body="type" type="string" required default="triggerWorkflow">
  Posibles valores: 'triggerWorkflow', 'updateContactField', 'appointmentBooking', 'stopBot', 'humanHandOver', 'advancedFollowup', 'transferBot'
</ParamField>

<ParamField body="name" type="string" required default="Trigger a Workflow" />

<ParamField body="details" type="object" required>
  Action-specific details. The structure depends on the action type. For TRIGGER\_WORKFLOW use triggerWorkflowDto, for UPDATE\_CONTACT\_FIELD use updateContactFieldDto, for APPOINTMENT\_BOOKING use appointmentBookingDto, for STOP\_BOT use stopBotDto, for HUMAN\_HAND\_OVER use humanHandOverDto, for ADVANCED\_FOLLOWUP use advancedFollowupDto, and for TRANSFER\_BOT use transferBotDto.
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="data" type="object" required>
    Updated action details
  </ResponseField>

  <ResponseField name="success" type="boolean" required default="True">
    Success status of the request
  </ResponseField>

  ```json theme={null}
  {
    "success": true
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT 'https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions/YOUR_actionId' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "type": "triggerWorkflow",
    "name": "Trigger a Workflow"
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions/YOUR_actionId', {
    method: 'PUT',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"type": "triggerWorkflow", "name": "Trigger a Workflow"}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'PUT',
      'https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions/YOUR_actionId',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"type": "triggerWorkflow", "name": "Trigger a Workflow"},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/conversation-ai/agents/YOUR_agentId/actions/YOUR_actionId');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'PUT',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'type': 'triggerWorkflow', 'name': 'Trigger a Workflow'}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
