> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/automation/actions.md).

# Actions

## Introduction

`Actions` define "what" should happen after a Trigger has been evaluated.

An Action belongs to a [Trigger](/api-reference/automation/triggers.md) and executes logic based on its `type` and `config` (for example `webhook`, `notify`, `createTaskAssignment`, ...).

Actions can be targeted to users/departments and can be overwritten in specific contexts via [ActionOverwrites](/api-reference/automation/action-overwrites.md).

## Model Definition

### Relations

| Key                | Relation                                         | Type            | Relation Field(s)         |
| ------------------ | ------------------------------------------------ | --------------- | ------------------------- |
| `trigger`          | [Trigger](/api-reference/automation/triggers.md) | Belongs To      | `trigger_id`              |
| `actionExecutions` | ActionExecution                                  | Has Many        | `action_id`               |
| `users`            | User                                             | Belongs To Many | Pivot `user_action`       |
| `departments`      | Department                                       | Belongs To Many | Pivot `department_action` |

### Traits

* `HasProcessors`
* `HasTargetables`
* `HasTriggers`
* `SoftDeletes`
* `Sortable`
* `HasFactory`
* `Translatable`
* `Decoratable`

## Action Types

* [createTaskAssignment](/api-reference/automation/action-types/create-task-assignment.md)
* [notify](/api-reference/automation/action-types/notify.md)
* [webhook](/api-reference/automation/action-types/webhook.md)

## Create

Create a new `Action`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/actions`

**Request Keys**

| Key                        | Type           | Default                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| -------------------------- | -------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title`\*                  | string         | -                                     | Action title.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `trigger_id`\*             | integer        | -                                     | ID of the related [Trigger](/api-reference/automation/triggers.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `lang_id`                  | string         | system language                       | Language for translatable Action fields. If omitted, the system language is used.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `type`\*                   | string         | -                                     | Action type. Allowed values: [`createTaskAssignment`](/api-reference/automation/action-types/create-task-assignment.md), `fileMove`, `filemanagerSync`, [`notify`](/api-reference/automation/action-types/notify.md), `userSync`, [`webhook`](/api-reference/automation/action-types/webhook.md).                                                                                                                                                                                                                                         |
| `on_condition`             | boolean        | `true`                                | Whether the Action runs on fulfilled (`true`) or failed (`false`) condition branch.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `tries`                    | integer        | `1`                                   | Number of retry attempts for execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `timeout`                  | integer        | `120`                                 | Timeout in seconds for execution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `config`\*                 | object         | default config by `type`              | Type-specific configuration payload.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assign_mode`              | string         | `none`                                | Targeting strategy. Allowed values: `null` (`none`), `all`, `all_users`, `all_group_accounts`, `any_of`, `one_of`, `any_of_user`, `one_of_user`.                                                                                                                                                                                                                                                                                                                                                                                          |
| `computed_targetable_type` | string \| null | `null`                                | Optional computed targetable resolver type (depends on Action type). Available values: `for_executing_department`, `for_executing_real_department`, `for_executing_user`, `for_executing_real_user`, `from_task_assignment`, `from_workflow_node`, `from_entity_select_fields_users`, `from_entity_select_fields_departments`, `for_workflow_node_department`, `for_workflow_node_executed_user_department`, `for_workflow_node_user`, `for_workflow_node_executed_user`, `for_system_variable_users`, `for_system_variable_departments`. |
| `active`                   | boolean        | `true`                                | Whether the Action is active.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `sort_number`              | integer        | -                                     | Sort order inside the Trigger branch.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `user_ids`                 | integer\[]     | `[]` (for assign mode `none/all/...`) | Explicit target users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `department_ids`           | integer\[]     | `[]` (for assign mode `none/all/...`) | Explicit target departments.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

Keys marked with `*` are required.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/actions', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => 'Send Webhook',
        'trigger_id' => 42,
        'type' => 'webhook',
        'config' => [
            'url' => 'https://httpbin.org/post',
            'method' => 'POST',
            'headers' => [],
            'auth' => null,
        ],
        'on_condition' => true,
        'tries' => 1,
        'timeout' => 120,
        'assign_mode' => 'none',
        'active' => true,
        'sort_number' => 10,
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 1,
    "title": "Send Webhook",
    "trigger_id": 42,
    "lang_id": "de",
    "type": "webhook",
    "on_condition": true,
    "tries": 1,
    "timeout": 120,
    "config": {
      "url": "https://httpbin.org/post",
      "method": "POST",
      "headers": [],
      "auth": null
    },
    "assign_mode": "none",
    "computed_targetable_type": null,
    "active": true,
    "sort_number": 10,
    "created_at": "2024-01-01 10:00:00",
    "updated_at": "2024-01-01 10:00:00",
    "deleted_at": null
  }
}
```

## Update

Update an existing `Action`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/actions/{action}`

**Request Keys**

| Key                        | Type           | Default                                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------------- | -------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title`                    | string         | -                                                                    | Updated Action title.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `trigger_id`               | integer        | -                                                                    | New Trigger ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `lang_id`                  | string         | -                                                                    | Updated language for translatable fields.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `type`                     | string         | current Action type                                                  | Updated Action type. Allowed values: [`createTaskAssignment`](/api-reference/automation/action-types/create-task-assignment.md), `fileMove`, `filemanagerSync`, [`notify`](/api-reference/automation/action-types/notify.md), `userSync`, [`webhook`](/api-reference/automation/action-types/webhook.md).                                                                                                                                                                                                                                     |
| `on_condition`             | boolean        | -                                                                    | Updated branch behavior.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `tries`                    | integer        | -                                                                    | Updated retry attempts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `timeout`                  | integer        | -                                                                    | Updated timeout in seconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `config`                   | object         | default config by `type` (only if type changed and `config` omitted) | Updated type-specific config payload.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assign_mode`              | string         | current assign mode                                                  | Updated targeting strategy. Allowed values: `null` (`none`), `all`, `all_users`, `all_group_accounts`, `any_of`, `one_of`, `any_of_user`, `one_of_user`.                                                                                                                                                                                                                                                                                                                                                                                      |
| `computed_targetable_type` | string \| null | -                                                                    | Updated computed targetable resolver type (depends on Action type). Available enum values: `for_executing_department`, `for_executing_real_department`, `for_executing_user`, `for_executing_real_user`, `from_task_assignment`, `from_workflow_node`, `from_entity_select_fields_users`, `from_entity_select_fields_departments`, `for_workflow_node_department`, `for_workflow_node_executed_user_department`, `for_workflow_node_user`, `for_workflow_node_executed_user`, `for_system_variable_users`, `for_system_variable_departments`. |
| `active`                   | boolean        | -                                                                    | Updated active state.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `sort_number`              | integer        | -                                                                    | Updated sort order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `user_ids`                 | integer\[]     | `[]` (for assign mode `none/all/...`)                                | Updated target users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `department_ids`           | integer\[]     | `[]` (for assign mode `none/all/...`)                                | Updated target departments.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

All keys are optional for `Update`.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/actions/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => 'Send Notify',
        'type' => 'notify',
        'config' => [
            'title' => 'Notification Title',
            'body' => 'Notification Body',
            'exclude_executing_targetable' => false,
            'send_mail' => false,
            'plain_email' => false
        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 1,
    "title": "Send Notify",
    "trigger_id": 42,
    "lang_id": "de",
    "type": "notify",
    "on_condition": true,
    "tries": 1,
    "timeout": 120,
    "config": {
      "title": "Notification Title",
      "body": "Notification Body",
      "exclude_executing_targetable": false,
      "send_mail": false,
      "plain_email": false
    },
    "assign_mode": "none",
    "computed_targetable_type": null,
    "active": true,
    "sort_number": 10,
    "created_at": "2024-01-01 10:00:00",
    "updated_at": "2024-01-02 11:00:00",
    "deleted_at": null
  }
}
```

## Delete

Delete an `Action`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/actions/{action}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/actions/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": null
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.intratool.de/api-reference/automation/actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
