# Create/Update

## Create an action workflow

<mark style="color:green;">`POST`</mark> `https://api.couchdrop.io/manage/workflow/events`

&#x20;

#### Headers

| Name  | Type   | Description      |
| ----- | ------ | ---------------- |
| token | String | API Access Token |

#### Request Body

| Name       | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|            | String            | If id is provided the existing workflow with this id will be updated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| enabled    | Boolean           | Enable or disable the workflow                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| name       | String            | Workflow name in the system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| conditions | JSON Array String | <p>Conditions that need to be met for this workflow to action upon.</p><p></p><p>E.g.</p><p>\[ { "condition\_type": "and", "id": "e6fde778-66cc-48ce-89ba-0fc7c41645e9", "transaction\_type": "upload", "type": "transaction" }, { "condition\_type": "and", "directory": "/myfolder/compressed/", "id": "c96fc558-904e-4a80-993d-2d8ebc42f3fe", "negate": false, "type": "directory\_matches" }, { "condition\_type": "and", "filename\_pattern": "\*.bz2", "id": "98fe1b8c-8516-4dbc-be1f-0bdce1cc131b", "negate": false, "type": "filename\_matches" } ]</p> |
| actions    | JSON Aray String  | <p>Action that will run on the files/folders that match the conditions.</p><p></p><p>E.g.</p><p>\[ { "actions": \[ { "email\_address": "<user1@couchdrop.io>", "id": "51856312-fa6c-469e-86da-0a3028611069", "type": "email" } ], "decompress\_to": "/myfolder/decompressed/", "decompress\_type": "bz2", "id": "1ce2e380-a4bc-4d05-a8e5-c47e76461419", "type": "decompress" } ]</p>                                                                                                                                                                            |
| delay      | Integer           | Delay of the workflow execution in seconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| position   | Integer           | Position of this workflows run order if multiple workflows are configured. Starts with 0                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

{% tabs %}
{% tab title="200: OK Returns the new workflow in JSON format" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="403: Forbidden " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}
