# Update workflow

> Source: https://truto.one/docs/api-reference/admin/workflows/update/

`PATCH /workflow/{id}`

Resource: **Workflows**

## Path parameters

- **`id`** _(string, required)_

## Request body

- **`trigger_name`** _(string)_
- **`config`** _(object, required)_
  Workflow execution configuration.
  - **`run_if`** _(string)_
    JSONata condition evaluated before executing workflow steps.
  - **`steps`** _(array<object>)_
    - **`type`** _(string)_
      Step execution type.
      Allowed: `run`
    - **`action`** _(string)_
      Action executed by the step.
    - **`cron_expression`** _(string)_
      Optional cron expression for scheduled execution, in UTC. When set, the step creates a sync job cron trigger instead of starting a run, so the trigger's check applies: the step fails if the expression doesn't parse or its next two runs are less than 5 minutes apart.
    - **`config`** _(string)_
      JSONata expression evaluated at runtime to generate the step execution payload.

## Response body

- **`id`** _(string)_
- **`environment_id`** _(string)_
- **`trigger_name`** _(string)_
- **`config`** _(object, required)_
  Workflow execution configuration.
  - **`run_if`** _(string)_
    JSONata condition evaluated before executing workflow steps.
  - **`steps`** _(array<object>)_
    - **`type`** _(string)_
      Step execution type.
      Allowed: `run`
    - **`action`** _(string)_
      Action executed by the step.
    - **`cron_expression`** _(string)_
      Optional cron expression for scheduled execution, in UTC. When set, the step creates a sync job cron trigger instead of starting a run, so the trigger's check applies: the step fails if the expression doesn't parse or its next two runs are less than 5 minutes apart.
    - **`config`** _(string)_
      JSONata expression evaluated at runtime to generate the step execution payload.
- **`created_at`** _(string)_
- **`updated_at`** _(string)_

## Code examples

### curl

```bash
curl -X PATCH 'https://api.truto.one/workflow/{id}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "trigger_name": "integrated_account:active",
  "config": {}
}'
```

### JavaScript

```javascript
const body = {
  "trigger_name": "integrated_account:active",
  "config": {}
};

const response = await fetch('https://api.truto.one/workflow/{id}', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/workflow/{id}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "trigger_name": "integrated_account:active",
    "config": {}
}

response = requests.patch(url, headers=headers, params=params, json=payload)
print(response.json())
```
