# Workflow Engine::Visual Workflows

**Summary:** Endpoints for Workflow Engine::Visual Workflows

- Role: [Developers](https://www.subrite.no/developers)
- Source: https://www.subrite.no/developers/workflow-engine-visual-workflows
- Updated: 2026-10-13
- Markdown index: https://www.subrite.no/developers/llms.txt

<a id="get-api-v1-automation-visual-workflows"></a>
## Get all visual workflows (paginated)

`GET /api/v1/automation/visual-workflows`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |
| `orderBy` | query | `string` | Allowed values: `"id"`, `"name"`, `"createdAt"`, `"updatedAt"`, `"publishedAt"` · Default: `"createdAt"` |
| `name` | query | `string` | Filter workflows by name (case-insensitive contains). |
| `group` | query | `array of string` | Filter by one or more group label names. |
| `isPublished` | query | `boolean` | Filter by published state. true = Active, false = Draft. |

### Responses

#### 200

Content type: `application/json` · `VisualWorkflowPaginated`

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of VisualWorkflow` |   |
| `items[].name` (Required when parent is present) | `string` |   |
| `items[].nodes` (Required when parent is present) | `object` |   |
| `items[].edges` (Required when parent is present) | `object` |   |
| `items[].isPublished` (Required when parent is present) | `boolean` |   |
| `items[].publishedAt` (Required when parent is present) | `string (date-time)` | Can be null |
| `items[].updatedBy` (Required when parent is present) | `number` | Can be null |
| `items[].updatedByUser` (Required when parent is present) | `User` |   |
| `items[].updatedByUser.userType` (Required when parent is present) | `string` | Allowed values: `"system_admin"`, `"tenant_admin"`, `"member"`, `"not_set"` |
| `items[].updatedByUser.tenantId` (Required when parent is present) | `number` |   |
| `items[].updatedByUser.email` (Required when parent is present) | `string` | Can be null |
| `items[].updatedByUser.fullName` (Required when parent is present) | `string` |   |
| `items[].updatedByUser.phone` (Required when parent is present) | `string` |   |
| `items[].updatedByUser.emailVerified` (Required when parent is present) | `string` | Can be null |
| `items[].updatedByUser.phoneVerified` (Required when parent is present) | `boolean` |   |
| `items[].updatedByUser.isOwner` (Required when parent is present) | `boolean` |   |
| `items[].updatedByUser.isTestUser` (Required when parent is present) | `boolean` |   |
| `items[].updatedByUser.image` (Required when parent is present) | `string` |   |
| `items[].updatedByUser.createdInCheckoutUuid` (Required when parent is present) | `string` |   |
| `items[].updatedByUser.userRoles` | `array of UserRole` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.notes` (Required when parent is present) | `array of Note` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.exportHistory` (Required when parent is present) | `array of ExportHistory` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.userSettings` | `UserSettings` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.member` | `Member` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.userAccounts` (Required when parent is present) | `array of UserAccount` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.userSessions` (Required when parent is present) | `array of UserSession` | Nested fields omitted: depth limit. |
| `items[].updatedByUser.id` (Required when parent is present) | `number` |   |
| `items[].updatedByUser.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedByUser.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedByUser.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedByUser.metaData` (Required when parent is present) | `object` |   |
| `items[].description` (Required when parent is present) | `string` |   |
| `items[].isTemplate` (Required when parent is present) | `boolean` |   |
| `items[].tenantId` (Required when parent is present) | `number` |   |
| `items[].tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: field limit. |
| `items[].workflowRuleId` (Required when parent is present) | `string` |   |
| `items[].workflowRule` (Required when parent is present) | `WorkflowRule` |   |
| `items[].workflowRule.rule` (Required when parent is present) | `object` |   |
| `items[].workflowRule.description` (Required when parent is present) | `string` |   |
| `items[].workflowRule.isActive` (Required when parent is present) | `boolean` |   |
| `items[].workflowRule.tenantId` (Required when parent is present) | `number` |   |
| `items[].workflowRule.tenant` (Required when parent is present) | `Tenant` | Nested fields omitted: depth limit. |
| `items[].workflowRule.visualWorkflow` (Required when parent is present) | `VisualWorkflow` | Recursive schema; nested fields are not repeated. |
| `items[].workflowRule.id` (Required when parent is present) | `number` |   |
| `items[].workflowRule.createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].workflowRule.updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].workflowRule.deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].workflowRule.metaData` (Required when parent is present) | `object` |   |
| `items[].entityTags` (Required when parent is present) | `array of EntityTag` |   |
| `items[].entityTags[].productId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].tagId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].tag` (Required when parent is present) | `Tag` | Nested fields omitted: depth limit. |
| `items[].entityTags[].product` (Required when parent is present) | `Product` | Nested fields omitted: depth limit. |
| `items[].entityTags[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: depth limit. |
| `items[].entityTags[].visualWorkflowId` (Required when parent is present) | `number` |   |
| `items[].entityTags[].visualWorkflow` (Required when parent is present) | `VisualWorkflow` | Recursive schema; nested fields are not repeated. |
| `items[].entityTags[].id` (Required when parent is present) | `number` |   |
| `items[].entityTags[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].entityTags[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].entityTags[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].entityTags[].metaData` (Required when parent is present) | `object` |   |
| `items[].id` (Required when parent is present) | `number` |   |
| `items[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].metaData` (Required when parent is present) | `object` |   |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` |   |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl https://api.subrite.no/api/v1/automation/visual-workflows \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "items": [
    {
      "nodes": {},
      "edges": {},
      "entityTags": [],
      "metaData": {}
    }
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="post-api-v1-automation-visual-workflows"></a>
## Create a new visual workflow

`POST /api/v1/automation/visual-workflows`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `CreateVisualWorkflowDto`

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` | Workflow name · `maxLength`: `255` |
| `nodes` (Required) | `array of object` | React Flow nodes |
| `edges` (Required) | `array of object` | React Flow edges |
| `description` | `string` | Workflow description |
| `isPublished` | `boolean` | Whether workflow is published · Default: `true` |
| `isTemplate` | `boolean` | Whether workflow is a template · Default: `false` |
| `jsonLogic` | `object` | JSON Logic rule generated from the workflow |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "nodes": [
    {}
  ],
  "edges": [
    {}
  ],
  "description": "string",
  "isPublished": true,
  "isTemplate": false,
  "jsonLogic": {}
}
```

### Responses

#### 201

Visual workflow created successfully

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, workflowStructureInvalid

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"workflowStructureInvalid"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl https://api.subrite.no/api/v1/automation/visual-workflows \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "nodes": [
    {}
  ],
  "edges": [
    {}
  ],
  "description": "string",
  "isPublished": true,
  "isTemplate": false,
  "jsonLogic": {}
}'
```

<a id="get-api-v1-automation-visual-workflows-personalized-tokens"></a>
## Get personalized tokens for a workflow

`GET /api/v1/automation/visual-workflows/personalized-tokens`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `triggerType` | query | `string` | Trigger type to resolve trigger-specific tokens for · `maxLength`: `100` |

### Responses

#### 200

Content type: `application/json` · `WorkflowTokensDto`

| Name | Type | Description |
| --- | --- | --- |
| `subscriptionInfo` | `array of string` |   |
| `paymentInfo` | `array of string` |   |
| `tokenSamples` | `object with string values` | Realistic sample value per offered token, so an SMS editor can estimate the length of the message as sent rather than of the template |
| `others` (Required) | `array of string` |   |
| `memberInfo` (Required) | `array of string` |   |
| `myPageLink` (Required) | `array of string` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl https://api.subrite.no/api/v1/automation/visual-workflows/personalized-tokens \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "subscriptionInfo": [
    "string"
  ],
  "paymentInfo": [
    "string"
  ],
  "tokenSamples": {
    "property1": "string",
    "property2": "string"
  },
  "others": [
    "string"
  ],
  "memberInfo": [
    "string"
  ],
  "myPageLink": [
    "string"
  ]
}
```

<a id="get-api-v1-automation-visual-workflows-group-tags"></a>
## Get available workflow group tags

`GET /api/v1/automation/visual-workflows/group-tags`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

Group tags retrieved successfully

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl https://api.subrite.no/api/v1/automation/visual-workflows/group-tags \
  --header 'Authorization: Bearer <token>'
```

<a id="get-api-v1-automation-visual-workflows-id"></a>
## Get a visual workflow by ID

`GET /api/v1/automation/visual-workflows/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

Visual workflow retrieved successfully

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

Same fields as [Get personalized tokens for a workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-personalized-tokens).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"visualWorkflowNotFound"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}' \
  --header 'Authorization: Bearer <token>'
```

<a id="put-api-v1-automation-visual-workflows-id"></a>
## Update an existing visual workflow

`PUT /api/v1/automation/visual-workflows/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `UpdateVisualWorkflowDto`

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | Workflow name · `maxLength`: `255` |
| `nodes` | `array of object` | React Flow nodes |
| `edges` | `array of object` | React Flow edges |
| `description` | `string` | Workflow description |
| `isPublished` | `boolean` | Whether workflow is published |
| `isTemplate` | `boolean` | Whether workflow is a template |
| `jsonLogic` | `object` | JSON Logic rule generated from the workflow |

**Example request body**

`application/json`

```json
{
  "name": "string",
  "nodes": [
    {}
  ],
  "edges": [
    {}
  ],
  "description": "string",
  "isPublished": true,
  "isTemplate": true,
  "jsonLogic": {}
}
```

### Responses

#### 200

Visual workflow updated successfully

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, workflowStructureInvalid

Same fields as [Create a new visual workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#post-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound, jsonLogicRuleNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"visualWorkflowNotFound"`, `"jsonLogicRuleNotFound"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}' \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string",
  "nodes": [
    {}
  ],
  "edges": [
    {}
  ],
  "description": "string",
  "isPublished": true,
  "isTemplate": true,
  "jsonLogic": {}
}'
```

<a id="delete-api-v1-automation-visual-workflows-id"></a>
## Delete a visual workflow

`DELETE /api/v1/automation/visual-workflows/{id}`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

Visual workflow deleted successfully

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

Same fields as [Get personalized tokens for a workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-personalized-tokens).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound, jsonLogicRuleNotFound

Same fields as [Update an existing visual workflow (404)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#put-api-v1-automation-visual-workflows-id).

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}' \
  --request DELETE \
  --header 'Authorization: Bearer <token>'
```

<a id="put-api-v1-automation-visual-workflows-id-group-tag"></a>
## Set or remove the group tag for a visual workflow

`PUT /api/v1/automation/visual-workflows/{id}/group-tag`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `SetWorkflowGroupTagDto`

| Name | Type | Description |
| --- | --- | --- |
| `tagName` (Required) | `string` | Tag name to set as group label, or null to remove · `maxLength`: `255` · Can be null |

**Example request body**

`application/json`

```json
{
  "tagName": "string"
}
```

### Responses

#### 200

Group tag updated successfully

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

Same fields as [Get personalized tokens for a workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-personalized-tokens).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound

Same fields as [Get a visual workflow by ID (404)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-id).

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}/group-tag' \
  --request PUT \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tagName": "string"
}'
```

<a id="post-api-v1-automation-visual-workflows-id-duplicate"></a>
## Duplicate a visual workflow

`POST /api/v1/automation/visual-workflows/{id}/duplicate`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `DuplicateVisualWorkflowDto`

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` | Name for the duplicated workflow · `maxLength`: `255` |

**Example request body**

`application/json`

```json
{
  "name": "string"
}
```

### Responses

#### 201

Visual workflow duplicated successfully

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

Same fields as [Get personalized tokens for a workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-personalized-tokens).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound

Same fields as [Get a visual workflow by ID (404)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-id).

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}/duplicate' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "string"
}'
```

<a id="post-api-v1-automation-visual-workflows-id-publish"></a>
## Publish a visual workflow

`POST /api/v1/automation/visual-workflows/{id}/publish`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

Visual workflow published successfully

#### 201

Content type: `application/json` · `VisualWorkflow`

| Name | Type | Description |
| --- | --- | --- |
| `name` (Required) | `string` |   |
| `nodes` (Required) | `object` |   |
| `edges` (Required) | `object` |   |
| `isPublished` (Required) | `boolean` |   |
| `publishedAt` (Required) | `string (date-time)` | Can be null |
| `updatedBy` (Required) | `number` | Can be null |
| `updatedByUser` (Required) | `User` |   |
| `updatedByUser.userType` (Required) | `string` | Allowed values: `"system_admin"`, `"tenant_admin"`, `"member"`, `"not_set"` |
| `updatedByUser.tenantId` (Required) | `number` |   |
| `updatedByUser.email` (Required) | `string` | Can be null |
| `updatedByUser.fullName` (Required) | `string` |   |
| `updatedByUser.phone` (Required) | `string` |   |
| `updatedByUser.emailVerified` (Required) | `string` | Can be null |
| `updatedByUser.phoneVerified` (Required) | `boolean` |   |
| `updatedByUser.isOwner` (Required) | `boolean` |   |
| `updatedByUser.isTestUser` (Required) | `boolean` |   |
| `updatedByUser.image` (Required) | `string` |   |
| `updatedByUser.createdInCheckoutUuid` (Required) | `string` |   |
| `updatedByUser.userRoles` | `array of UserRole` |   |
| `updatedByUser.userRoles[].userId` (Required when parent is present) | `number` |   |
| `updatedByUser.userRoles[].roleId` (Required when parent is present) | `number` |   |
| `updatedByUser.userRoles[].user` (Required when parent is present) | `User` | Recursive schema; nested fields are not repeated. |
| `updatedByUser.userRoles[].role` (Required when parent is present) | `Role` | Nested fields omitted: depth limit. |
| `updatedByUser.userRoles[].id` (Required when parent is present) | `number` |   |
| `updatedByUser.userRoles[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `updatedByUser.userRoles[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `updatedByUser.userRoles[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `updatedByUser.userRoles[].metaData` (Required when parent is present) | `object` |   |
| `updatedByUser.notes` (Required) | `array of Note` | Nested fields omitted: field limit. |
| `updatedByUser.exportHistory` (Required) | `array of ExportHistory` | Nested fields omitted: field limit. |
| `updatedByUser.userSettings` | `UserSettings` | Nested fields omitted: field limit. |
| `updatedByUser.member` | `Member` | Nested fields omitted: field limit. |
| `updatedByUser.tenant` (Required) | `Tenant` | Nested fields omitted: field limit. |
| `updatedByUser.userAccounts` (Required) | `array of UserAccount` | Nested fields omitted: field limit. |
| `updatedByUser.userSessions` (Required) | `array of UserSession` | Nested fields omitted: field limit. |
| `updatedByUser.id` (Required) | `number` |   |
| `updatedByUser.createdAt` (Required) | `string (date-time)` |   |
| `updatedByUser.updatedAt` (Required) | `string (date-time)` |   |
| `updatedByUser.deletedAt` (Required) | `string (date-time)` |   |
| `updatedByUser.metaData` (Required) | `object` |   |
| `description` (Required) | `string` |   |
| `isTemplate` (Required) | `boolean` |   |
| `tenantId` (Required) | `number` |   |
| `tenant` (Required) | `Tenant` | Nested fields omitted: field limit. |
| `workflowRuleId` (Required) | `string` |   |
| `workflowRule` (Required) | `WorkflowRule` |   |
| `workflowRule.rule` (Required) | `object` |   |
| `workflowRule.description` (Required) | `string` |   |
| `workflowRule.isActive` (Required) | `boolean` |   |
| `workflowRule.tenantId` (Required) | `number` |   |
| `workflowRule.tenant` (Required) | `Tenant` | Nested fields omitted: field limit. |
| `workflowRule.visualWorkflow` (Required) | `VisualWorkflow` | Recursive schema; nested fields are not repeated. |
| `workflowRule.id` (Required) | `number` |   |
| `workflowRule.createdAt` (Required) | `string (date-time)` |   |
| `workflowRule.updatedAt` (Required) | `string (date-time)` |   |
| `workflowRule.deletedAt` (Required) | `string (date-time)` |   |
| `workflowRule.metaData` (Required) | `object` |   |
| `entityTags` (Required) | `array of EntityTag` |   |
| `entityTags[].productId` (Required when parent is present) | `number` |   |
| `entityTags[].tagId` (Required when parent is present) | `number` |   |
| `entityTags[].subscriptionPlanId` (Required when parent is present) | `number` |   |
| `entityTags[].tag` (Required when parent is present) | `Tag` | Nested fields omitted: field limit. |
| `entityTags[].product` (Required when parent is present) | `Product` | Nested fields omitted: field limit. |
| `entityTags[].subscriptionPlan` (Required when parent is present) | `SubscriptionPlan` | Nested fields omitted: field limit. |
| `entityTags[].visualWorkflowId` (Required when parent is present) | `number` |   |
| `entityTags[].visualWorkflow` (Required when parent is present) | `VisualWorkflow` | Recursive schema; nested fields are not repeated. |
| `entityTags[].id` (Required when parent is present) | `number` |   |
| `entityTags[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `entityTags[].updatedAt` (Required when parent is present) | `string (date-time)` |   |
| `entityTags[].deletedAt` (Required when parent is present) | `string (date-time)` |   |
| `entityTags[].metaData` (Required when parent is present) | `object` |   |
| `id` (Required) | `number` |   |
| `createdAt` (Required) | `string (date-time)` |   |
| `updatedAt` (Required) | `string (date-time)` |   |
| `deletedAt` (Required) | `string (date-time)` |   |
| `metaData` (Required) | `object` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, workflowStructureInvalid

Same fields as [Create a new visual workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#post-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound

Same fields as [Get a visual workflow by ID (404)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-id).

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 409

Content type: `application/json` · `ErrorResponse`

workflowIsAlreadyPublished

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"workflowIsAlreadyPublished"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "workflowIsAlreadyPublished",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}/publish' \
  --request POST \
  --header 'Authorization: Bearer <token>'
```

### Example response

201 · `application/json`

```json
{
  "name": "string",
  "nodes": {},
  "edges": {},
  "isPublished": true,
  "publishedAt": "2019-08-24T14:15:22Z",
  "updatedBy": 0,
  "updatedByUser": {
    "userType": "system_admin",
    "tenantId": 0,
    "email": "string",
    "fullName": "<fullName>",
    "phone": "<phone>",
    "emailVerified": "string",
    "phoneVerified": true,
    "isOwner": true,
    "isTestUser": true,
    "image": "string",
    "createdInCheckoutUuid": "string",
    "userRoles": [],
    "notes": [],
    "exportHistory": [],
    "userSettings": {
      "metaData": {}
    },
    "member": {
      "customPropertyValues": {},
      "productRecipients": [],
      "metaData": {}
    },
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "userAccounts": [],
    "userSessions": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "description": "string",
  "isTemplate": true,
  "tenantId": 0,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "workflowRuleId": "string",
  "workflowRule": {
    "rule": {},
    "description": "string",
    "isActive": true,
    "tenantId": 0,
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "visualWorkflow": {},
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "entityTags": [
    {
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {}
}
```

<a id="post-api-v1-automation-visual-workflows-id-unpublish"></a>
## Unpublish a visual workflow

`POST /api/v1/automation/visual-workflows/{id}/unpublish`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Responses

#### 200

Visual workflow unpublished successfully

#### 201

Content type: `application/json` · `VisualWorkflow`

Same fields as [Publish a visual workflow (201)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#post-api-v1-automation-visual-workflows-id-publish).

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

Same fields as [Get personalized tokens for a workflow (400)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-personalized-tokens).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

visualWorkflowNotFound

Same fields as [Get a visual workflow by ID (404)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows-id).

**Example response**

`application/json`

```json
{
  "messageCode": "visualWorkflowNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 409

Content type: `application/json` · `ErrorResponse`

workflowIsNotPublished

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"workflowIsNotPublished"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "workflowIsNotPublished",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}/unpublish' \
  --request POST \
  --header 'Authorization: Bearer <token>'
```

### Example response

201 · `application/json`

```json
{
  "name": "string",
  "nodes": {},
  "edges": {},
  "isPublished": true,
  "publishedAt": "2019-08-24T14:15:22Z",
  "updatedBy": 0,
  "updatedByUser": {
    "userType": "system_admin",
    "tenantId": 0,
    "email": "string",
    "fullName": "<fullName>",
    "phone": "<phone>",
    "emailVerified": "string",
    "phoneVerified": true,
    "isOwner": true,
    "isTestUser": true,
    "image": "string",
    "createdInCheckoutUuid": "string",
    "userRoles": [],
    "notes": [],
    "exportHistory": [],
    "userSettings": {
      "metaData": {}
    },
    "member": {
      "customPropertyValues": {},
      "productRecipients": [],
      "metaData": {}
    },
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "userAccounts": [],
    "userSessions": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "description": "string",
  "isTemplate": true,
  "tenantId": 0,
  "tenant": {
    "market": "NO",
    "productName": "enterprise",
    "additionalFeatures": [],
    "disabledFeatures": [],
    "name": "string",
    "isActive": true,
    "defaultLanguage": "en",
    "hostName": "string",
    "logo": "string",
    "favicon": "string",
    "authLogo": "string",
    "authLogoHeight": 0,
    "siteUrl": "string",
    "termsUrl": "string",
    "privacyUrl": "string",
    "gtm": "string",
    "taxRates": [],
    "smsOtp": true,
    "emailProvider": "brevo",
    "tenantContact": "string",
    "registeredBusinessNo": "string",
    "bankAccountNo": "string",
    "swiftCode": "string",
    "iban": "<iban>",
    "defaultLogoutURL": "string",
    "postalAddress": "<postalAddress>",
    "otpTemplateId": {},
    "smsSenderId": 0,
    "emailSenderId": 0,
    "smsSender": {
      "metaData": {}
    },
    "emailSender": {
      "metaData": {}
    },
    "products": [],
    "users": [],
    "members": [],
    "roles": [],
    "subscriptionPlans": [],
    "packages": [],
    "invoices": [],
    "orders": [],
    "paymentProviders": [],
    "newslettersProviderConfig": [],
    "paymentProviderConfigs": [],
    "oidcClients": [],
    "oauthProviders": [],
    "activityLogs": [],
    "m2m_api_clients": [],
    "customProperties": [],
    "consents": [],
    "preference": {
      "inputFieldConfig": [],
      "customFieldsOnMemberCard": [],
      "customFieldsOnInvoice": [],
      "visibleAdditionalFieldsOnMypage": [],
      "metaData": {}
    },
    "settings": {
      "aiResidency": {},
      "metaData": {}
    },
    "communicationTemplates": [],
    "additionalHostnames": [],
    "exportHistory": [],
    "arReportHistory": [],
    "mypageCardsSettings": [],
    "webhooks": [],
    "customOrders": [],
    "customOrderSources": [],
    "brandKits": [],
    "communicationReceivers": [],
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "workflowRuleId": "string",
  "workflowRule": {
    "rule": {},
    "description": "string",
    "isActive": true,
    "tenantId": 0,
    "tenant": {
      "additionalFeatures": [],
      "disabledFeatures": [],
      "taxRates": [],
      "products": [],
      "users": [],
      "members": [],
      "roles": [],
      "subscriptionPlans": [],
      "packages": [],
      "invoices": [],
      "orders": [],
      "paymentProviders": [],
      "newslettersProviderConfig": [],
      "paymentProviderConfigs": [],
      "oidcClients": [],
      "oauthProviders": [],
      "activityLogs": [],
      "m2m_api_clients": [],
      "customProperties": [],
      "consents": [],
      "communicationTemplates": [],
      "additionalHostnames": [],
      "exportHistory": [],
      "arReportHistory": [],
      "mypageCardsSettings": [],
      "webhooks": [],
      "customOrders": [],
      "customOrderSources": [],
      "brandKits": [],
      "communicationReceivers": [],
      "metaData": {}
    },
    "visualWorkflow": {},
    "id": 0,
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "deletedAt": "2019-08-24T14:15:22Z",
    "metaData": {}
  },
  "entityTags": [
    {
      "metaData": {}
    }
  ],
  "id": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "metaData": {}
}
```

<a id="post-api-v1-automation-visual-workflows-id-test-email"></a>
## Send a test email for a workflow node

`POST /api/v1/automation/visual-workflows/{id}/test/email`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `WorkflowPreviewEmailDto`

| Name | Type | Description |
| --- | --- | --- |
| `recipients` (Required) | `array of string (email)` | List of recipient email addresses · `minItems`: `1`, `maxItems`: `5` |
| `subject` | `string` | Email subject line |
| `emailContent` | `array of object` | Email content in rich text format (Slate.js format) |
| `emailPreviewText` | `string` | Email preview text (preheader) |
| `name` | `string` | Name of the email template or campaign |
| `senderId` (Required) | `number` | ID of the email sender configuration · `minimum`: `1` |
| `templateId` | `number` | ID of the email template |
| `automationId` | `number` | ID of the automation workflow |

**Example request body**

`application/json`

```json
{
  "recipients": [
    "user@example.com",
    "test@example.com"
  ],
  "subject": "Welcome to our platform!",
  "emailContent": [
    {
      "type": "paragraph",
      "children": [
        {
          "text": "Thank you for joining us!"
        }
      ]
    }
  ],
  "emailPreviewText": "Get started with your account",
  "name": "Welcome Email Template",
  "senderId": 1,
  "templateId": 2,
  "automationId": 123
}
```

### Responses

#### 200

Test email sent successfully

#### 201

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, workflowTestRecipientsRequired

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"workflowTestRecipientsRequired"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

workflowSenderNotFound, visualWorkflowNotFound

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"workflowSenderNotFound"`, `"visualWorkflowNotFound"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "workflowSenderNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

#### 502

Content type: `application/json` · `ErrorResponse`

workflowTestEmailFailed

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"workflowTestEmailFailed"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "workflowTestEmailFailed",
  "message": "string",
  "errors": [
    {}
  ]
}
```

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}/test/email' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "recipients": [
    "user@example.com",
    "test@example.com"
  ],
  "subject": "Welcome to our platform!",
  "emailContent": [
    {
      "type": "paragraph",
      "children": [
        {
          "text": "Thank you for joining us!"
        }
      ]
    }
  ],
  "emailPreviewText": "Get started with your account",
  "name": "Welcome Email Template",
  "senderId": 1,
  "templateId": 2,
  "automationId": 123
}'
```

<a id="post-api-v1-automation-visual-workflows-id-test-sms"></a>
## Send a test SMS for a workflow node

`POST /api/v1/automation/visual-workflows/{id}/test/sms`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `id` (Required) | path | `number` |   |

### Request body

Content type: `application/json` · Required · `WorkflowPreviewSmsDto`

| Name | Type | Description |
| --- | --- | --- |
| `phoneNumbers` (Required) | `array of string` | List of recipient phone numbers in E.164 format · `minItems`: `1`, `maxItems`: `5` |
| `smsContent` | `string` | SMS message content |
| `name` | `string` | Name of the SMS template or campaign |
| `senderId` (Required) | `number` | ID of the SMS sender configuration · `minimum`: `1` |
| `automationId` | `number` | ID of the automation workflow |
| `consentId` | `number` | Consent the {{unsubscribeUrl}} token should unsubscribe from; the test renders a preview link for it · `minimum`: `1` |

**Example request body**

`application/json`

```json
{
  "phoneNumbers": [
    "<phoneNumbers>",
    "<phoneNumbers>"
  ],
  "smsContent": "Hello! This is a test message from your workflow.",
  "name": "Welcome SMS Template",
  "senderId": 1,
  "automationId": 123,
  "consentId": 4
}
```

### Responses

#### 200

Test SMS sent successfully

#### 201

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest, workflowTestPhoneNumbersRequired

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"`, `"workflowTestPhoneNumbersRequired"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 404

Content type: `application/json` · `ErrorResponse`

workflowSenderNotFound, visualWorkflowNotFound

Same fields as [Send a test email for a workflow node (404)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#post-api-v1-automation-visual-workflows-id-test-email).

**Example response**

`application/json`

```json
{
  "messageCode": "workflowSenderNotFound",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get all visual workflows (paginated) (403)](https://www.subrite.no/developers/workflow-engine-visual-workflows?md=true#get-api-v1-automation-visual-workflows).

#### 502

Content type: `application/json` · `ErrorResponse`

workflowTestSmsFailed

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"workflowTestSmsFailed"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "workflowTestSmsFailed",
  "message": "string",
  "errors": [
    {}
  ]
}
```

### Example request

```bash
curl 'https://api.subrite.no/api/v1/automation/visual-workflows/{id}/test/sms' \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "phoneNumbers": [
    "<phoneNumbers>",
    "<phoneNumbers>"
  ],
  "smsContent": "Hello! This is a test message from your workflow.",
  "name": "Welcome SMS Template",
  "senderId": 1,
  "automationId": 123,
  "consentId": 4
}'
```
