diff --git a/.changeset/workflow-definition-closing-reason-categories.md b/.changeset/workflow-definition-closing-reason-categories.md new file mode 100644 index 00000000..f19a1381 --- /dev/null +++ b/.changeset/workflow-definition-closing-reason-categories.md @@ -0,0 +1,7 @@ +--- +"@epilot/workflow-definition-client": minor +"@epilot/sdk": minor +"@epilot/cli": patch +--- + +Add closing reason categories to the Workflow Definition API: `getAllClosingReasonCategories`, `createClosingReasonCategory`, `getClosingReasonCategory`, `updateClosingReasonCategory` and `deleteClosingReasonCategory` (`/v1/workflows/closing-reason-categories`), plus `categoryId` and the read-only resolved `category` on `ClosingReason` diff --git a/clients/workflow-definition-client/src/openapi-runtime.json b/clients/workflow-definition-client/src/openapi-runtime.json index 3f0b35d6..5f585ace 100644 --- a/clients/workflow-definition-client/src/openapi-runtime.json +++ b/clients/workflow-definition-client/src/openapi-runtime.json @@ -283,6 +283,50 @@ "responses": {} } }, + "/v1/workflows/closing-reason-categories": { + "get": { + "operationId": "getAllClosingReasonCategories", + "responses": {} + }, + "post": { + "operationId": "createClosingReasonCategory", + "requestBody": { + "required": true, + "content": { + "application/json": {} + } + }, + "responses": {} + } + }, + "/v1/workflows/closing-reason-categories/{categoryId}": { + "parameters": [ + { + "in": "path", + "name": "categoryId", + "required": true, + "description": "unique id to identify the closing reason category." + } + ], + "get": { + "operationId": "getClosingReasonCategory", + "responses": {} + }, + "patch": { + "operationId": "updateClosingReasonCategory", + "requestBody": { + "required": true, + "content": { + "application/json": {} + } + }, + "responses": {} + }, + "delete": { + "operationId": "deleteClosingReasonCategory", + "responses": {} + } + }, "/v1/workflows/definitions/{definitionId}/closing-reasons": { "get": { "operationId": "getWorkflowClosingReasons", diff --git a/clients/workflow-definition-client/src/openapi.d.ts b/clients/workflow-definition-client/src/openapi.d.ts index ba90f83a..c5e097fe 100644 --- a/clients/workflow-definition-client/src/openapi.d.ts +++ b/clients/workflow-definition-client/src/openapi.d.ts @@ -358,9 +358,56 @@ declare namespace Components { id?: string; title?: string; status?: ClosingReasonsStatus; + /** + * Id of the category the reason is grouped under. Omit or send null for a reason without a category. + * example: + * c9wq81x + */ + categoryId?: string | null; + category?: /* The reason's category, resolved when a flow template is read. Ignored on writes. */ ClosingReasonCategoryRef; + lastUpdateTime?: string; + creationTime?: string; + } + export interface ClosingReasonCategories { + categories: /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ ClosingReasonCategory[]; + } + /** + * A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons + */ + export interface ClosingReasonCategory { + id?: string; + /** + * example: + * Wirtschaftlichkeit + */ + title?: string; lastUpdateTime?: string; creationTime?: string; } + /** + * Error response returned when a closing reason category is not found. + */ + export interface ClosingReasonCategoryNotFoundResp { + /** + * example: + * Closing reason category not found + */ + message?: string; + } + export interface ClosingReasonCategoryPayload { + /** + * example: + * Wirtschaftlichkeit + */ + title: string; + } + /** + * The reason's category, resolved when a flow template is read. Ignored on writes. + */ + export interface ClosingReasonCategoryRef { + id: string; + title: string; + } export interface ClosingReasonId { /** * example: @@ -2091,6 +2138,15 @@ declare namespace Paths { export type $201 = /* One Closing reason for a workflow */ Components.Schemas.ClosingReason; } } + namespace CreateClosingReasonCategory { + export type RequestBody = Components.Schemas.ClosingReasonCategoryPayload; + namespace Responses { + export type $201 = /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ Components.Schemas.ClosingReasonCategory; + export type $400 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $409 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + } + } namespace CreateDefinition { export type RequestBody = /** * V1 workflow definition schema. Defines a linear workflow structure with sections @@ -2166,6 +2222,14 @@ declare namespace Paths { export type $404 = /* Error response returned when a closing reason is not found. */ Components.Schemas.ClosingReasonNotFoundResp; } } + namespace DeleteClosingReasonCategory { + namespace Responses { + export interface $204 { + } + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $404 = /* Error response returned when a closing reason category is not found. */ Components.Schemas.ClosingReasonCategoryNotFoundResp; + } + } namespace DeleteDefinition { namespace Parameters { export type DefinitionId = string; @@ -2227,6 +2291,12 @@ declare namespace Paths { export type $500 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; } } + namespace GetAllClosingReasonCategories { + namespace Responses { + export type $200 = Components.Schemas.ClosingReasonCategories; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + } + } namespace GetAllClosingReasons { namespace Parameters { export type IncludeInactive = boolean; @@ -2260,6 +2330,13 @@ declare namespace Paths { export type $404 = /* Error response returned when a closing reason is not found. */ Components.Schemas.ClosingReasonNotFoundResp; } } + namespace GetClosingReasonCategory { + namespace Responses { + export type $200 = /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ Components.Schemas.ClosingReasonCategory; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $404 = /* Error response returned when a closing reason category is not found. */ Components.Schemas.ClosingReasonCategoryNotFoundResp; + } + } namespace GetClosingReasonV1 { namespace Parameters { export type ReasonId = string; @@ -2425,6 +2502,16 @@ declare namespace Paths { export type $404 = /* Error response returned when a closing reason is not found. */ Components.Schemas.ClosingReasonNotFoundResp; } } + namespace UpdateClosingReasonCategory { + export type RequestBody = Components.Schemas.ClosingReasonCategoryPayload; + namespace Responses { + export type $200 = /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ Components.Schemas.ClosingReasonCategory; + export type $400 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $404 = /* Error response returned when a closing reason category is not found. */ Components.Schemas.ClosingReasonCategoryNotFoundResp; + export type $409 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + } + } namespace UpdateDefinition { namespace Parameters { export type DefinitionId = string; @@ -2494,6 +2581,22 @@ declare namespace Paths { export type $500 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; } } + namespace V1WorkflowsClosingReasonCategories$CategoryId { + namespace Parameters { + /** + * example: + * c9wq81x + */ + export type CategoryId = string; + } + export interface PathParameters { + categoryId: /** + * example: + * c9wq81x + */ + Parameters.CategoryId; + } + } } @@ -2712,6 +2815,56 @@ export interface OperationMethods { data?: Paths.ChangeReasonStatus.RequestBody, config?: AxiosRequestConfig ): OperationResponse + /** + * getAllClosingReasonCategories - getAllClosingReasonCategories + * + * Get all closing reason categories defined in the organization. + */ + 'getAllClosingReasonCategories'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * createClosingReasonCategory - createClosingReasonCategory + * + * Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace. + */ + 'createClosingReasonCategory'( + parameters?: Parameters | null, + data?: Paths.CreateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + /** + * getClosingReasonCategory - getClosingReasonCategory + * + * Get a closing reason category by id. + */ + 'getClosingReasonCategory'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * updateClosingReasonCategory - updateClosingReasonCategory + * + * Rename a closing reason category. Running flows keep the title they started with. + */ + 'updateClosingReasonCategory'( + parameters?: Parameters | null, + data?: Paths.UpdateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + /** + * deleteClosingReasonCategory - deleteClosingReasonCategory + * + * Delete a closing reason category. Its reasons are kept and lose their category. + */ + 'deleteClosingReasonCategory'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse /** * getWorkflowClosingReasons - getWorkflowClosingReasons * @@ -2969,6 +3122,60 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/v1/workflows/closing-reason-categories']: { + /** + * getAllClosingReasonCategories - getAllClosingReasonCategories + * + * Get all closing reason categories defined in the organization. + */ + 'get'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * createClosingReasonCategory - createClosingReasonCategory + * + * Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace. + */ + 'post'( + parameters?: Parameters | null, + data?: Paths.CreateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + } + ['/v1/workflows/closing-reason-categories/{categoryId}']: { + /** + * getClosingReasonCategory - getClosingReasonCategory + * + * Get a closing reason category by id. + */ + 'get'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * updateClosingReasonCategory - updateClosingReasonCategory + * + * Rename a closing reason category. Running flows keep the title they started with. + */ + 'patch'( + parameters?: Parameters | null, + data?: Paths.UpdateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + /** + * deleteClosingReasonCategory - deleteClosingReasonCategory + * + * Delete a closing reason category. Its reasons are kept and lose their category. + */ + 'delete'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + } ['/v1/workflows/definitions/{definitionId}/closing-reasons']: { /** * getWorkflowClosingReasons - getWorkflowClosingReasons @@ -3012,6 +3219,11 @@ export type AutomationTask = Components.Schemas.AutomationTask; export type AutomationTrigger = Components.Schemas.AutomationTrigger; export type ChangeReasonStatusReq = Components.Schemas.ChangeReasonStatusReq; export type ClosingReason = Components.Schemas.ClosingReason; +export type ClosingReasonCategories = Components.Schemas.ClosingReasonCategories; +export type ClosingReasonCategory = Components.Schemas.ClosingReasonCategory; +export type ClosingReasonCategoryNotFoundResp = Components.Schemas.ClosingReasonCategoryNotFoundResp; +export type ClosingReasonCategoryPayload = Components.Schemas.ClosingReasonCategoryPayload; +export type ClosingReasonCategoryRef = Components.Schemas.ClosingReasonCategoryRef; export type ClosingReasonId = Components.Schemas.ClosingReasonId; export type ClosingReasonNotFoundResp = Components.Schemas.ClosingReasonNotFoundResp; export type ClosingReasons = Components.Schemas.ClosingReasons; diff --git a/clients/workflow-definition-client/src/openapi.json b/clients/workflow-definition-client/src/openapi.json index b7fc7fb5..f30c4a84 100644 --- a/clients/workflow-definition-client/src/openapi.json +++ b/clients/workflow-definition-client/src/openapi.json @@ -1667,6 +1667,255 @@ } } }, + "/v1/workflows/closing-reason-categories": { + "get": { + "operationId": "getAllClosingReasonCategories", + "summary": "getAllClosingReasonCategories", + "description": "Get all closing reason categories defined in the organization.", + "tags": [ + "Closing Reason" + ], + "responses": { + "200": { + "description": "Returns every closing reason category of the organization", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategories" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + } + } + }, + "post": { + "operationId": "createClosingReasonCategory", + "summary": "createClosingReasonCategory", + "description": "Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace.", + "tags": [ + "Closing Reason" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryPayload" + } + } + } + }, + "responses": { + "201": { + "description": "The category was created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + } + }, + "400": { + "description": "Validation Errors", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "409": { + "description": "A category with the same title already exists", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + } + } + } + }, + "/v1/workflows/closing-reason-categories/{categoryId}": { + "parameters": [ + { + "in": "path", + "name": "categoryId", + "schema": { + "type": "string", + "example": "c9wq81x" + }, + "required": true, + "description": "unique id to identify the closing reason category." + } + ], + "get": { + "operationId": "getClosingReasonCategory", + "summary": "getClosingReasonCategory", + "description": "Get a closing reason category by id.", + "tags": [ + "Closing Reason" + ], + "responses": { + "200": { + "description": "Returns the category", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "404": { + "description": "Category not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryNotFoundResp" + } + } + } + } + } + }, + "patch": { + "operationId": "updateClosingReasonCategory", + "summary": "updateClosingReasonCategory", + "description": "Rename a closing reason category. Running flows keep the title they started with.", + "tags": [ + "Closing Reason" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryPayload" + } + } + } + }, + "responses": { + "200": { + "description": "The category was updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + } + }, + "400": { + "description": "Validation Errors", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "404": { + "description": "Category not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryNotFoundResp" + } + } + } + }, + "409": { + "description": "Another category with the same title already exists", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteClosingReasonCategory", + "summary": "deleteClosingReasonCategory", + "description": "Delete a closing reason category. Its reasons are kept and lose their category.", + "tags": [ + "Closing Reason" + ], + "responses": { + "204": { + "description": "The category was deleted" + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "404": { + "description": "Category not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryNotFoundResp" + } + } + } + } + } + } + }, "/v1/workflows/definitions/{definitionId}/closing-reasons": { "get": { "operationId": "getWorkflowClosingReasons", @@ -4097,6 +4346,15 @@ "status": { "$ref": "#/components/schemas/ClosingReasonsStatus" }, + "categoryId": { + "type": "string", + "nullable": true, + "description": "Id of the category the reason is grouped under. Omit or send null for a reason without a category.", + "example": "c9wq81x" + }, + "category": { + "$ref": "#/components/schemas/ClosingReasonCategoryRef" + }, "lastUpdateTime": { "type": "string", "readOnly": true @@ -4107,6 +4365,82 @@ } } }, + "ClosingReasonCategoryRef": { + "type": "object", + "readOnly": true, + "description": "The reason's category, resolved when a flow template is read. Ignored on writes.", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": [ + "id", + "title" + ] + }, + "ClosingReasonCategories": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + }, + "required": [ + "categories" + ] + }, + "ClosingReasonCategory": { + "type": "object", + "description": "A category that groups closing reasons, e.g. \"Wirtschaftlichkeit\" for several economic reasons", + "properties": { + "id": { + "type": "string", + "readOnly": true + }, + "title": { + "type": "string", + "example": "Wirtschaftlichkeit" + }, + "lastUpdateTime": { + "type": "string", + "readOnly": true + }, + "creationTime": { + "type": "string", + "readOnly": true + } + } + }, + "ClosingReasonCategoryPayload": { + "type": "object", + "properties": { + "title": { + "type": "string", + "minLength": 1, + "example": "Wirtschaftlichkeit" + } + }, + "required": [ + "title" + ] + }, + "ClosingReasonCategoryNotFoundResp": { + "type": "object", + "description": "Error response returned when a closing reason category is not found.", + "properties": { + "message": { + "type": "string", + "example": "Closing reason category not found" + } + } + }, "ClosingReasonsStatus": { "type": "string", "enum": [ diff --git a/packages/cli/definitions/workflow-definition.json b/packages/cli/definitions/workflow-definition.json index d1a16b39..f30c4a84 100644 --- a/packages/cli/definitions/workflow-definition.json +++ b/packages/cli/definitions/workflow-definition.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Workflows Definitions", - "version": "1.1.0", + "version": "1.3.1", "description": "The Workflows Definitions API enables you to create, manage, and configure reusable workflow templates\nwithin your organization. Workflow definitions serve as blueprints that define the structure and behavior\nof business processes, which can then be instantiated as workflow executions.\n\n## Core Concepts\n\n### Workflow Definition (V1)\nA workflow definition is a template that describes a business process. It consists of:\n- **Sections**: Logical groupings (phases) that organize related steps together\n- **Steps**: Individual tasks or actions that need to be completed within a section\n- **Closing Reasons**: Predefined reasons that can be selected when closing/completing a workflow\n\n### Flow Template (V2)\nThe modern workflow model that provides advanced capabilities:\n- **Phases**: Named stages that group related tasks and track progress through the workflow\n- **Tasks**: Individual units of work that can be manual, automated, AI-powered, or decision points\n- **Edges**: Connections between tasks that define the flow sequence and support conditional branching\n- **Triggers**: Define how a workflow is started (manual, automation, journey submission)\n\n### Task Types (V2)\n- **MANUAL**: Tasks assigned to users that require human action to complete\n- **AUTOMATION**: Tasks that execute automated actions when reached\n- **DECISION**: Conditional branching points that evaluate conditions to determine the next path\n- **AI_AGENT**: Tasks that invoke AI agents to perform intelligent actions\n\n## API Versions\n- **V1 endpoints** (`/v1/workflows/...`): Legacy linear workflow model with sections and steps\n- **V2 endpoints** (`/v2/flows/...`): Modern graph-based flow model with phases, tasks, and edges\n" }, "servers": [ @@ -163,7 +163,7 @@ "post": { "operationId": "createDefinition", "summary": "createDefinition", - "description": "Create a new V1 workflow definition. The definition consists of sections and steps\nthat define the structure of the workflow. Once created, the definition can be used\nto start workflow executions.\n", + "description": "Create a new V1 workflow definition. The definition consists of sections and steps\nthat define the structure of the workflow. Once created, the definition can be used\nto start workflow executions.\n\nDeprecated: from 17 October 2026 00:00 Europe/Berlin this endpoint answers 409 —\ncreate a flow via `POST /v2/flows/templates` instead.\n", "tags": [ "Workflows" ], @@ -317,6 +317,19 @@ } } }, + "409": { + "description": "Workflow creation is closed — from 17 October 2026 00:00 Europe/Berlin\n(16 October being the last day) no new V1 workflow definitions are\naccepted. Create a flow via `POST /v2/flows/templates` instead;\nexisting workflow definitions stay readable, updatable and executable.\nBlueprint installs and other internal epilot services (which reach\nthis operation through a direct Lambda invocation) are exempt, so\nblueprints captured before the cutoff keep installing.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + }, + "example": { + "message": "Workflows can no longer be created. Create a flow instead: POST /v2/flows/templates. Existing workflows stay editable." + } + } + } + }, "500": { "description": "Other errors", "content": { @@ -408,6 +421,9 @@ "parameters": [ { "$ref": "#/components/parameters/EnforceLimitsParam" + }, + { + "$ref": "#/components/parameters/ClientSupportsAdvLoopsParam" } ], "requestBody": { @@ -611,6 +627,9 @@ }, "required": true, "description": "Unique identifier of the flow template to retrieve." + }, + { + "$ref": "#/components/parameters/SkipHealParam" } ], "responses": { @@ -685,6 +704,9 @@ }, { "$ref": "#/components/parameters/EnforceLimitsParam" + }, + { + "$ref": "#/components/parameters/ClientSupportsAdvLoopsParam" } ], "requestBody": { @@ -1645,6 +1667,255 @@ } } }, + "/v1/workflows/closing-reason-categories": { + "get": { + "operationId": "getAllClosingReasonCategories", + "summary": "getAllClosingReasonCategories", + "description": "Get all closing reason categories defined in the organization.", + "tags": [ + "Closing Reason" + ], + "responses": { + "200": { + "description": "Returns every closing reason category of the organization", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategories" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + } + } + }, + "post": { + "operationId": "createClosingReasonCategory", + "summary": "createClosingReasonCategory", + "description": "Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace.", + "tags": [ + "Closing Reason" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryPayload" + } + } + } + }, + "responses": { + "201": { + "description": "The category was created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + } + }, + "400": { + "description": "Validation Errors", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "409": { + "description": "A category with the same title already exists", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + } + } + } + }, + "/v1/workflows/closing-reason-categories/{categoryId}": { + "parameters": [ + { + "in": "path", + "name": "categoryId", + "schema": { + "type": "string", + "example": "c9wq81x" + }, + "required": true, + "description": "unique id to identify the closing reason category." + } + ], + "get": { + "operationId": "getClosingReasonCategory", + "summary": "getClosingReasonCategory", + "description": "Get a closing reason category by id.", + "tags": [ + "Closing Reason" + ], + "responses": { + "200": { + "description": "Returns the category", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "404": { + "description": "Category not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryNotFoundResp" + } + } + } + } + } + }, + "patch": { + "operationId": "updateClosingReasonCategory", + "summary": "updateClosingReasonCategory", + "description": "Rename a closing reason category. Running flows keep the title they started with.", + "tags": [ + "Closing Reason" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryPayload" + } + } + } + }, + "responses": { + "200": { + "description": "The category was updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + } + }, + "400": { + "description": "Validation Errors", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "404": { + "description": "Category not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryNotFoundResp" + } + } + } + }, + "409": { + "description": "Another category with the same title already exists", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteClosingReasonCategory", + "summary": "deleteClosingReasonCategory", + "description": "Delete a closing reason category. Its reasons are kept and lose their category.", + "tags": [ + "Closing Reason" + ], + "responses": { + "204": { + "description": "The category was deleted" + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResp" + } + } + } + }, + "404": { + "description": "Category not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClosingReasonCategoryNotFoundResp" + } + } + } + } + } + } + }, "/v1/workflows/definitions/{definitionId}/closing-reasons": { "get": { "operationId": "getWorkflowClosingReasons", @@ -1718,6 +1989,16 @@ }, "components": { "parameters": { + "ClientSupportsAdvLoopsParam": { + "in": "query", + "name": "client_supports_adv_loops", + "required": false, + "schema": { + "type": "boolean", + "default": false + }, + "description": "When true, the client writes `loops` on decision tasks and `loop_id` on loop back edges, and invalid ones are rejected. When false or absent, the server rebuilds both from `loop_config`." + }, "EnforceLimitsParam": { "in": "query", "name": "enforce_limits", @@ -1727,6 +2008,16 @@ "default": false }, "description": "When true, size/count limit violations (max incoming edges per task, max branches, max entity-sync rules, ...) are enforced as 400 errors. Used by the flow-builder UI for interactive authoring. On update, pre-existing violations are tolerated as long as the request does not worsen them. When false or absent (default for API/system callers such as blueprints, configuration hub and snapshots), limit violations are accepted and returned as `limit_warnings`. Structural errors are always enforced regardless of this flag." + }, + "SkipHealParam": { + "in": "query", + "name": "skip_heal", + "required": false, + "schema": { + "type": "boolean", + "default": false + }, + "description": "When true, the template is not healed and nothing is written back. The response is otherwise the same as without it." } }, "securitySchemes": { @@ -1764,6 +2055,20 @@ "description": "Optional detailed description of the workflow's purpose and behavior.", "maxLength": 5000 }, + "portal_titles": { + "type": "object", + "description": "Portal-facing overrides of the flow name. Portal surfaces (the End Customer and Installer portals, and the builder's portal views) show the matching override instead of `name`; an absent key falls back to `name`. Has no effect on execution behaviour.", + "properties": { + "ecp": { + "type": "string", + "description": "Flow title shown to end customers." + }, + "installer": { + "type": "string", + "description": "Flow title shown to installers." + } + } + }, "trigger": { "$ref": "#/components/schemas/Trigger" }, @@ -1811,7 +2116,7 @@ }, "additional_triggers": { "type": "array", - "description": "Additional trigger configurations that can also start this flow. Useful for flows that should be startable via multiple methods (e.g., both automation AND manual).", + "description": "Additional trigger configurations that can also start this flow.\nUseful for flows that should be startable via multiple methods\n(e.g., both automation AND manual). Each additional trigger may\ntarget its own entity and may carry its own entry edge (an edge\nwhose `from_id` is the trigger's `id`); without an entry edge of\nits own it starts the flow at the primary entry. Triggers must be\ncomplementary — no two triggers on a flow may cover the same\nentity and event.\n", "items": { "$ref": "#/components/schemas/Trigger" } @@ -1822,6 +2127,13 @@ "$ref": "#/components/schemas/Phase" } }, + "stages": { + "type": "array", + "description": "Customer-facing progress segments layered on top of the flow graph. Stages are strictly ordered boundaries: the first is anchored at the trigger, every later one is an edge cut (or a legacy entry-node anchor whose in-edges form the cut). The array order is the boundary order and must match the graph. Per-node stage membership is always computed from the graph, never stored, and a run may end in any stage.", + "items": { + "$ref": "#/components/schemas/Stage" + } + }, "tasks": { "type": "array", "items": { @@ -1868,18 +2180,36 @@ "type": "boolean", "description": "When true, this is a linear flow: task enablement is computed at runtime from the graph — a task is enabled only when all of its direct predecessor tasks in its branch are done. This fully overrides any explicit per-task requirements." }, + "context_settings": { + "$ref": "#/components/schemas/FlowContextSettings" + }, "limit_warnings": { "type": "array", "description": "Non-blocking warnings for configuration limits the flow exceeds. Returned on read (get-flow) and on create/update responses. Size/count limits are soft: a flow exceeding them is still accepted and stored, and the violations are reported here so the UI can surface an informational banner. The flow is still fully editable and usable.", "items": { "$ref": "#/components/schemas/FlowLimitWarning" } - } - } - }, - "FlowLimitWarning": { - "type": "object", - "description": "A configuration limit that the flow currently exceeds. Returned by the get-flow endpoint and by create/update responses so the UI can show a non-blocking banner. Size/count limit violations never cause a 400 — only structural errors do. The flow remains fully usable; users are encouraged to bring values within the limits.", + }, + "structural_warnings": { + "type": "array", + "description": "Non-blocking warnings about the flow's structure. Returned on read (get-flow) and on create/update responses, whether or not the client sends `client_supports_adv_loops`. A flow with structural warnings is still accepted and stored; the warnings are reported here so the UI can point the user at the part of the flow to fix. Ignored on write and never stored.", + "items": { + "$ref": "#/components/schemas/FlowStructuralWarning" + } + }, + "keep_task_automations_in_sync": { + "type": "boolean", + "description": "Persisted preference for how the flow's task automations relate to the flow's `enabled` state. When `true`, task automations always mirror the flow: their enabled state is re-synced on every update and new task automations are created with the flow's current enabled state. When `false`, task automations are managed independently: updates never change their enabled state and new task automations are always created enabled, so a flow that is built or edited while disabled does not accumulate automations that stay off after the flow is re-enabled. When unset, legacy behavior applies: new task automations inherit the flow's enabled state and updates leave existing ones untouched. Safety: on updates that do NOT change `enabled`, the in-sync mode never re-enables automations that were disabled by the system (e.g. infinite-loop protection) — only a deliberate `enabled` flip on the flow re-arms those." + }, + "protected": { + "type": "boolean", + "description": "If true, the flow is displayed in read-only mode in the UI" + } + } + }, + "FlowLimitWarning": { + "type": "object", + "description": "A configuration limit that the flow currently exceeds. Returned by the get-flow endpoint and by create/update responses so the UI can show a non-blocking banner. Size/count limit violations never cause a 400 — only structural errors do. The flow remains fully usable; users are encouraged to bring values within the limits.", "required": [ "i18nKey", "message", @@ -1924,6 +2254,38 @@ } } }, + "FlowStructuralWarning": { + "type": "object", + "description": "A structural problem the flow has that does not block a save. Returned by the get-flow endpoint and by create/update responses. Today the only one is errors.loop_id_after_exit: a loop connection can be reached from its loop's exit branch, so leaving the loop leads back into it.", + "required": [ + "i18nKey", + "message", + "path" + ], + "properties": { + "i18nKey": { + "type": "string", + "description": "i18n key identifying the warning (e.g. errors.loop_id_after_exit)." + }, + "message": { + "type": "string", + "description": "Human-readable description of the warning." + }, + "node_id": { + "type": "string", + "description": "ID of the task or phase the warning points at, when applicable." + }, + "edge_id": { + "type": "string", + "description": "ID of the edge the warning points at, when applicable." + }, + "path": { + "type": "array", + "items": {}, + "description": "JSON path within the flow to the offending element." + } + } + }, "FlowTemplate": { "allOf": [ { @@ -2041,6 +2403,10 @@ "additionalProperties": true }, "description": "Transient field. Trigger configurations for creating or updating the trigger automation flow. Each item follows the automation API trigger schema. Processed by the backend during create/update and stripped before storage.\n" + }, + "duplicated_automation_id": { + "type": "string", + "description": "Transient field. Sent together with trigger_config on a trigger that has no automation yet: the backend creates the trigger's automation as a copy of the automation with this id (its trigger conditions, action conditions, schedules and trigger-workflow configuration), pointed at this flow, stamped with this trigger's id and with its triggers taken from trigger_config. When that automation no longer exists or is not a workflow trigger automation, a new automation is created from trigger_config. Ignored without trigger_config or when the trigger already has an automation. Used when flows are merged into a new flow. Stripped before storage.\n" } } }, @@ -2150,7 +2516,10 @@ "type": "string", "enum": [ "created_at", - "updated_at" + "updated_at", + "name", + "enabled", + "id" ], "default": "updated_at" }, @@ -2220,8 +2589,17 @@ "automation_config": { "$ref": "#/components/schemas/AutomationConfig" }, + "on_failure": { + "$ref": "#/components/schemas/AutomationFailurePolicy" + }, "trigger_mode": { - "$ref": "#/components/schemas/TriggerMode" + "$ref": "#/components/schemas/TriggerMode", + "allOf": [ + { + "$ref": "#/components/schemas/TriggerMode" + } + ], + "description": "How the automation is started. `automatic` runs it as soon as the task becomes current; `manual` waits for a person to run it. An absent value is read as `manual` everywhere: the engine dispatches only an explicit `automatic`, the builder shows the task as manual, and the task may carry the skip gate and required subtasks." }, "schedule": { "$ref": "#/components/schemas/ActionSchedule" @@ -2235,6 +2613,15 @@ } ] }, + "AutomationFailurePolicy": { + "type": "string", + "enum": [ + "stop", + "continue" + ], + "default": "stop", + "description": "What the flow does when this automation ends in a failed state. `stop` waits on the failed task until it is retried or skipped. `continue` proceeds to the next task. An absent value means `stop`." + }, "AutomationConfig": { "type": "object", "description": "Configuration for automation execution to run", @@ -2264,16 +2651,50 @@ }, "duplicated_flow_id": { "type": "string", - "description": "Transient field. When present, the backend clones the automation flow referenced by this ID and assigns the new flow_id to the task. Used when duplicating an automation task to give it an independent automation. Stripped before storage.\n" + "description": "Transient field. When present, the backend clones the automation flow referenced by this ID and assigns the new flow_id to the task. Used when duplicating an automation task to give it an independent automation. When the referenced automation is not one the stored flow already uses (always the case on create, e.g. tasks copied from flows merged into a new flow), the clone is born like a new task automation of this flow (see keep_task_automations_in_sync) and without the source's disable_details, blueprint membership (_manifest), protection or run count; a copy within the flow keeps the source's state. Stripped before storage.\n" }, "input_context": { "$ref": "#/components/schemas/AutomationInputContext" + }, + "output_context": { + "$ref": "#/components/schemas/AutomationOutputContext" + }, + "eligible_closing_reason_ids": { + "type": "array", + "description": "The closing reasons a person may choose from when running this task, making a `cancel-flow-execution` automation semi-automated: the step is configured here, the reason is picked at execution time. Every id must also appear in the flow template's `closing_reasons` — the step narrows the flow's vocabulary rather than introducing its own, which is what keeps the chosen reason a member of the execution's `configured_reasons` and what lets blueprints export the reasons a step depends on. Only a task whose `trigger_mode` is `manual` or absent can carry it; the template healer clears it from an `automatic` task, which has no assignee moment to choose in. Empty or absent means the automation runs with the reasons fixed in its own action config.", + "items": { + "type": "string" + } + }, + "email_review": { + "$ref": "#/components/schemas/EmailReviewConfig" + }, + "allow_execution_note": { + "type": "boolean", + "description": "Whether the person running a semi-automated cancel step may add a free-text note alongside the reason they choose. Only meaningful with `eligible_closing_reason_ids`, since the note is written in the same prompt; the template healer clears it from a step that asks nothing." + } + } + }, + "EmailReviewConfig": { + "type": "object", + "description": "Whether the person running a semi-automated send-email step may adjust the email before it goes out, and what they may adjust. Meaningful only on a task a person triggers — the engine's own dispatch has nobody to review — so the template healer clears it from an `automatic` task. With `enabled` false the email is sent exactly as configured and the person only triggers it.", + "properties": { + "enabled": { + "type": "boolean" + }, + "allow_document_selection": { + "type": "boolean", + "description": "The assignee may attach documents from the task's entity at execution, in addition to whatever the configured rules match." + }, + "allow_subject_and_body_edit": { + "type": "boolean", + "description": "The assignee may rewrite the rendered subject and body. They edit the rendered text, not the template, so the template is unchanged and other flows using it are unaffected." } } }, "AutomationInputContext": { "type": "object", - "description": "Optional. Source of the entity fed into this automation task. If omitted, the workflow's primary entity is used.\n", + "description": "Optional. Source of the entity fed into this automation task. If omitted, the run's current main context is used.\n", "required": [ "source" ], @@ -2281,14 +2702,209 @@ "source": { "type": "string", "enum": [ - "trigger", - "task" + "main_context", + "task", + "trigger" ], - "description": "`trigger` = workflow's primary (trigger) entity. `task` = entity produced by an upstream task in the graph.\n" + "description": "`main_context` = the run's current main context (same as omitting `input_context`). It moves when a task promotes its output to main context. `task` = entity produced by an upstream task in the graph. `trigger` with `trigger_id` = that configured trigger's entity. The Flow Builder offers it while the task is in that one trigger's own sub-flow, before it merges with another trigger's path. Without `trigger_id` it is legacy and resolves like `main_context`.\n" }, "task_id": { "type": "string", "description": "Required when source is `task`. The id of the upstream task whose output entity should feed this task." + }, + "trigger_id": { + "type": "string", + "description": "Only read when source is `trigger`. Pins the input to one specific configured trigger (primary or additional) by its id. When absent, the input resolves like `main_context`.\n" + }, + "with_relations": { + "type": "boolean", + "description": "Whether the input entity brings its direct relations along. Every action honours it. When neither `with_relations` nor `also_pass` is set, the automation receives the legacy payload, unchanged.\n" + }, + "also_pass": { + "type": "array", + "description": "Extra entities passed to the automation alongside the input entity, combined into one list (in order, de-duplicated, without the input entity itself). When neither `with_relations` nor `also_pass` is set, the automation receives the legacy payload, unchanged. Only the start-workflow (trigger-workflow) action uses it in this version.\n", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/AutomationInputExtraContextRef" + }, + { + "$ref": "#/components/schemas/AutomationInputExtraTaskRef" + } + ] + } + } + } + }, + "AutomationInputExtraContextRef": { + "type": "object", + "description": "One of the run's own entities. `main_context` = the run's current main context.\n", + "required": [ + "source" + ], + "properties": { + "source": { + "type": "string", + "enum": [ + "main_context" + ] + } + } + }, + "AutomationInputExtraTaskRef": { + "type": "object", + "description": "Every entity produced by an upstream task.", + "required": [ + "source", + "task_id" + ], + "properties": { + "source": { + "type": "string", + "enum": [ + "task" + ] + }, + "task_id": { + "type": "string", + "description": "The id of the upstream task whose output entities are passed along." + } + } + }, + "FlowContextSettings": { + "type": "object", + "description": "Where a flow runs, and where people see it.\nA run is ALWAYS visible on the entities it runs on — the entity its trigger supplied and every context it picks up. That is not configurable: it is what running there means, and hiding a run from its own entity is what `visibility: background` is for.\n`displays` lists ADDITIONAL entity kinds, reached by relation. It is written once and holds for every trigger: which entry point started a run says how it began, not who the process concerns. A flow that finance must see on the Account must be seen there whether it started from a web form or an inbound email.\n", + "properties": { + "visibility": { + "type": "string", + "enum": [ + "entity_views", + "background" + ], + "default": "entity_views", + "description": "`entity_views` — the flow appears on entity pages, table views and the portal, as decided by `displays`.\n`background` — the flow is hidden from every entity view. It runs and records exactly the same way; only the surfaces are suppressed.\n" + }, + "main_context": { + "$ref": "#/components/schemas/MainContextSetting" + }, + "displays": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FlowDisplayRule" + }, + "description": "Additional entity kinds this flow is visible on, beyond the entities it runs on. Empty or absent means it is seen only where it runs.\nORDERED. An entry may anchor (`from`) only on the main context or on an EARLIER entry. That ordering is what makes a cycle (contact anchored on account anchored on contact) unrepresentable rather than something to detect at runtime.\n" + } + } + }, + "MainContextSetting": { + "type": "object", + "description": "Which of a flow's contexts owns the run: the entity conditions, automations and entity sync resolve against by default.\nABSENT means the default — the primary trigger's entity. A flow has ONE main context, not one per trigger (STABLE360-13503): a run started by another trigger resolves the default among the starting entity's relations, first match, falling back to the starting entity — exactly as a configured schema would be. Setting it explicitly is for when the primary trigger's entity is not the one the flow is about.\nThis decides the STARTING main context only. A task with `output_context.set_as_primary` still moves it mid-run; the setting seeds the run and the graph moves it from there.\n", + "required": [ + "schema" + ], + "properties": { + "schema": { + "type": "string", + "description": "Entity schema of the main context. It need not be a schema any trigger provides: a run started on another context resolves it from that entity's relations." + }, + "relation_labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional narrowing for that resolution. A run started on a context of another schema looks through the starting entity's relations for one of `schema`; these `_tags` narrow which relations count, for when schema alone is ambiguous.\nSeveral matches: the FIRST is taken. Unlike an attaching display rule — which attaches nothing when several match, since binding an arbitrary entity as a surface has no justification — a run needs a primary to function at all, so a deterministic pick beats none.\nNo match: the run starts with the entity it was started on as primary, and records that the configured main context did not resolve. A manual start is never blocked because a relation happens to be missing.\n" + } + } + }, + "FlowDisplayRule": { + "type": "object", + "description": "One additional entity kind the flow should be visible on, found by relation from the main context or from an earlier entry.\nAn entity reached this way has no context of its own: it shows the main context's run, and acting on it acts on the main context. Nothing is copied and no second run starts.\nThere is no `enabled` flag and no entry for an entity the flow already runs on. An entry exists because someone wants the flow seen there; remove it to stop. Whether an entity is a context at all is decided by the trigger, by a task's `output_context`, or by `attach_to_contexts` below — never by a display setting.\n", + "required": [ + "id", + "entity_schema" + ], + "properties": { + "id": { + "type": "string" + }, + "entity_schema": { + "type": "string", + "description": "The schema of the entity this rule is about." + }, + "from": { + "$ref": "#/components/schemas/FlowRuleAnchor" + }, + "relation_labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Relation `_tags` to match (`family:label` form supported). Absent or empty matches every relation of `entity_schema`.\n" + }, + "attach_to_contexts": { + "type": "boolean", + "default": false, + "description": "Governs CONTEXT. When true the matched entity is added to the run's contexts, so later rules can anchor on it and conditions, entity sync and task automations can address it. Resolved by the ENGINE — at start and whenever the contexts change — never as a side effect of rendering, which would make a run's context set depend on who opened which page.\nA context must resolve to one entity: when several match, none is attached. Display is unaffected and still shows all of them.\n" + } + } + }, + "FlowRuleAnchor": { + "description": "Where an entry starts looking. Absent means `main_context`.\nA ROLE, not a schema: an entry anchored on `main_context` follows the primary when a task promotes another entity, where naming a schema would freeze it on the old one.\n", + "oneOf": [ + { + "$ref": "#/components/schemas/MainContextAnchor" + }, + { + "$ref": "#/components/schemas/RuleAnchor" + } + ] + }, + "MainContextAnchor": { + "type": "object", + "description": "The run's primary context, whatever it currently is.", + "required": [ + "role" + ], + "properties": { + "role": { + "type": "string", + "enum": [ + "main_context" + ] + } + } + }, + "RuleAnchor": { + "type": "object", + "description": "An earlier entry in `displays`, by its id: this entry searches from whatever that one matched. Chaining ticket -> contact -> account this way keeps both hops DISPLAY-only; making the contact a real context first is a separate decision (`attach_to_contexts`), not a prerequisite for reaching the account.\n", + "required": [ + "role", + "rule_id" + ], + "properties": { + "role": { + "type": "string", + "enum": [ + "rule" + ] + }, + "rule_id": { + "type": "string", + "description": "Id of an entry that appears earlier in `displays`." + } + } + }, + "AutomationOutputContext": { + "type": "object", + "description": "Optional. What happens to the entity produced by this automation task (the last successful entity-producing action of its automation).\n", + "properties": { + "set_as_primary": { + "type": "boolean", + "description": "When true, the entity this task's automation produces becomes the run's primary context (\"main context\") when the task completes. Downstream tasks and decisions configured with the default input context then act on that entity. When the task is reverted or reset, the previous primary context is restored.\n" + }, + "attach_to_contexts": { + "type": "boolean", + "description": "When true, the entity this task's automation produces is added to the run's contexts without becoming the main one. `set_as_primary` implies this: an entity cannot be the primary context without being a context. Contexts are unique by entity id, so a task that re-produces an entity already on the run adds nothing.\n" } } }, @@ -2302,6 +2918,17 @@ "properties": { "agent_config": { "$ref": "#/components/schemas/AgentConfig" + }, + "input_context": { + "$ref": "#/components/schemas/AutomationInputContext" + }, + "trigger_mode": { + "allOf": [ + { + "$ref": "#/components/schemas/TriggerMode" + } + ], + "description": "How the agent run is started. `automatic` starts it as soon as the task becomes current; `manual` waits for a person to run it and to approve the result. An absent value is read as `manual` everywhere: the engine dispatches only an explicit `automatic`, the builder shows the task as manual, and the task may carry the skip gate and required subtasks." } } } @@ -2453,8 +3080,7 @@ }, "allow_parallel_execution": { "type": "boolean", - "description": "When true, all branches with met conditions execute in parallel. When false, only the first branch with a met condition is executed. Defaults to true for backwards compatibility.", - "default": true + "description": "When true, all branches with met conditions execute in parallel. When false, only the first branch with a met condition is executed. The default depends on the trigger mode: automatic decisions treat an absent field as true (backwards compatibility), while manual decisions require an explicit true before multiple branches can be selected at execution time (absent = single-select)." }, "schedule": { "anyOf": [ @@ -2466,8 +3092,17 @@ } ] }, + "loops": { + "type": "object", + "description": "The loops this decision owns, keyed by loop id. A loop id is unique in the template. A decision owns at most one loop.", + "additionalProperties": { + "$ref": "#/components/schemas/LoopDefinition" + } + }, "loop_config": { "type": "object", + "deprecated": true, + "description": "Superseded by `loops`.", "properties": { "loop_branch_id": { "type": "string", @@ -2498,6 +3133,43 @@ } ] }, + "LoopDefinition": { + "type": "object", + "properties": { + "entry_branch_ids": { + "type": "array", + "description": "The decision's branches that enter the loop. The first is the `loop_config` loop branch, the others follow in condition order.", + "minItems": 1, + "items": { + "type": "string" + } + }, + "exit_branch_id": { + "type": "string", + "description": "The decision's branch that exits the loop." + }, + "max_iterations": { + "type": "integer", + "description": "Maximum number of iterations of the loop.", + "minimum": 1 + } + }, + "required": [ + "entry_branch_ids", + "exit_branch_id", + "max_iterations" + ] + }, + "TaskAudience": { + "type": "string", + "description": "A task audience, named after the task field holding its description: co-workers (description), end customers (ecp), installers and partners.", + "enum": [ + "description", + "ecp", + "installer", + "partner" + ] + }, "TaskBase": { "type": "object", "properties": { @@ -2520,6 +3192,14 @@ "due_date_config": { "$ref": "#/components/schemas/DueDateConfig" }, + "start_date": { + "type": "string", + "example": "2021-04-27T12:00:00.000Z", + "description": "Fixed start date of the task (AL-3678): an ISO 8601 instant with an offset or `Z`. Until it is reached the running task is upcoming — visible, but no person may work on it. Only a manual task, an automation a person runs and a manual decision may carry either start date field; a template that sets one on any other kind is refused. A task with a delayed or relative schedule may carry neither: its timer runs it whatever the start date. `start_date_config` wins over it when both are set." + }, + "start_date_config": { + "$ref": "#/components/schemas/StartDateConfig" + }, "requirements": { "type": "array", "description": "requirements that need to be fulfilled in order to enable the task while flow instances are running", @@ -2527,6 +3207,22 @@ "$ref": "#/components/schemas/EnableRequirement" } }, + "required": { + "type": "boolean", + "default": false, + "description": "When true, the task is required and users cannot skip it while the flow is running. Unrelated to `requirements`, which gate when a task becomes enabled. System-driven skips are unaffected — tasks on a not-taken decision branch, and automation tasks whose automation execution itself reports a skipped verdict (e.g. unmet trigger conditions). Only a manual task, or an automation or AI task whose `trigger_mode` is `manual` or absent, can carry it: on a decision or an automatic kind it is normalised to false on create, update and load." + }, + "only_assignee_can_complete": { + "type": "boolean", + "description": "When true, only the task's assignees may change its status while the flow is running, or choose its branch on a manual decision: a user named in `assigned_to`, a member of a group or partner organisation named there, or a user a variable assignment resolves to. Everyone else, org admins included, can see and reassign the task but not change its status. A task left without an assignee keeps its status until someone is assigned. Only a manual task or a decision with `trigger_mode: manual` can carry it: a create or update that sets it on any other kind, or on a scheduled manual task, is rejected." + }, + "subtasks": { + "type": "array", + "description": "Checklist items from the task's party descriptions, derived by the server from the checklist markup (`ul[__lexicallisttype=\"check\"] > li[data-subtask-id]`, nearest list ancestor) on every create, update and load — a client-supplied array is replaced. Parties are read in the order description, ecp, installer, partner and the first occurrence of an id wins; an id occurring twice in one task is rejected. An item is required only when it is marked `data-subtask-required=\"true\"` in the markup, the task kind has a person action (a manual task, a decision with `trigger_mode: manual`, or an automation or AI task whose `trigger_mode` is `manual` or absent) and it lives in the co-worker or partner description. Required items gate task completion while the flow is running.", + "items": { + "$ref": "#/components/schemas/Subtask" + } + }, "assigned_to": { "type": "array", "items": { @@ -2550,6 +3246,15 @@ "$ref": "#/components/schemas/PartnerDetails", "description": "Partner-specific task details shown to partner org users viewing shared resources" }, + "audience_order": { + "type": "array", + "description": "Order of the task's audience description tabs in the builder and during execution; the first tab shown opens by default. Keys not listed follow in the default order description, ecp, installer, partner, and audiences that are not enabled are skipped.", + "uniqueItems": true, + "maxItems": 4, + "items": { + "$ref": "#/components/schemas/TaskAudience" + } + }, "taxonomies": { "type": "array", "items": { @@ -2612,16 +3317,81 @@ "name" ] }, - "VariableAssignment": { + "Stage": { "type": "object", - "description": "Represents a variable assignment with its expression and optional resolved value. Used for dynamic user assignments that get resolved during workflow execution.", + "description": "A customer-facing progress segment layered on top of the flow graph. Unlike phases (internal task grouping), stages exist to communicate progress to outside users (e.g. end customers) with a title and description. Stages form a strict total order; the array order is the boundary order and must match the graph. The first stage's entry node is always the trigger node.", "properties": { - "variable": { + "id": { "type": "string", - "description": "The variable expression, e.g., \"{{entity.owner}}\"", - "example": "{{entity.owner}}" + "description": "Stable unique identifier for the stage." }, - "value": { + "name": { + "type": "string", + "description": "User-facing stage title." + }, + "description": { + "type": "string", + "description": "Customer-facing description of what happens in this stage." + }, + "entry_node_id": { + "type": "string", + "description": "Id of the graph node (task, phase, or the trigger sentinel) at which this stage begins; its incoming edges form the stage boundary, so no path may reach the node's successors without passing it. The first stage's entry_node_id is the trigger sentinel. Exactly one of entry_node_id / cut_edge_ids per stage; when both are present, cut_edge_ids wins." + }, + "cut_edge_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Edge-cut boundary, for stages that begin inside branching regions: the stage begins where these edges are crossed — one cut edge per branch that continues past the boundary, so that no path crosses it twice and none bypasses it. Branches that end before the boundary need no cut; a run may end in any stage. Cut edges may not be loop edges, end edges, or phase-internal edges. Node membership is derived by counting crossed boundaries, never stored." + }, + "color": { + "type": "string", + "description": "Optional stage accent color, a key from a fixed palette." + }, + "portal_names": { + "type": "object", + "description": "Portal-facing overrides of the stage name. Portal surfaces show the matching override instead of `name`; an absent key falls back to `name`.", + "properties": { + "ecp": { + "type": "string", + "description": "Stage name shown to end customers." + }, + "installer": { + "type": "string", + "description": "Stage name shown to installers." + } + } + }, + "portal_descriptions": { + "type": "object", + "description": "Portal-facing overrides of the stage description. Portal surfaces show the matching override instead of `description`; an absent key falls back to `description`.", + "properties": { + "ecp": { + "type": "string", + "description": "Stage description shown to end customers." + }, + "installer": { + "type": "string", + "description": "Stage description shown to installers." + } + } + } + }, + "required": [ + "id", + "name" + ] + }, + "VariableAssignment": { + "type": "object", + "description": "Represents a variable assignment with its expression and optional resolved value. Used for dynamic user assignments that get resolved during workflow execution.", + "properties": { + "variable": { + "type": "string", + "description": "The variable expression, e.g., \"{{entity.owner}}\"", + "example": "{{entity.owner}}" + }, + "value": { "type": "array", "items": { "type": "string" @@ -2652,7 +3422,8 @@ "type": "string" }, "from_id": { - "type": "string" + "type": "string", + "description": "Source node of the edge: a task id, a phase id, the literal `trigger`\n(the primary trigger's entry edge), or an additional trigger's `id`\n(that trigger's own entry edge — allowing the flow to start at a\ndifferent node depending on which trigger fired).\n" }, "to_id": { "type": "string", @@ -2661,6 +3432,10 @@ "condition_id": { "type": "string" }, + "loop_id": { + "type": "string", + "description": "The loop this edge loops back in. Set on loop back edges only." + }, "none_met": { "type": "boolean", "description": "Indicates a default case for a decision task. Only decision task edges can have this field and the flow advances using this edge if no conditions are met." @@ -2743,22 +3518,28 @@ "properties": { "id": { "type": "string", - "description": "The id of the action or trigger" + "description": "The id of the action or trigger, or of the decision owning the loop a flow trait reads" }, "origin": { "type": "string", "enum": [ "trigger", - "action" - ] + "action", + "flow_runtime" + ], + "description": "Where the subject comes from: the run's trigger, an upstream action, or the running flow itself (`flow_runtime`, flow traits).\n" }, "origin_type": { "type": "string", "enum": [ "entity", "workflow", - "journey_block" - ] + "journey_block", + "trigger_source", + "main_context", + "flow_trait" + ], + "description": "`trigger_source` (with origin `trigger`) marks a \"started by\" statement: the run's fired trigger is compared against the configured trigger ids in `values` — no entity attribute is involved.\n`main_context` (with origin `trigger`, no `id`) marks a statement evaluated against the run's PRIMARY context: the fired trigger's entity, re-bound by any completed task that promotes its output to main context (`output_context.set_as_primary`). `schema` carries the subject's schema for attribute selection only — resolution is by the primary flag, never by schema.\n`flow_trait` (with origin `flow_runtime`) marks a statement on a value of the running flow: `attribute` is the trait key, `id` and `attribute_sub_field` name its subject. `loop.iteration` is the lap a loop is in (1 on the first pass); `id` is the decision that owns the loop and `attribute_sub_field` the loop's id, a loop the evaluating decision is inside.\n" }, "schema": { "type": "string" @@ -2821,7 +3602,7 @@ }, "attribute_sub_field": { "type": "string", - "description": "For complex attribute types, specifies which sub-field to extract (e.g., \"address\", \"name\", \"email_type\")" + "description": "For complex attribute types, specifies which sub-field to extract (e.g., \"address\", \"name\", \"email_type\"); for the flow trait `loop.iteration`, the loop id" }, "date_offset": { "type": "object", @@ -2864,7 +3645,7 @@ ] }, "DueDateConfig": { - "description": "Set due date for the task based on a dynamic condition", + "description": "Set due date for the task based on a dynamic condition. `START_DATE` counts from the task's own start date (AL-3678) and is valid only on a task that has a start date.", "type": "object", "properties": { "duration": { @@ -2880,7 +3661,8 @@ "TASK_FINISHED", "PHASE_FINISHED", "A_PRECEDING_TASK_COMPLETED", - "ALL_PRECEDING_TASKS_COMPLETED" + "ALL_PRECEDING_TASKS_COMPLETED", + "START_DATE" ] }, "task_id": { @@ -2896,6 +3678,37 @@ "type" ] }, + "StartDateConfig": { + "description": "Relative start date of a task (AL-3678): `duration` `unit` after the most recent occurrence of the reference event. `THIS_TASK_LAST_COMPLETED` is the task's own previous completion (a loop's earlier pass); there is no wait while the reference event has not happened. Durations are positive whole numbers and are added as exact calendar time (no business days); `years` is not accepted. `TASK_FINISHED` must name another task that comes before this one in the flow: one reached by following the edges back from it, never a loop back edge, where the edge leaving a phase stands for every task in the phase. A task after it, on a parallel branch or later in its own loop is refused. Only a manual task, an automation a person runs and a manual decision may carry one.", + "type": "object", + "properties": { + "duration": { + "type": "number" + }, + "unit": { + "$ref": "#/components/schemas/TimeUnit" + }, + "type": { + "type": "string", + "enum": [ + "WORKFLOW_STARTED", + "TASK_FINISHED", + "A_PRECEDING_TASK_COMPLETED", + "ALL_PRECEDING_TASKS_COMPLETED", + "THIS_TASK_LAST_COMPLETED" + ] + }, + "task_id": { + "type": "string", + "description": "The task whose completion `TASK_FINISHED` counts from; it must come before this task in the flow" + } + }, + "required": [ + "duration", + "unit", + "type" + ] + }, "TimeUnit": { "type": "string", "enum": [ @@ -2931,6 +3744,39 @@ "when" ] }, + "Subtask": { + "description": "One checklist item of a task, derived from the checklist markup in the party descriptions. Identity is the stable data-subtask-id the editor mints into the markup.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Stable id, mirrored as data-subtask-id in the description markup" + }, + "name": { + "type": "string", + "description": "Plain-text snapshot of the checklist item label" + }, + "party": { + "type": "string", + "description": "Which description field the item lives in", + "enum": [ + "description", + "ecp", + "installer", + "partner" + ] + }, + "required": { + "type": "boolean", + "default": false, + "description": "When true, the task cannot be completed while the flow is running until this item is checked" + } + }, + "required": [ + "id", + "party" + ] + }, "WorkflowDefinition": { "type": "object", "description": "V1 workflow definition schema. Defines a linear workflow structure with sections\nand steps. Sections group related steps together, and steps represent individual\ntasks that need to be completed. This is the legacy workflow model; for new\nimplementations, consider using V2 flow templates instead.\n", @@ -3208,13 +4054,181 @@ "name": { "type": "string" }, + "portal_button_label": { + "type": "string", + "maxLength": 50, + "description": "Portal-facing label that replaces the default \"Start now\" button shown for this task's linked journey in the End Customer Portal / Installer Portal. Blank or absent means the portal keeps its own translated default." + }, "complete_task_automatically": { "type": "boolean", "default": true, "description": "If true, the task be auto completed when the journey is completed. By default it is true." + }, + "journey_submission_required": { + "type": "boolean", + "default": false, + "description": "When true, the task cannot be completed while the flow is running until the linked journey was actually submitted. The execution service verifies the submission server-side via the correlation claims in the submission entity's journey_context. Manual tasks only: on any other task kind, or on a manual task with a delayed or relative schedule, the template is rejected (400); when no journey is linked the flag is dropped on create, update and load." + }, + "context_parameters": { + "type": "array", + "description": "Values preset by the flow author for context parameters the journey declares in its contextSchema. A value is either a literal or an entity variable over the run's context, which the launcher resolves when the journey is opened from the task. Overrides the parameter's default value and the launcher's own entity ids.", + "items": { + "$ref": "#/components/schemas/JourneyContextParameter" + } + }, + "ai_prefill": { + "$ref": "#/components/schemas/AiPrefillConfig" + } + } + }, + "AiPrefillConfig": { + "type": "object", + "description": "AI extraction + prefill configuration for the attached journey (Flows v2 only)", + "properties": { + "enabled": { + "type": "boolean", + "default": false + }, + "source": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "flow_context" + ], + "default": "flow_context" + }, + "input_entity": { + "type": "string", + "enum": [ + "thread", + "first_email", + "last_email" + ], + "default": "last_email" + } + } + }, + "extraction_fields": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AiPrefillExtractionField" + } + }, + "mappings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AiPrefillMapping" + } + }, + "min_confidence": { + "type": "number", + "minimum": 0, + "maximum": 1, + "default": 0.8 + }, + "instructions": { + "type": "string", + "maxLength": 2000, + "description": "Free-text, cross-field context for the extractor (e.g. \"amounts are always in euros\")" + } + } + }, + "AiPrefillExtractionField": { + "type": "object", + "required": [ + "key", + "type" + ], + "properties": { + "key": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "boolean", + "date", + "enum" + ] + }, + "description": { + "type": "string" + }, + "description_overridden": { + "type": "boolean", + "description": "Set when the author replaced the derived description with their own; the builder preserves flagged descriptions across re-derivations" + }, + "enum": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "AiPrefillMapping": { + "type": "object", + "required": [ + "source", + "block_id", + "block_type" + ], + "properties": { + "source": { + "type": "string" + }, + "block_id": { + "type": "string" + }, + "block_type": { + "type": "string", + "enum": [ + "text-input", + "number-input", + "personal-information", + "meter-reading", + "contact", + "single-choice", + "date-input", + "binary-input", + "address", + "payment-method", + "multiple-choice", + "availability-check" + ] + }, + "block_field": { + "type": "string" + }, + "country_code": { + "type": "string", + "description": "The country an address or availability-check block is configured for, used when the extraction names none" } } }, + "JourneyContextParameter": { + "type": "object", + "properties": { + "key": { + "type": "string", + "maxLength": 100, + "description": "The journey context parameter key (paramKey in the journey's contextSchema)" + }, + "value": { + "type": "string", + "maxLength": 500, + "description": "The value to pass for the parameter when launching the journey" + } + }, + "required": [ + "key", + "value" + ] + }, "ECPDetails": { "type": "object", "description": "Details regarding ECP for the workflow step", @@ -3332,6 +4346,15 @@ "status": { "$ref": "#/components/schemas/ClosingReasonsStatus" }, + "categoryId": { + "type": "string", + "nullable": true, + "description": "Id of the category the reason is grouped under. Omit or send null for a reason without a category.", + "example": "c9wq81x" + }, + "category": { + "$ref": "#/components/schemas/ClosingReasonCategoryRef" + }, "lastUpdateTime": { "type": "string", "readOnly": true @@ -3342,6 +4365,82 @@ } } }, + "ClosingReasonCategoryRef": { + "type": "object", + "readOnly": true, + "description": "The reason's category, resolved when a flow template is read. Ignored on writes.", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": [ + "id", + "title" + ] + }, + "ClosingReasonCategories": { + "type": "object", + "properties": { + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ClosingReasonCategory" + } + } + }, + "required": [ + "categories" + ] + }, + "ClosingReasonCategory": { + "type": "object", + "description": "A category that groups closing reasons, e.g. \"Wirtschaftlichkeit\" for several economic reasons", + "properties": { + "id": { + "type": "string", + "readOnly": true + }, + "title": { + "type": "string", + "example": "Wirtschaftlichkeit" + }, + "lastUpdateTime": { + "type": "string", + "readOnly": true + }, + "creationTime": { + "type": "string", + "readOnly": true + } + } + }, + "ClosingReasonCategoryPayload": { + "type": "object", + "properties": { + "title": { + "type": "string", + "minLength": 1, + "example": "Wirtschaftlichkeit" + } + }, + "required": [ + "title" + ] + }, + "ClosingReasonCategoryNotFoundResp": { + "type": "object", + "description": "Error response returned when a closing reason category is not found.", + "properties": { + "message": { + "type": "string", + "example": "Closing reason category not found" + } + } + }, "ClosingReasonsStatus": { "type": "string", "enum": [ @@ -3586,6 +4685,166 @@ "type", "condition" ] + }, + "JourneyContextUsagesReq": { + "type": "object", + "description": "Request payload for getJourneyContextUsages.", + "required": [ + "journey_id", + "param_keys" + ], + "properties": { + "journey_id": { + "type": "string", + "description": "Journey whose context parameters are being checked for usage." + }, + "param_keys": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Context parameter keys to look for, as plain strings." + }, + "param_ids": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Accepted and ignored. This service stores context references by name only; the field keeps one request shape across every adapter in this feature." + } + } + }, + "JourneyContextUsage": { + "type": "object", + "description": "One place a flow template task presets one of the requested context parameters.", + "required": [ + "kind", + "resource", + "matched_as" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "workflow-task" + ] + }, + "resource": { + "type": "object", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "workflow_template" + ] + }, + "id": { + "type": "string", + "description": "Flow template id." + }, + "name": { + "type": "string", + "description": "Flow template name, when the template has one." + } + } + }, + "location": { + "type": "object", + "description": "Present only when the matching task carries an id and/or a name.", + "properties": { + "task_id": { + "type": "string" + }, + "task_name": { + "type": "string" + } + } + }, + "matched_as": { + "type": "object", + "required": [ + "dialect", + "token", + "at" + ], + "properties": { + "dialect": { + "type": "string", + "enum": [ + "name" + ] + }, + "token": { + "type": "string", + "description": "The bare parameter key, e.g. `origin` — never a `journey_context.origin`-style prefixed token. Unlike every sibling adapter, this service stores the reference structurally in a typed field (`tasks[].journey.context_parameters[].key`), so the prefixed path string never appears in the stored record; `dialect: name` already tells the caller how to interpret `token`." + }, + "at": { + "type": "string", + "description": "Debugging path into the flow template where the match was found, e.g. `tasks[0].journey.context_parameters[1].key`. Not stable across edits to the template." + } + } + }, + "link_hint": { + "type": "object", + "description": "Omitted when the underlying flow template has no id: a link built from an empty id could not resolve, so none is included. The usage row itself is still reported.", + "required": [ + "route", + "params" + ], + "properties": { + "route": { + "type": "string", + "enum": [ + "workflows-hub-flow" + ] + }, + "params": { + "type": "object", + "required": [ + "template_id" + ], + "properties": { + "template_id": { + "type": "string" + } + } + } + } + } + } + }, + "JourneyContextUsagesResp": { + "type": "object", + "description": "Response payload for getJourneyContextUsages.", + "required": [ + "usages", + "status", + "scanned" + ], + "properties": { + "usages": { + "type": "array", + "items": { + "$ref": "#/components/schemas/JourneyContextUsage" + } + }, + "status": { + "type": "string", + "enum": [ + "ok", + "partial" + ], + "description": "`partial` means the usages list hit its cap and the scan stopped there, before every scannable flow template in the org was examined. `ok` means the scan reached the end of the scannable population and returned every match found there — it does NOT mean every flow template in the org was examined: the underlying query only returns `version = v3` records, so legacy v1/v2 templates never enter the scan, and any record that fails to normalize is silently skipped and logged rather than failing the whole lookup." + }, + "scanned": { + "type": "integer", + "description": "Count of flow templates examined. This is every scannable flow template in the org, not only templates bound to this journey: the underlying query has no server-side journey filter, so it counts the org's whole scannable flow-template population, up to wherever the scan stopped if `status` is `partial`. \"Scannable\" excludes legacy v1/v2 records (the query filters to `version = v3`) and any record that fails to normalize (skipped and logged rather than failing the lookup), so this can be lower than the org's true total flow-template count." + } + } } } } diff --git a/packages/cli/docs/index.md b/packages/cli/docs/index.md index 4695bea7..42fad69f 100644 --- a/packages/cli/docs/index.md +++ b/packages/cli/docs/index.md @@ -65,7 +65,7 @@ npx epilot auth login | Validation Rules API | `epilot validation-rules` | 7 | [validation-rules.md](./validation-rules.md) | | Webhooks | `epilot webhooks` | 15 | [webhooks.md](./webhooks.md) | | Workflows Executions | `epilot workflow` | 25 | [workflow.md](./workflow.md) | -| Workflows Definitions | `epilot workflow-definition` | 22 | [workflow-definition.md](./workflow-definition.md) | +| Workflows Definitions | `epilot workflow-definition` | 27 | [workflow-definition.md](./workflow-definition.md) | ## Global Flags diff --git a/packages/cli/docs/workflow-definition.md b/packages/cli/docs/workflow-definition.md index acc72b4e..6d2e981d 100644 --- a/packages/cli/docs/workflow-definition.md +++ b/packages/cli/docs/workflow-definition.md @@ -63,6 +63,11 @@ epilot workflow-definition getMaxAllowedLimit - [`updateClosingReason`](#updateclosingreason) — Update an existing closing reason - [`deleteClosingReason`](#deleteclosingreason) — Permanently delete a closing reason (Using INACTIVE status is recommended instead) - [`changeReasonStatus`](#changereasonstatus) — Change the status of a Closing Reason (eg. ACTIVE to INACTIVE). +- [`getAllClosingReasonCategories`](#getallclosingreasoncategories) — Get all closing reason categories defined in the organization. +- [`createClosingReasonCategory`](#createclosingreasoncategory) — Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surro +- [`getClosingReasonCategory`](#getclosingreasoncategory) — Get a closing reason category by id. +- [`updateClosingReasonCategory`](#updateclosingreasoncategory) — Rename a closing reason category. Running flows keep the title they started with. +- [`deleteClosingReasonCategory`](#deleteclosingreasoncategory) — Delete a closing reason category. Its reasons are kept and lose their category. ### `getMaxAllowedLimit` @@ -370,6 +375,7 @@ epilot workflow-definition listFlowTemplates --jsonata 'results[0]' "org_id": "string", "name": "string", "description": "string", + "portal_titles": {}, "trigger": {}, "enabled": true, "version": 2, @@ -381,6 +387,7 @@ epilot workflow-definition listFlowTemplates --jsonata 'results[0]' "available_in_ecp": true, "additional_triggers": [], "phases": [], + "stages": [], "tasks": [], "edges": [], "closing_reasons": [], @@ -389,7 +396,11 @@ epilot workflow-definition listFlowTemplates --jsonata 'results[0]' "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, - "limit_warnings": [] + "context_settings": {}, + "limit_warnings": [], + "structural_warnings": [], + "keep_task_automations_in_sync": true, + "protected": true } ] } @@ -410,6 +421,7 @@ Create a new Flow Template (V2 workflow definition). | Name | In | Type | Required | Description | | ---- | -- | ---- | -------- | ----------- | | `enforce_limits` | query | boolean | No | When true, size/count limit violations (max incoming edges per task, max branches, max entity-sync rules, ...) are enforced as 400 errors. Used by the flow-builder UI for interactive authoring. On upd | +| `client_supports_adv_loops` | query | boolean | No | When true, the client writes `loops` on decision tasks and `loop_id` on loop back edges, and invalid ones are rejected. When false or absent, the server rebuilds both from `loop_config`. | **Request Body** (required) @@ -428,6 +440,10 @@ epilot workflow-definition createFlowTemplate \ "org_id": "string", "name": "string", "description": "string", + "portal_titles": { + "ecp": "string", + "installer": "string" + }, "trigger": { "type": "automation", "automation_id": "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg" @@ -457,7 +473,8 @@ epilot workflow-definition createFlowTemplate \ "type": "automation", "automation_id": "string", "input_entity": "thread", - "trigger_config": [] + "trigger_config": [], + "duplicated_automation_id": "string" } ], "phases": [ @@ -470,6 +487,18 @@ epilot workflow-definition createFlowTemplate \ "taxonomies": ["string"] } ], + "stages": [ + { + "id": "string", + "name": "string", + "description": "string", + "entry_node_id": "string", + "cut_edge_ids": ["string"], + "color": "string", + "portal_names": {}, + "portal_descriptions": {} + } + ], "tasks": [ { "id": "string", @@ -478,11 +507,17 @@ epilot workflow-definition createFlowTemplate \ "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL" @@ -494,15 +529,22 @@ epilot workflow-definition createFlowTemplate \ "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL", "automation_config": {}, + "on_failure": "stop", "trigger_mode": "manual", "schedule": {}, "created_automatically": false @@ -514,6 +556,7 @@ epilot workflow-definition createFlowTemplate \ "from_id": "string", "to_id": "string", "condition_id": "string", + "loop_id": "string", "none_met": true } ], @@ -522,6 +565,8 @@ epilot workflow-definition createFlowTemplate \ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -537,6 +582,16 @@ epilot workflow-definition createFlowTemplate \ "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, + "context_settings": { + "visibility": "entity_views", + "main_context": { + "schema": "string", + "relation_labels": ["string"] + }, + "displays": [ + {} + ] + }, "limit_warnings": [ { "i18nKey": "string", @@ -549,7 +604,18 @@ epilot workflow-definition createFlowTemplate \ "param_name": "string", "path": [] } - ] + ], + "structural_warnings": [ + { + "i18nKey": "string", + "message": "string", + "node_id": "string", + "edge_id": "string", + "path": [] + } + ], + "keep_task_automations_in_sync": true, + "protected": true }' ``` @@ -574,6 +640,10 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "org_id": "string", "name": "string", "description": "string", + "portal_titles": { + "ecp": "string", + "installer": "string" + }, "trigger": { "type": "automation", "automation_id": "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg" @@ -603,7 +673,8 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "type": "automation", "automation_id": "string", "input_entity": "thread", - "trigger_config": [] + "trigger_config": [], + "duplicated_automation_id": "string" } ], "phases": [ @@ -616,6 +687,18 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "taxonomies": ["string"] } ], + "stages": [ + { + "id": "string", + "name": "string", + "description": "string", + "entry_node_id": "string", + "cut_edge_ids": ["string"], + "color": "string", + "portal_names": {}, + "portal_descriptions": {} + } + ], "tasks": [ { "id": "string", @@ -624,11 +707,17 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL" @@ -640,15 +729,22 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL", "automation_config": {}, + "on_failure": "stop", "trigger_mode": "manual", "schedule": {}, "created_automatically": false @@ -660,6 +756,7 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "from_id": "string", "to_id": "string", "condition_id": "string", + "loop_id": "string", "none_met": true } ], @@ -668,6 +765,8 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -683,6 +782,16 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, + "context_settings": { + "visibility": "entity_views", + "main_context": { + "schema": "string", + "relation_labels": ["string"] + }, + "displays": [ + {} + ] + }, "limit_warnings": [ { "i18nKey": "string", @@ -695,7 +804,18 @@ epilot workflow-definition createFlowTemplate --jsonata '$' "param_name": "string", "path": [] } - ] + ], + "structural_warnings": [ + { + "i18nKey": "string", + "message": "string", + "node_id": "string", + "edge_id": "string", + "path": [] + } + ], + "keep_task_automations_in_sync": true, + "protected": true } ``` @@ -757,6 +877,7 @@ epilot workflow-definition searchFlowTemplates --jsonata 'results[0]' "org_id": "string", "name": "string", "description": "string", + "portal_titles": {}, "trigger": {}, "enabled": true, "version": 2, @@ -768,6 +889,7 @@ epilot workflow-definition searchFlowTemplates --jsonata 'results[0]' "available_in_ecp": true, "additional_triggers": [], "phases": [], + "stages": [], "tasks": [], "edges": [], "closing_reasons": [], @@ -776,7 +898,11 @@ epilot workflow-definition searchFlowTemplates --jsonata 'results[0]' "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, - "limit_warnings": [] + "context_settings": {}, + "limit_warnings": [], + "structural_warnings": [], + "keep_task_automations_in_sync": true, + "protected": true } ] } @@ -797,6 +923,7 @@ Retrieve a specific flow template by its unique identifier. | Name | In | Type | Required | Description | | ---- | -- | ---- | -------- | ----------- | | `flowId` | path | string | Yes | Unique identifier of the flow template to retrieve. | +| `skip_heal` | query | boolean | No | When true, the template is not healed and nothing is written back. The response is otherwise the same as without it. | **Sample Call** @@ -826,6 +953,10 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "org_id": "string", "name": "string", "description": "string", + "portal_titles": { + "ecp": "string", + "installer": "string" + }, "trigger": { "type": "automation", "automation_id": "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg" @@ -855,7 +986,8 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "type": "automation", "automation_id": "string", "input_entity": "thread", - "trigger_config": [] + "trigger_config": [], + "duplicated_automation_id": "string" } ], "phases": [ @@ -868,6 +1000,18 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "taxonomies": ["string"] } ], + "stages": [ + { + "id": "string", + "name": "string", + "description": "string", + "entry_node_id": "string", + "cut_edge_ids": ["string"], + "color": "string", + "portal_names": {}, + "portal_descriptions": {} + } + ], "tasks": [ { "id": "string", @@ -876,11 +1020,17 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL" @@ -892,15 +1042,22 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL", "automation_config": {}, + "on_failure": "stop", "trigger_mode": "manual", "schedule": {}, "created_automatically": false @@ -912,6 +1069,7 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "from_id": "string", "to_id": "string", "condition_id": "string", + "loop_id": "string", "none_met": true } ], @@ -920,6 +1078,8 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -935,6 +1095,16 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, + "context_settings": { + "visibility": "entity_views", + "main_context": { + "schema": "string", + "relation_labels": ["string"] + }, + "displays": [ + {} + ] + }, "limit_warnings": [ { "i18nKey": "string", @@ -947,7 +1117,18 @@ epilot workflow-definition getFlowTemplate -p flowId=7hj28akg --jsonata '$' "param_name": "string", "path": [] } - ] + ], + "structural_warnings": [ + { + "i18nKey": "string", + "message": "string", + "node_id": "string", + "edge_id": "string", + "path": [] + } + ], + "keep_task_automations_in_sync": true, + "protected": true } ``` @@ -967,6 +1148,7 @@ Update Flow Template. | ---- | -- | ---- | -------- | ----------- | | `flowId` | path | string | Yes | Unique identifier of the flow template to update. | | `enforce_limits` | query | boolean | No | When true, size/count limit violations (max incoming edges per task, max branches, max entity-sync rules, ...) are enforced as 400 errors. Used by the flow-builder UI for interactive authoring. On upd | +| `client_supports_adv_loops` | query | boolean | No | When true, the client writes `loops` on decision tasks and `loop_id` on loop back edges, and invalid ones are rejected. When false or absent, the server rebuilds both from `loop_config`. | **Request Body** (required) @@ -987,6 +1169,10 @@ epilot workflow-definition updateFlowTemplate \ "org_id": "string", "name": "string", "description": "string", + "portal_titles": { + "ecp": "string", + "installer": "string" + }, "trigger": { "type": "automation", "automation_id": "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg" @@ -1016,7 +1202,8 @@ epilot workflow-definition updateFlowTemplate \ "type": "automation", "automation_id": "string", "input_entity": "thread", - "trigger_config": [] + "trigger_config": [], + "duplicated_automation_id": "string" } ], "phases": [ @@ -1029,6 +1216,18 @@ epilot workflow-definition updateFlowTemplate \ "taxonomies": ["string"] } ], + "stages": [ + { + "id": "string", + "name": "string", + "description": "string", + "entry_node_id": "string", + "cut_edge_ids": ["string"], + "color": "string", + "portal_names": {}, + "portal_descriptions": {} + } + ], "tasks": [ { "id": "string", @@ -1037,11 +1236,17 @@ epilot workflow-definition updateFlowTemplate \ "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL" @@ -1053,15 +1258,22 @@ epilot workflow-definition updateFlowTemplate \ "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL", "automation_config": {}, + "on_failure": "stop", "trigger_mode": "manual", "schedule": {}, "created_automatically": false @@ -1073,6 +1285,7 @@ epilot workflow-definition updateFlowTemplate \ "from_id": "string", "to_id": "string", "condition_id": "string", + "loop_id": "string", "none_met": true } ], @@ -1081,6 +1294,8 @@ epilot workflow-definition updateFlowTemplate \ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1096,6 +1311,16 @@ epilot workflow-definition updateFlowTemplate \ "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, + "context_settings": { + "visibility": "entity_views", + "main_context": { + "schema": "string", + "relation_labels": ["string"] + }, + "displays": [ + {} + ] + }, "limit_warnings": [ { "i18nKey": "string", @@ -1108,7 +1333,18 @@ epilot workflow-definition updateFlowTemplate \ "param_name": "string", "path": [] } - ] + ], + "structural_warnings": [ + { + "i18nKey": "string", + "message": "string", + "node_id": "string", + "edge_id": "string", + "path": [] + } + ], + "keep_task_automations_in_sync": true, + "protected": true }' ``` @@ -1139,6 +1375,10 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "org_id": "string", "name": "string", "description": "string", + "portal_titles": { + "ecp": "string", + "installer": "string" + }, "trigger": { "type": "automation", "automation_id": "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg" @@ -1168,7 +1408,8 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "type": "automation", "automation_id": "string", "input_entity": "thread", - "trigger_config": [] + "trigger_config": [], + "duplicated_automation_id": "string" } ], "phases": [ @@ -1181,6 +1422,18 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "taxonomies": ["string"] } ], + "stages": [ + { + "id": "string", + "name": "string", + "description": "string", + "entry_node_id": "string", + "cut_edge_ids": ["string"], + "color": "string", + "portal_names": {}, + "portal_descriptions": {} + } + ], "tasks": [ { "id": "string", @@ -1189,11 +1442,17 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL" @@ -1205,15 +1464,22 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL", "automation_config": {}, + "on_failure": "stop", "trigger_mode": "manual", "schedule": {}, "created_automatically": false @@ -1225,6 +1491,7 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "from_id": "string", "to_id": "string", "condition_id": "string", + "loop_id": "string", "none_met": true } ], @@ -1233,6 +1500,8 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1248,6 +1517,16 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, + "context_settings": { + "visibility": "entity_views", + "main_context": { + "schema": "string", + "relation_labels": ["string"] + }, + "displays": [ + {} + ] + }, "limit_warnings": [ { "i18nKey": "string", @@ -1260,7 +1539,18 @@ epilot workflow-definition updateFlowTemplate -p flowId=7hj28akg --jsonata '$' "param_name": "string", "path": [] } - ] + ], + "structural_warnings": [ + { + "i18nKey": "string", + "message": "string", + "node_id": "string", + "edge_id": "string", + "path": [] + } + ], + "keep_task_automations_in_sync": true, + "protected": true } ``` @@ -1341,6 +1631,10 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "org_id": "string", "name": "string", "description": "string", + "portal_titles": { + "ecp": "string", + "installer": "string" + }, "trigger": { "type": "automation", "automation_id": "g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg" @@ -1370,7 +1664,8 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "type": "automation", "automation_id": "string", "input_entity": "thread", - "trigger_config": [] + "trigger_config": [], + "duplicated_automation_id": "string" } ], "phases": [ @@ -1383,6 +1678,18 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "taxonomies": ["string"] } ], + "stages": [ + { + "id": "string", + "name": "string", + "description": "string", + "entry_node_id": "string", + "cut_edge_ids": ["string"], + "color": "string", + "portal_names": {}, + "portal_descriptions": {} + } + ], "tasks": [ { "id": "string", @@ -1391,11 +1698,17 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL" @@ -1407,15 +1720,22 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "journey": {}, "due_date": "2021-04-27T12:00:00.000Z", "due_date_config": {}, + "start_date": "2021-04-27T12:00:00.000Z", + "start_date_config": {}, "requirements": [], + "required": false, + "only_assignee_can_complete": true, + "subtasks": [], "assigned_to": ["string"], "ecp": {}, "installer": {}, "partner": {}, + "audience_order": ["description"], "taxonomies": ["string"], "phase_id": "string", "task_type": "MANUAL", "automation_config": {}, + "on_failure": "stop", "trigger_mode": "manual", "schedule": {}, "created_automatically": false @@ -1427,6 +1747,7 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "from_id": "string", "to_id": "string", "condition_id": "string", + "loop_id": "string", "none_met": true } ], @@ -1435,6 +1756,8 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1450,6 +1773,16 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "singleClosingReasonSelection": true, "_manifest": ["string"], "linear": true, + "context_settings": { + "visibility": "entity_views", + "main_context": { + "schema": "string", + "relation_labels": ["string"] + }, + "displays": [ + {} + ] + }, "limit_warnings": [ { "i18nKey": "string", @@ -1462,7 +1795,18 @@ epilot workflow-definition duplicateFlowTemplate -p flowId=7hj28akg --jsonata '$ "param_name": "string", "path": [] } - ] + ], + "structural_warnings": [ + { + "i18nKey": "string", + "message": "string", + "node_id": "string", + "edge_id": "string", + "path": [] + } + ], + "keep_task_automations_in_sync": true, + "protected": true } ``` @@ -1829,6 +2173,11 @@ epilot workflow-definition getAllClosingReasons --jsonata 'reasons' "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -1850,9 +2199,26 @@ A created Closing Reason is stored for the organization and will be displayed in **Sample Call** +```bash +epilot workflow-definition createClosingReason +``` + +With request body: + ```bash epilot workflow-definition createClosingReason \ - -d '{"id":"string","title":"string","status":"ACTIVE","lastUpdateTime":"string","creationTime":"string"}' + -d '{ + "id": "string", + "title": "string", + "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, + "lastUpdateTime": "string", + "creationTime": "string" +}' ``` Using stdin pipe: @@ -1875,6 +2241,11 @@ epilot workflow-definition createClosingReason --jsonata 'id' "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -1923,6 +2294,11 @@ epilot workflow-definition getClosingReason -p reasonId=x739cew --jsonata 'id' "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -1948,10 +2324,28 @@ Update an existing closing reason **Sample Call** +```bash +epilot workflow-definition updateClosingReason \ + -p reasonId=x739cew +``` + +With request body: + ```bash epilot workflow-definition updateClosingReason \ -p reasonId=x739cew \ - -d '{"id":"string","title":"string","status":"ACTIVE","lastUpdateTime":"string","creationTime":"string"}' + -d '{ + "id": "string", + "title": "string", + "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, + "lastUpdateTime": "string", + "creationTime": "string" +}' ``` Using positional args for path parameters: @@ -1980,6 +2374,11 @@ epilot workflow-definition updateClosingReason -p reasonId=x739cew --jsonata 'id "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -2064,6 +2463,223 @@ epilot workflow-definition changeReasonStatus -p reasonId=123e4567-e89b-12d3-a45 --- +### `getAllClosingReasonCategories` + +Get all closing reason categories defined in the organization. + +`GET /v1/workflows/closing-reason-categories` + +**Sample Call** + +```bash +epilot workflow-definition getAllClosingReasonCategories +``` + +With JSONata filter: + +```bash +epilot workflow-definition getAllClosingReasonCategories --jsonata 'categories' +``` + +
+Sample Response + +```json +{ + "categories": [ + { + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" + } + ] +} +``` + +
+ +--- + +### `createClosingReasonCategory` + +Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surro + +`POST /v1/workflows/closing-reason-categories` + +**Request Body** (required) + +**Sample Call** + +```bash +epilot workflow-definition createClosingReasonCategory \ + -d '{"title":"Wirtschaftlichkeit"}' +``` + +Using stdin pipe: + +```bash +cat body.json | epilot workflow-definition createClosingReasonCategory +``` + +With JSONata filter: + +```bash +epilot workflow-definition createClosingReasonCategory --jsonata 'id' +``` + +
+Sample Response + +```json +{ + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" +} +``` + +
+ +--- + +### `getClosingReasonCategory` + +Get a closing reason category by id. + +`GET /v1/workflows/closing-reason-categories/{categoryId}` + +**Parameters** + +| Name | In | Type | Required | Description | +| ---- | -- | ---- | -------- | ----------- | +| `categoryId` | path | string | Yes | unique id to identify the closing reason category. | + +**Sample Call** + +```bash +epilot workflow-definition getClosingReasonCategory \ + -p categoryId=c9wq81x +``` + +Using positional args for path parameters: + +```bash +epilot workflow-definition getClosingReasonCategory c9wq81x +``` + +With JSONata filter: + +```bash +epilot workflow-definition getClosingReasonCategory -p categoryId=c9wq81x --jsonata 'id' +``` + +
+Sample Response + +```json +{ + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" +} +``` + +
+ +--- + +### `updateClosingReasonCategory` + +Rename a closing reason category. Running flows keep the title they started with. + +`PATCH /v1/workflows/closing-reason-categories/{categoryId}` + +**Parameters** + +| Name | In | Type | Required | Description | +| ---- | -- | ---- | -------- | ----------- | +| `categoryId` | path | string | Yes | unique id to identify the closing reason category. | + +**Request Body** (required) + +**Sample Call** + +```bash +epilot workflow-definition updateClosingReasonCategory \ + -p categoryId=c9wq81x \ + -d '{"title":"Wirtschaftlichkeit"}' +``` + +Using positional args for path parameters: + +```bash +epilot workflow-definition updateClosingReasonCategory c9wq81x +``` + +Using stdin pipe: + +```bash +cat body.json | epilot workflow-definition updateClosingReasonCategory -p categoryId=c9wq81x +``` + +With JSONata filter: + +```bash +epilot workflow-definition updateClosingReasonCategory -p categoryId=c9wq81x --jsonata 'id' +``` + +
+Sample Response + +```json +{ + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" +} +``` + +
+ +--- + +### `deleteClosingReasonCategory` + +Delete a closing reason category. Its reasons are kept and lose their category. + +`DELETE /v1/workflows/closing-reason-categories/{categoryId}` + +**Parameters** + +| Name | In | Type | Required | Description | +| ---- | -- | ---- | -------- | ----------- | +| `categoryId` | path | string | Yes | unique id to identify the closing reason category. | + +**Sample Call** + +```bash +epilot workflow-definition deleteClosingReasonCategory \ + -p categoryId=c9wq81x +``` + +Using positional args for path parameters: + +```bash +epilot workflow-definition deleteClosingReasonCategory c9wq81x +``` + +With JSONata filter: + +```bash +epilot workflow-definition deleteClosingReasonCategory -p categoryId=c9wq81x --jsonata '$' +``` + +--- + ### `getWorkflowClosingReasons` Returns all closing reasons defined for the workflow. diff --git a/packages/epilot-sdk-v2/docs/workflow-definition.md b/packages/epilot-sdk-v2/docs/workflow-definition.md index dcf9873e..ce5a4f27 100644 --- a/packages/epilot-sdk-v2/docs/workflow-definition.md +++ b/packages/epilot-sdk-v2/docs/workflow-definition.md @@ -50,6 +50,11 @@ const { data } = await workflowDefinitionClient.getMaxAllowedLimit(...) - [`updateClosingReason`](#updateclosingreason) - [`deleteClosingReason`](#deleteclosingreason) - [`changeReasonStatus`](#changereasonstatus) +- [`getAllClosingReasonCategories`](#getallclosingreasoncategories) +- [`createClosingReasonCategory`](#createclosingreasoncategory) +- [`getClosingReasonCategory`](#getclosingreasoncategory) +- [`updateClosingReasonCategory`](#updateclosingreasoncategory) +- [`deleteClosingReasonCategory`](#deleteclosingreasoncategory) **Schemas** - [`FlowTemplateBase`](#flowtemplatebase) @@ -127,6 +132,11 @@ const { data } = await workflowDefinitionClient.getMaxAllowedLimit(...) - [`ChangeReasonStatusReq`](#changereasonstatusreq) - [`ClosingReasons`](#closingreasons) - [`ClosingReason`](#closingreason) +- [`ClosingReasonCategoryRef`](#closingreasoncategoryref) +- [`ClosingReasonCategories`](#closingreasoncategories) +- [`ClosingReasonCategory`](#closingreasoncategory) +- [`ClosingReasonCategoryPayload`](#closingreasoncategorypayload) +- [`ClosingReasonCategoryNotFoundResp`](#closingreasoncategorynotfoundresp) - [`ClosingReasonsStatus`](#closingreasonsstatus) - [`ClosingReasonsIds`](#closingreasonsids) - [`ClosingReasonId`](#closingreasonid) @@ -575,6 +585,8 @@ const { data } = await client.createFlowTemplate( id: 'string', title: 'string', status: 'ACTIVE', + categoryId: 'c9wq81x', + category: { /* ... */ }, lastUpdateTime: 'string', creationTime: 'string' } @@ -762,6 +774,8 @@ const { data } = await client.createFlowTemplate( "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1034,6 +1048,8 @@ const { data } = await client.getFlowTemplate({ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1235,6 +1251,8 @@ const { data } = await client.updateFlowTemplate( id: 'string', title: 'string', status: 'ACTIVE', + categoryId: 'c9wq81x', + category: { /* ... */ }, lastUpdateTime: 'string', creationTime: 'string' } @@ -1422,6 +1440,8 @@ const { data } = await client.updateFlowTemplate( "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1640,6 +1660,8 @@ const { data } = await client.duplicateFlowTemplate({ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": {}, "lastUpdateTime": "string", "creationTime": "string" } @@ -1973,6 +1995,11 @@ const { data } = await client.getAllClosingReasons({ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -1997,6 +2024,11 @@ const { data } = await client.createClosingReason( id: 'string', title: 'string', status: 'ACTIVE', + categoryId: 'c9wq81x', + category: { + id: 'string', + title: 'string' + }, lastUpdateTime: 'string', creationTime: 'string' }, @@ -2011,6 +2043,11 @@ const { data } = await client.createClosingReason( "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -2040,6 +2077,11 @@ const { data } = await client.getClosingReason({ "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -2064,6 +2106,11 @@ const { data } = await client.updateClosingReason( id: 'string', title: 'string', status: 'ACTIVE', + categoryId: 'c9wq81x', + category: { + id: 'string', + title: 'string' + }, lastUpdateTime: 'string', creationTime: 'string' }, @@ -2078,6 +2125,11 @@ const { data } = await client.updateClosingReason( "id": "string", "title": "string", "status": "ACTIVE", + "categoryId": "c9wq81x", + "category": { + "id": "string", + "title": "string" + }, "lastUpdateTime": "string", "creationTime": "string" } @@ -2120,6 +2172,142 @@ const { data } = await client.changeReasonStatus( --- +### `getAllClosingReasonCategories` + +Get all closing reason categories defined in the organization. + +`GET /v1/workflows/closing-reason-categories` + +```ts +const { data } = await client.getAllClosingReasonCategories() +``` + +
+Response + +```json +{ + "categories": [ + { + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" + } + ] +} +``` + +
+ +--- + +### `createClosingReasonCategory` + +Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace. + +`POST /v1/workflows/closing-reason-categories` + +```ts +const { data } = await client.createClosingReasonCategory( + null, + { + title: 'Wirtschaftlichkeit' + }, +) +``` + +
+Response + +```json +{ + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" +} +``` + +
+ +--- + +### `getClosingReasonCategory` + +Get a closing reason category by id. + +`GET /v1/workflows/closing-reason-categories/{categoryId}` + +```ts +const { data } = await client.getClosingReasonCategory({ + categoryId: 'example', +}) +``` + +
+Response + +```json +{ + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" +} +``` + +
+ +--- + +### `updateClosingReasonCategory` + +Rename a closing reason category. Running flows keep the title they started with. + +`PATCH /v1/workflows/closing-reason-categories/{categoryId}` + +```ts +const { data } = await client.updateClosingReasonCategory( + { + categoryId: 'example', + }, + { + title: 'Wirtschaftlichkeit' + }, +) +``` + +
+Response + +```json +{ + "id": "string", + "title": "Wirtschaftlichkeit", + "lastUpdateTime": "string", + "creationTime": "string" +} +``` + +
+ +--- + +### `deleteClosingReasonCategory` + +Delete a closing reason category. Its reasons are kept and lose their category. + +`DELETE /v1/workflows/closing-reason-categories/{categoryId}` + +```ts +const { data } = await client.deleteClosingReasonCategory({ + categoryId: 'example', +}) +``` + +--- + ### `getWorkflowClosingReasons` Returns all closing reasons defined for the workflow. @@ -4414,6 +4602,11 @@ type ClosingReasons = { id?: string title?: string status?: "ACTIVE" | "INACTIVE" + categoryId?: string + category?: { + id: { ... } + title: { ... } + } lastUpdateTime?: string creationTime?: string }> @@ -4429,11 +4622,71 @@ type ClosingReason = { id?: string title?: string status?: "ACTIVE" | "INACTIVE" + categoryId?: string + category?: { + id: string + title: string + } lastUpdateTime?: string creationTime?: string } ``` +### `ClosingReasonCategoryRef` + +The reason's category, resolved when a flow template is read. Ignored on writes. + +```ts +type ClosingReasonCategoryRef = { + id: string + title: string +} +``` + +### `ClosingReasonCategories` + +```ts +type ClosingReasonCategories = { + categories: Array<{ + id?: string + title?: string + lastUpdateTime?: string + creationTime?: string + }> +} +``` + +### `ClosingReasonCategory` + +A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons + +```ts +type ClosingReasonCategory = { + id?: string + title?: string + lastUpdateTime?: string + creationTime?: string +} +``` + +### `ClosingReasonCategoryPayload` + +```ts +type ClosingReasonCategoryPayload = { + title: string +} +``` + +### `ClosingReasonCategoryNotFoundResp` + +Error response returned when a closing reason category is not found. + +```ts +type ClosingReasonCategoryNotFoundResp = { + message?: string +} +``` + ### `ClosingReasonsStatus` ```ts diff --git a/packages/epilot-sdk-v2/src/definitions/workflow-definition-runtime.json b/packages/epilot-sdk-v2/src/definitions/workflow-definition-runtime.json index 29b7e663..dfc18e09 100644 --- a/packages/epilot-sdk-v2/src/definitions/workflow-definition-runtime.json +++ b/packages/epilot-sdk-v2/src/definitions/workflow-definition-runtime.json @@ -1 +1 @@ -{"s":"https://workflows-definition.sls.epilot.io","o":[["getMaxAllowedLimit","get","/v1/workflows/limits/max-allowed"],["getDefinitions","get","/v1/workflows/definitions"],["createDefinition","post","/v1/workflows/definitions",null,1],["listFlowTemplates","get","/v2/flows/templates",[["trigger_type","q"],["trigger_source_id","q"],["trigger_schema","q"]]],["createFlowTemplate","post","/v2/flows/templates",[["EnforceLimitsParam"],["ClientSupportsAdvLoopsParam"]],1],["searchFlowTemplates","post","/v2/flows/templates:search",null,1],["getFlowTemplate","get","/v2/flows/templates/{flowId}",[["flowId","p",true],["SkipHealParam"]]],["updateFlowTemplate","put","/v2/flows/templates/{flowId}",[["flowId","p",true],["EnforceLimitsParam"],["ClientSupportsAdvLoopsParam"]],1],["deleteFlowTemplate","delete","/v2/flows/templates/{flowId}",[["flowId","p",true]]],["duplicateFlowTemplate","post","/v2/flows/templates/{flowId}/duplicate",[["flowId","p",true]]],["getDefinition","get","/v1/workflows/definitions/{definitionId}",[["definitionId","p",true]]],["updateDefinition","put","/v1/workflows/definitions/{definitionId}",[["definitionId","p",true]],1],["deleteDefinition","delete","/v1/workflows/definitions/{definitionId}",[["definitionId","p",true]]],["getAllClosingReasons","get","/v1/workflows/closing-reasons",[["includeInactive","q"]]],["createClosingReason","post","/v1/workflows/closing-reasons",null,1],["getClosingReason","get","/v2/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]]],["updateClosingReason","patch","/v2/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]],1],["deleteClosingReason","delete","/v2/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]]],["getClosingReasonV1","get","/v1/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]]],["changeReasonStatus","patch","/v1/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]],1],["getWorkflowClosingReasons","get","/v1/workflows/definitions/{definitionId}/closing-reasons",[["definitionId","p",true]]],["setWorkflowClosingReasons","patch","/v1/workflows/definitions/{definitionId}/closing-reasons",[["definitionId","p",true]],1]],"v":"3.0.0","cp":{"ClientSupportsAdvLoopsParam":["client_supports_adv_loops","q"],"EnforceLimitsParam":["enforce_limits","q"],"SkipHealParam":["skip_heal","q"]}} \ No newline at end of file +{"s":"https://workflows-definition.sls.epilot.io","o":[["getMaxAllowedLimit","get","/v1/workflows/limits/max-allowed"],["getDefinitions","get","/v1/workflows/definitions"],["createDefinition","post","/v1/workflows/definitions",null,1],["listFlowTemplates","get","/v2/flows/templates",[["trigger_type","q"],["trigger_source_id","q"],["trigger_schema","q"]]],["createFlowTemplate","post","/v2/flows/templates",[["EnforceLimitsParam"],["ClientSupportsAdvLoopsParam"]],1],["searchFlowTemplates","post","/v2/flows/templates:search",null,1],["getFlowTemplate","get","/v2/flows/templates/{flowId}",[["flowId","p",true],["SkipHealParam"]]],["updateFlowTemplate","put","/v2/flows/templates/{flowId}",[["flowId","p",true],["EnforceLimitsParam"],["ClientSupportsAdvLoopsParam"]],1],["deleteFlowTemplate","delete","/v2/flows/templates/{flowId}",[["flowId","p",true]]],["duplicateFlowTemplate","post","/v2/flows/templates/{flowId}/duplicate",[["flowId","p",true]]],["getDefinition","get","/v1/workflows/definitions/{definitionId}",[["definitionId","p",true]]],["updateDefinition","put","/v1/workflows/definitions/{definitionId}",[["definitionId","p",true]],1],["deleteDefinition","delete","/v1/workflows/definitions/{definitionId}",[["definitionId","p",true]]],["getAllClosingReasons","get","/v1/workflows/closing-reasons",[["includeInactive","q"]]],["createClosingReason","post","/v1/workflows/closing-reasons",null,1],["getClosingReason","get","/v2/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]]],["updateClosingReason","patch","/v2/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]],1],["deleteClosingReason","delete","/v2/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]]],["getClosingReasonV1","get","/v1/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]]],["changeReasonStatus","patch","/v1/workflows/closing-reasons/{reasonId}",[["reasonId","p",true]],1],["getAllClosingReasonCategories","get","/v1/workflows/closing-reason-categories"],["createClosingReasonCategory","post","/v1/workflows/closing-reason-categories",null,1],["getClosingReasonCategory","get","/v1/workflows/closing-reason-categories/{categoryId}"],["updateClosingReasonCategory","patch","/v1/workflows/closing-reason-categories/{categoryId}",null,1],["deleteClosingReasonCategory","delete","/v1/workflows/closing-reason-categories/{categoryId}"],["getWorkflowClosingReasons","get","/v1/workflows/definitions/{definitionId}/closing-reasons",[["definitionId","p",true]]],["setWorkflowClosingReasons","patch","/v1/workflows/definitions/{definitionId}/closing-reasons",[["definitionId","p",true]],1]],"v":"3.0.0","cp":{"ClientSupportsAdvLoopsParam":["client_supports_adv_loops","q"],"EnforceLimitsParam":["enforce_limits","q"],"SkipHealParam":["skip_heal","q"]},"pp":{"/v1/workflows/closing-reason-categories/{categoryId}":[["categoryId","p",true]]}} \ No newline at end of file diff --git a/packages/epilot-sdk-v2/src/docs/workflow-definition.json b/packages/epilot-sdk-v2/src/docs/workflow-definition.json index 206ab911..394504fb 100644 --- a/packages/epilot-sdk-v2/src/docs/workflow-definition.json +++ b/packages/epilot-sdk-v2/src/docs/workflow-definition.json @@ -1 +1 @@ -"# Workflows Definitions\n\n- **Base URL:** `https://workflows-definition.sls.epilot.io`\n- **Full API Docs:** [https://docs.epilot.io/api/workflow-definition](https://docs.epilot.io/api/workflow-definition)\n\n## Usage\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '')\nconst { data } = await epilot.workflowDefinition.getMaxAllowedLimit(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/workflow-definition'\n\nconst workflowDefinitionClient = getClient()\nauthorize(workflowDefinitionClient, () => '')\nconst { data } = await workflowDefinitionClient.getMaxAllowedLimit(...)\n```\n\n## Operations\n\n**Workflows**\n- [`getMaxAllowedLimit`](#getmaxallowedlimit)\n- [`getDefinitions`](#getdefinitions)\n- [`createDefinition`](#createdefinition)\n- [`getDefinition`](#getdefinition)\n- [`updateDefinition`](#updatedefinition)\n- [`deleteDefinition`](#deletedefinition)\n- [`getWorkflowClosingReasons`](#getworkflowclosingreasons)\n- [`setWorkflowClosingReasons`](#setworkflowclosingreasons)\n\n**Flows V2**\n- [`listFlowTemplates`](#listflowtemplates)\n- [`createFlowTemplate`](#createflowtemplate)\n- [`searchFlowTemplates`](#searchflowtemplates)\n- [`getFlowTemplate`](#getflowtemplate)\n- [`updateFlowTemplate`](#updateflowtemplate)\n- [`deleteFlowTemplate`](#deleteflowtemplate)\n- [`duplicateFlowTemplate`](#duplicateflowtemplate)\n\n**Closing Reason**\n- [`getAllClosingReasons`](#getallclosingreasons)\n- [`createClosingReason`](#createclosingreason)\n- [`getClosingReason`](#getclosingreason)\n- [`updateClosingReason`](#updateclosingreason)\n- [`deleteClosingReason`](#deleteclosingreason)\n- [`changeReasonStatus`](#changereasonstatus)\n\n**Schemas**\n- [`FlowTemplateBase`](#flowtemplatebase)\n- [`FlowLimitWarning`](#flowlimitwarning)\n- [`FlowStructuralWarning`](#flowstructuralwarning)\n- [`FlowTemplate`](#flowtemplate)\n- [`Version`](#version)\n- [`Trigger`](#trigger)\n- [`ManualTrigger`](#manualtrigger)\n- [`AutomationTrigger`](#automationtrigger)\n- [`JourneyAutomationTrigger`](#journeyautomationtrigger)\n- [`JourneySubmissionTrigger`](#journeysubmissiontrigger)\n- [`CreateFlowTemplate`](#createflowtemplate)\n- [`SearchFlowTemplates`](#searchflowtemplates)\n- [`FlowTemplatesList`](#flowtemplateslist)\n- [`FlowTemplateId`](#flowtemplateid)\n- [`Task`](#task)\n- [`ManualTask`](#manualtask)\n- [`AutomationTask`](#automationtask)\n- [`AutomationFailurePolicy`](#automationfailurepolicy)\n- [`AutomationConfig`](#automationconfig)\n- [`EmailReviewConfig`](#emailreviewconfig)\n- [`AutomationInputContext`](#automationinputcontext)\n- [`AutomationInputExtraContextRef`](#automationinputextracontextref)\n- [`AutomationInputExtraTaskRef`](#automationinputextrataskref)\n- [`FlowContextSettings`](#flowcontextsettings)\n- [`MainContextSetting`](#maincontextsetting)\n- [`FlowDisplayRule`](#flowdisplayrule)\n- [`FlowRuleAnchor`](#flowruleanchor)\n- [`MainContextAnchor`](#maincontextanchor)\n- [`RuleAnchor`](#ruleanchor)\n- [`AutomationOutputContext`](#automationoutputcontext)\n- [`AiAgentTask`](#aiagenttask)\n- [`AgentConfig`](#agentconfig)\n- [`TriggerMode`](#triggermode)\n- [`ActionSchedule`](#actionschedule)\n- [`ImmediateSchedule`](#immediateschedule)\n- [`DelayedSchedule`](#delayedschedule)\n- [`RelativeSchedule`](#relativeschedule)\n- [`DecisionTask`](#decisiontask)\n- [`LoopDefinition`](#loopdefinition)\n- [`TaskAudience`](#taskaudience)\n- [`TaskBase`](#taskbase)\n- [`Phase`](#phase)\n- [`Stage`](#stage)\n- [`VariableAssignment`](#variableassignment)\n- [`TaskType`](#tasktype)\n- [`Edge`](#edge)\n- [`Condition`](#condition)\n- [`Statement`](#statement)\n- [`EvaluationSource`](#evaluationsource)\n- [`Operator`](#operator)\n- [`DueDateConfig`](#duedateconfig)\n- [`StartDateConfig`](#startdateconfig)\n- [`TimeUnit`](#timeunit)\n- [`EnableRequirement`](#enablerequirement)\n- [`Subtask`](#subtask)\n- [`WorkflowDefinition`](#workflowdefinition)\n- [`Step`](#step)\n- [`Section`](#section)\n- [`TriggerType`](#triggertype)\n- [`ItemType`](#itemtype)\n- [`StepType`](#steptype)\n- [`StepJourney`](#stepjourney)\n- [`AiPrefillConfig`](#aiprefillconfig)\n- [`AiPrefillExtractionField`](#aiprefillextractionfield)\n- [`AiPrefillMapping`](#aiprefillmapping)\n- [`JourneyContextParameter`](#journeycontextparameter)\n- [`ECPDetails`](#ecpdetails)\n- [`PartnerDetails`](#partnerdetails)\n- [`StepDescription`](#stepdescription)\n- [`MaxAllowedLimit`](#maxallowedlimit)\n- [`DefinitionNotFoundResp`](#definitionnotfoundresp)\n- [`ClosingReasonNotFoundResp`](#closingreasonnotfoundresp)\n- [`ChangeReasonStatusReq`](#changereasonstatusreq)\n- [`ClosingReasons`](#closingreasons)\n- [`ClosingReason`](#closingreason)\n- [`ClosingReasonsStatus`](#closingreasonsstatus)\n- [`ClosingReasonsIds`](#closingreasonsids)\n- [`ClosingReasonId`](#closingreasonid)\n- [`ErrorResp`](#errorresp)\n- [`UpdateEntityAttributes`](#updateentityattributes)\n- [`EntitySync`](#entitysync)\n- [`DynamicDueDate`](#dynamicduedate)\n- [`StepRequirement`](#steprequirement)\n- [`JourneyContextUsagesReq`](#journeycontextusagesreq)\n- [`JourneyContextUsage`](#journeycontextusage)\n- [`JourneyContextUsagesResp`](#journeycontextusagesresp)\n\n### `getMaxAllowedLimit`\n\nGet limits and number of created executions for an Organization.\n\n`GET /v1/workflows/limits/max-allowed`\n\n```ts\nconst { data } = await client.getMaxAllowedLimit()\n```\n\n
\nResponse\n\n```json\n{\n \"currentNoOfWorkflows\": 0,\n \"maxAllowed\": 0\n}\n```\n\n
\n\n---\n\n### `getDefinitions`\n\nRetrieve all V1 workflow definitions belonging to the authenticated organization.\n\n`GET /v1/workflows/definitions`\n\n```ts\nconst { data } = await client.getDefinitions()\n```\n\n
\nResponse\n\n```json\n[\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {},\n {}\n ],\n \"closingReasons\": [\n {}\n ],\n \"updateEntityAttributes\": [\n {}\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n }\n]\n```\n\n
\n\n---\n\n### `createDefinition`\n\nCreate a new V1 workflow definition. The definition consists of sections and steps\nthat define the structure of the workflow. Once created, the definition can be used\nto start workflow executions.\n\n`POST /v1/workflows/definitions`\n\n```ts\nconst { data } = await client.createDefinition(\n null,\n {\n id: 'string',\n name: 'string',\n description: 'string',\n creationTime: '2021-04-27T12:01:13.000Z',\n enabled: true,\n lastUpdateTime: '2021-04-27T12:01:13.000Z',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: {\n numberOfUnits: 0,\n timePeriod: 'minutes',\n actionTypeCondition: 'WORKFLOW_STARTED',\n stepId: 'string',\n phaseId: 'string'\n },\n userIds: [0],\n assignedTo: ['string'],\n enableECPWorkflow: true,\n flow: [\n {\n id: 'string',\n name: 'string',\n order: 0,\n type: 'STEP',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n assignedTo: ['string'],\n steps: [ /* ... */ ],\n taxonomies: ['string']\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n executionType: 'MANUAL',\n automationConfig: { /* ... */ },\n journey: { /* ... */ },\n order: 0,\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n userIds: [0],\n requirements: [ /* ... */ ],\n assignedTo: ['string'],\n type: 'STEP',\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n taxonomies: ['string']\n }\n ],\n closingReasons: [\n {\n id: 'x739cew'\n }\n ],\n updateEntityAttributes: [\n {\n source: 'workflow_status',\n target: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string']\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"order\": 0,\n \"type\": \"STEP\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"assignedTo\": [\"string\"],\n \"steps\": [],\n \"taxonomies\": [\"string\"]\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"executionType\": \"MANUAL\",\n \"automationConfig\": {},\n \"journey\": {},\n \"order\": 0,\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"userIds\": [0],\n \"requirements\": [],\n \"assignedTo\": [\"string\"],\n \"type\": \"STEP\",\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"taxonomies\": [\"string\"]\n }\n ],\n \"closingReasons\": [\n {\n \"id\": \"x739cew\"\n }\n ],\n \"updateEntityAttributes\": [\n {\n \"source\": \"workflow_status\",\n \"target\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n}\n```\n\n
\n\n---\n\n### `listFlowTemplates`\n\nList all Flow Templates for a customer. Optionally, you can filter flow templates by trigger values.\n\n`GET /v2/flows/templates`\n\n```ts\nconst { data } = await client.listFlowTemplates({\n trigger_type: 'example',\n trigger_source_id: 'example',\n trigger_schema: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"results\": [\n {\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {},\n \"trigger\": {},\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [],\n \"phases\": [],\n \"stages\": [],\n \"tasks\": [],\n \"edges\": [],\n \"closing_reasons\": [],\n \"entity_sync\": [],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {},\n \"limit_warnings\": [],\n \"structural_warnings\": [],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createFlowTemplate`\n\nCreate a new Flow Template (V2 workflow definition).\n\n`POST /v2/flows/templates`\n\n```ts\nconst { data } = await client.createFlowTemplate(\n {\n enforce_limits: true,\n client_supports_adv_loops: true,\n },\n {\n id: 'string',\n org_id: 'string',\n name: 'string',\n description: 'string',\n portal_titles: {\n ecp: 'string',\n installer: 'string'\n },\n trigger: {\n type: 'automation',\n automation_id: 'g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg'\n },\n enabled: true,\n version: 2,\n created_at: '2021-04-27T12:01:13.000Z',\n updated_at: '2021-04-27T12:01:13.000Z',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: {\n duration: 0,\n unit: 'minutes',\n type: 'WORKFLOW_STARTED',\n task_id: 'string',\n phase_id: 'string'\n },\n assigned_to: ['string'],\n available_in_ecp: true,\n additional_triggers: [\n {\n id: 'string',\n type: 'manual',\n entity_schema: 'string'\n },\n {\n id: 'string',\n type: 'automation',\n automation_id: 'string',\n input_entity: 'thread',\n trigger_config: [ /* ... */ ],\n duplicated_automation_id: 'string'\n },\n /* ... 2 more */\n ],\n phases: [\n {\n id: 'string',\n name: 'string',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n assigned_to: ['string'],\n taxonomies: ['string']\n }\n ],\n stages: [\n {\n id: 'string',\n name: 'string',\n description: 'string',\n entry_node_id: 'string',\n cut_edge_ids: ['string'],\n color: 'string',\n portal_names: { /* ... */ },\n portal_descriptions: { /* ... */ }\n }\n ],\n tasks: [\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL'\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL',\n automation_config: { /* ... */ },\n on_failure: 'stop',\n trigger_mode: 'manual',\n schedule: { /* ... */ },\n created_automatically: false\n },\n /* ... 2 more */\n ],\n edges: [\n {\n id: 'string',\n from_id: 'string',\n to_id: 'string',\n condition_id: 'string',\n loop_id: 'string',\n none_met: true\n }\n ],\n closing_reasons: [\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n lastUpdateTime: 'string',\n creationTime: 'string'\n }\n ],\n entity_sync: [\n {\n trigger: { /* ... */ },\n target: { /* ... */ },\n value: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string'],\n linear: true,\n context_settings: {\n visibility: 'entity_views',\n main_context: {\n schema: 'string',\n relation_labels: ['string']\n },\n displays: [\n { /* ... */ }\n ]\n },\n limit_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n max: 0,\n current: 0,\n node_id: 'string',\n task_name: 'string',\n branch_name: 'string',\n param_name: 'string',\n path: [ /* ... */ ]\n }\n ],\n structural_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n node_id: 'string',\n edge_id: 'string',\n path: [ /* ... */ ]\n }\n ],\n keep_task_automations_in_sync: true,\n protected: true\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `searchFlowTemplates`\n\nSearch for flow templates by name, trigger type, enabled status, and more.\n\n`POST /v2/flows/templates:search`\n\n```ts\nconst { data } = await client.searchFlowTemplates(\n null,\n {\n name: 'string',\n definition_id: 'string',\n trigger_type: 'journey_submission',\n enabled: true,\n from: 0,\n size: 0,\n sort_by: 'updated_at',\n sort_order: 'desc'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"hits\": 0,\n \"results\": [\n {\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {},\n \"trigger\": {},\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [],\n \"phases\": [],\n \"stages\": [],\n \"tasks\": [],\n \"edges\": [],\n \"closing_reasons\": [],\n \"entity_sync\": [],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {},\n \"limit_warnings\": [],\n \"structural_warnings\": [],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n }\n ]\n}\n```\n\n
\n\n---\n\n### `getFlowTemplate`\n\nRetrieve a specific flow template by its unique identifier.\n\n`GET /v2/flows/templates/{flowId}`\n\n```ts\nconst { data } = await client.getFlowTemplate({\n flowId: 'example',\n skip_heal: true,\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `updateFlowTemplate`\n\nUpdate Flow Template.\n\n`PUT /v2/flows/templates/{flowId}`\n\n```ts\nconst { data } = await client.updateFlowTemplate(\n {\n flowId: 'example',\n enforce_limits: true,\n client_supports_adv_loops: true,\n },\n {\n id: 'string',\n org_id: 'string',\n name: 'string',\n description: 'string',\n portal_titles: {\n ecp: 'string',\n installer: 'string'\n },\n trigger: {\n type: 'automation',\n automation_id: 'g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg'\n },\n enabled: true,\n version: 2,\n created_at: '2021-04-27T12:01:13.000Z',\n updated_at: '2021-04-27T12:01:13.000Z',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: {\n duration: 0,\n unit: 'minutes',\n type: 'WORKFLOW_STARTED',\n task_id: 'string',\n phase_id: 'string'\n },\n assigned_to: ['string'],\n available_in_ecp: true,\n additional_triggers: [\n {\n id: 'string',\n type: 'manual',\n entity_schema: 'string'\n },\n {\n id: 'string',\n type: 'automation',\n automation_id: 'string',\n input_entity: 'thread',\n trigger_config: [ /* ... */ ],\n duplicated_automation_id: 'string'\n },\n /* ... 2 more */\n ],\n phases: [\n {\n id: 'string',\n name: 'string',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n assigned_to: ['string'],\n taxonomies: ['string']\n }\n ],\n stages: [\n {\n id: 'string',\n name: 'string',\n description: 'string',\n entry_node_id: 'string',\n cut_edge_ids: ['string'],\n color: 'string',\n portal_names: { /* ... */ },\n portal_descriptions: { /* ... */ }\n }\n ],\n tasks: [\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL'\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL',\n automation_config: { /* ... */ },\n on_failure: 'stop',\n trigger_mode: 'manual',\n schedule: { /* ... */ },\n created_automatically: false\n },\n /* ... 2 more */\n ],\n edges: [\n {\n id: 'string',\n from_id: 'string',\n to_id: 'string',\n condition_id: 'string',\n loop_id: 'string',\n none_met: true\n }\n ],\n closing_reasons: [\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n lastUpdateTime: 'string',\n creationTime: 'string'\n }\n ],\n entity_sync: [\n {\n trigger: { /* ... */ },\n target: { /* ... */ },\n value: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string'],\n linear: true,\n context_settings: {\n visibility: 'entity_views',\n main_context: {\n schema: 'string',\n relation_labels: ['string']\n },\n displays: [\n { /* ... */ }\n ]\n },\n limit_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n max: 0,\n current: 0,\n node_id: 'string',\n task_name: 'string',\n branch_name: 'string',\n param_name: 'string',\n path: [ /* ... */ ]\n }\n ],\n structural_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n node_id: 'string',\n edge_id: 'string',\n path: [ /* ... */ ]\n }\n ],\n keep_task_automations_in_sync: true,\n protected: true\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `deleteFlowTemplate`\n\nDelete Flow Template.\n\n`DELETE /v2/flows/templates/{flowId}`\n\n```ts\nconst { data } = await client.deleteFlowTemplate({\n flowId: 'example',\n})\n```\n\n---\n\n### `duplicateFlowTemplate`\n\nCreate a copy of an existing flow template. The duplicated template will have a new\nunique identifier and can be modified independently of the original. This is useful\nfor creating variations of exist\n\n`POST /v2/flows/templates/{flowId}/duplicate`\n\n```ts\nconst { data } = await client.duplicateFlowTemplate({\n flowId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `getDefinition`\n\nGet specific Definition by id from the Organization.\n\n`GET /v1/workflows/definitions/{definitionId}`\n\n```ts\nconst { data } = await client.getDefinition({\n definitionId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"order\": 0,\n \"type\": \"STEP\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"assignedTo\": [\"string\"],\n \"steps\": [],\n \"taxonomies\": [\"string\"]\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"executionType\": \"MANUAL\",\n \"automationConfig\": {},\n \"journey\": {},\n \"order\": 0,\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"userIds\": [0],\n \"requirements\": [],\n \"assignedTo\": [\"string\"],\n \"type\": \"STEP\",\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"taxonomies\": [\"string\"]\n }\n ],\n \"closingReasons\": [\n {\n \"id\": \"x739cew\"\n }\n ],\n \"updateEntityAttributes\": [\n {\n \"source\": \"workflow_status\",\n \"target\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n}\n```\n\n
\n\n---\n\n### `updateDefinition`\n\nUpdate Workflow Definition.\n\n`PUT /v1/workflows/definitions/{definitionId}`\n\n```ts\nconst { data } = await client.updateDefinition(\n {\n definitionId: 'example',\n },\n {\n id: 'string',\n name: 'string',\n description: 'string',\n creationTime: '2021-04-27T12:01:13.000Z',\n enabled: true,\n lastUpdateTime: '2021-04-27T12:01:13.000Z',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: {\n numberOfUnits: 0,\n timePeriod: 'minutes',\n actionTypeCondition: 'WORKFLOW_STARTED',\n stepId: 'string',\n phaseId: 'string'\n },\n userIds: [0],\n assignedTo: ['string'],\n enableECPWorkflow: true,\n flow: [\n {\n id: 'string',\n name: 'string',\n order: 0,\n type: 'STEP',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n assignedTo: ['string'],\n steps: [ /* ... */ ],\n taxonomies: ['string']\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n executionType: 'MANUAL',\n automationConfig: { /* ... */ },\n journey: { /* ... */ },\n order: 0,\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n userIds: [0],\n requirements: [ /* ... */ ],\n assignedTo: ['string'],\n type: 'STEP',\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n taxonomies: ['string']\n }\n ],\n closingReasons: [\n {\n id: 'x739cew'\n }\n ],\n updateEntityAttributes: [\n {\n source: 'workflow_status',\n target: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string']\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"order\": 0,\n \"type\": \"STEP\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"assignedTo\": [\"string\"],\n \"steps\": [],\n \"taxonomies\": [\"string\"]\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"executionType\": \"MANUAL\",\n \"automationConfig\": {},\n \"journey\": {},\n \"order\": 0,\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"userIds\": [0],\n \"requirements\": [],\n \"assignedTo\": [\"string\"],\n \"type\": \"STEP\",\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"taxonomies\": [\"string\"]\n }\n ],\n \"closingReasons\": [\n {\n \"id\": \"x739cew\"\n }\n ],\n \"updateEntityAttributes\": [\n {\n \"source\": \"workflow_status\",\n \"target\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n}\n```\n\n
\n\n---\n\n### `deleteDefinition`\n\nDelete Workflow Definition.\n\n`DELETE /v1/workflows/definitions/{definitionId}`\n\n```ts\nconst { data } = await client.deleteDefinition({\n definitionId: 'example',\n})\n```\n\n---\n\n### `getAllClosingReasons`\n\nGet all Closing Reasons defined in the organization by default all Active.\n\n`GET /v1/workflows/closing-reasons`\n\n```ts\nconst { data } = await client.getAllClosingReasons({\n includeInactive: true,\n})\n```\n\n
\nResponse\n\n```json\n{\n \"reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createClosingReason`\n\nA created Closing Reason is stored for the organization and will be displayed in the library of reasons.\n\n`POST /v1/workflows/closing-reasons`\n\n```ts\nconst { data } = await client.createClosingReason(\n null,\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n lastUpdateTime: 'string',\n creationTime: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `getClosingReason`\n\nGet specific closing reason by id from the organisation.\n\n`GET /v2/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.getClosingReason({\n reasonId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `updateClosingReason`\n\nUpdate an existing closing reason\n\n`PATCH /v2/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.updateClosingReason(\n {\n reasonId: 'example',\n },\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n lastUpdateTime: 'string',\n creationTime: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `deleteClosingReason`\n\nPermanently delete a closing reason (Using INACTIVE status is recommended instead)\n\n`DELETE /v2/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.deleteClosingReason({\n reasonId: 'example',\n})\n```\n\n---\n\n### `changeReasonStatus`\n\nChange the status of a Closing Reason (eg. ACTIVE to INACTIVE).\n\n`PATCH /v1/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.changeReasonStatus(\n {\n reasonId: 'example',\n },\n {\n status: 'ACTIVE'\n },\n)\n```\n\n---\n\n### `getWorkflowClosingReasons`\n\nReturns all closing reasons defined for the workflow.\n\n`GET /v1/workflows/definitions/{definitionId}/closing-reasons`\n\n```ts\nconst { data } = await client.getWorkflowClosingReasons({\n definitionId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"reasons\": [\n {\n \"id\": \"x739cew\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `setWorkflowClosingReasons`\n\nSets which closing reasons are defined for this workflow, based on the entire closing reasons catalog.\n\n`PATCH /v1/workflows/definitions/{definitionId}/closing-reasons`\n\n```ts\nconst { data } = await client.setWorkflowClosingReasons(\n {\n definitionId: 'example',\n },\n {\n reasons: [\n {\n id: 'x739cew'\n }\n ]\n },\n)\n```\n\n---\n\n## Schemas\n\n### `FlowTemplateBase`\n\nBase schema for V2 flow templates. A flow template defines the structure of a workflow\nincluding phases, tasks, edges, triggers, and other configuration. Flow templates serve\nas blueprints that can be instantiated as flow executions.\n\n\n```ts\ntype FlowTemplateBase = {\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: string\n installer?: string\n }\n trigger?: {\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }>\n phases?: Array<{\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n taxonomies?: string[]\n }>\n stages?: Array<{\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n // ...\n}\n```\n\n### `FlowLimitWarning`\n\nA configuration limit that the flow currently exceeds. Returned by the get-flow endpoint and by create/update responses so the UI can show a non-blocking banner. Size/count limit violations never cause a 400 — only structural errors do. The flow remains fully usable; users are encouraged to bring va\n\n```ts\ntype FlowLimitWarning = {\n i18nKey: string\n message: string\n max: number\n current?: number\n node_id?: string\n task_name?: string\n branch_name?: string\n param_name?: string\n path: unknown[]\n}\n```\n\n### `FlowStructuralWarning`\n\nA structural problem the flow has that does not block a save. Returned by the get-flow endpoint and by create/update responses. Today the only one is errors.loop_id_after_exit: a loop connection can be reached from its loop's exit branch, so leaving the loop leads back into it.\n\n```ts\ntype FlowStructuralWarning = {\n i18nKey: string\n message: string\n node_id?: string\n edge_id?: string\n path: unknown[]\n}\n```\n\n### `FlowTemplate`\n\n```ts\ntype FlowTemplate = {\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: string\n installer?: string\n }\n trigger?: {\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }>\n phases?: Array<{\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n taxonomies?: string[]\n }>\n stages?: Array<{\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n // ...\n}\n```\n\n### `Version`\n\nVersion of the workflow schema.\n\n- `v1` – *Deprecated*. The initial version of workflows with limited structure and automation capabilities.\n- `v2` – Linear workflows. Supports sequential task execution with basic automation triggers.\n- `v3` – Advanced workflows. Adds support for branching logic (co\n\n```ts\ntype Version = \"v1\" | \"v2\" | \"v3\"\n```\n\n### `Trigger`\n\n```ts\ntype Trigger = {\n id?: string\n type: \"manual\"\n entity_schema?: string\n} | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: string\n configuration?: Record\n }>\n duplicated_automation_id?: string\n} | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n} | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n}\n```\n\n### `ManualTrigger`\n\n```ts\ntype ManualTrigger = {\n id?: string\n type: \"manual\"\n entity_schema?: string\n}\n```\n\n### `AutomationTrigger`\n\n```ts\ntype AutomationTrigger = {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: string\n configuration?: Record\n }>\n duplicated_automation_id?: string\n}\n```\n\n### `JourneyAutomationTrigger`\n\n```ts\ntype JourneyAutomationTrigger = {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n}\n```\n\n### `JourneySubmissionTrigger`\n\n```ts\ntype JourneySubmissionTrigger = {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n}\n```\n\n### `CreateFlowTemplate`\n\n```ts\ntype CreateFlowTemplate = {\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: string\n installer?: string\n }\n trigger?: {\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }>\n phases?: Array<{\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n taxonomies?: string[]\n }>\n stages?: Array<{\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n // ...\n}\n```\n\n### `SearchFlowTemplates`\n\n```ts\ntype SearchFlowTemplates = {\n name?: string\n definition_id?: string\n trigger_type?: \"journey_submission\" | \"manual\" | \"automation\"\n enabled?: boolean\n from?: number\n size?: number\n sort_by?: \"created_at\" | \"updated_at\" | \"name\" | \"enabled\" | \"id\"\n sort_order?: \"asc\" | \"desc\"\n}\n```\n\n### `FlowTemplatesList`\n\n```ts\ntype FlowTemplatesList = {\n results: Array<{\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: { ... }\n installer?: { ... }\n }\n trigger?: {\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n automation_id?: { ... }\n input_entity?: { ... }\n trigger_config?: { ... }\n duplicated_automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n journey_id: { ... }\n journey_name?: { ... }\n automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n automation_id?: { ... }\n input_entity?: { ... }\n trigger_config?: { ... }\n duplicated_automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n journey_id: { ... }\n journey_name?: { ... }\n automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n }>\n phases?: Array<{\n id: { ... }\n name: { ... }\n due_date?: { ... }\n due_date_config?: { ... }\n assigned_to?: { ... }\n taxonomies?: { ... }\n }>\n stages?: Array<{\n id: { ... }\n name: { ... }\n description?: { ... }\n entry_node_id?: { ... }\n cut_edge_ids?: { ... }\n color?: { ... }\n portal_names?: { ... }\n portal_descriptions?: { ... }\n }>\n tasks: Array<{\n id: { ... }\n name: { ... }\n description?: { ... }\n journey?: { ... }\n due_date?: { ... }\n due_date_config?: { ... }\n start_date?: { ... }\n start_date_config?: { ... }\n requirements?: { ... }\n required?: { ... }\n // ...\n}\n```\n\n### `FlowTemplateId`\n\nShort unique id (length 8) to identify the Flow Template.\n\n```ts\ntype FlowTemplateId = string\n```\n\n### `Task`\n\n```ts\ntype Task = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n} | {\n id: string\n // ...\n}\n```\n\n### `ManualTask`\n\n```ts\ntype ManualTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n}\n```\n\n### `AutomationTask`\n\n```ts\ntype AutomationTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n automation_config: {\n flow_id?: string\n // ...\n}\n```\n\n### `AutomationFailurePolicy`\n\nWhat the flow does when this automation ends in a failed state. `stop` waits on the failed task until it is retried or skipped. `continue` proceeds to the next task. An absent value means `stop`.\n\n```ts\ntype AutomationFailurePolicy = \"stop\" | \"continue\"\n```\n\n### `AutomationConfig`\n\nConfiguration for automation execution to run\n\n```ts\ntype AutomationConfig = {\n flow_id?: string\n action_config?: {\n type: string\n config?: Record\n }\n duplicated_flow_id?: string\n input_context?: {\n source: \"main_context\" | \"task\" | \"trigger\"\n task_id?: string\n trigger_id?: string\n with_relations?: boolean\n also_pass?: Array<{\n source: { ... }\n } | {\n source: { ... }\n task_id: { ... }\n }>\n }\n output_context?: {\n set_as_primary?: boolean\n attach_to_contexts?: boolean\n }\n eligible_closing_reason_ids?: string[]\n email_review?: {\n enabled?: boolean\n allow_document_selection?: boolean\n allow_subject_and_body_edit?: boolean\n }\n allow_execution_note?: boolean\n}\n```\n\n### `EmailReviewConfig`\n\nWhether the person running a semi-automated send-email step may adjust the email before it goes out, and what they may adjust. Meaningful only on a task a person triggers — the engine's own dispatch has nobody to review — so the template healer clears it from an `automatic` task. With `enabled` fals\n\n```ts\ntype EmailReviewConfig = {\n enabled?: boolean\n allow_document_selection?: boolean\n allow_subject_and_body_edit?: boolean\n}\n```\n\n### `AutomationInputContext`\n\nOptional. Source of the entity fed into this automation task. If omitted, the run's current main context is used.\n\n\n```ts\ntype AutomationInputContext = {\n source: \"main_context\" | \"task\" | \"trigger\"\n task_id?: string\n trigger_id?: string\n with_relations?: boolean\n also_pass?: Array<{\n source: \"main_context\"\n } | {\n source: \"task\"\n task_id: string\n }>\n}\n```\n\n### `AutomationInputExtraContextRef`\n\nOne of the run's own entities. `main_context` = the run's current main context.\n\n\n```ts\ntype AutomationInputExtraContextRef = {\n source: \"main_context\"\n}\n```\n\n### `AutomationInputExtraTaskRef`\n\nEvery entity produced by an upstream task.\n\n```ts\ntype AutomationInputExtraTaskRef = {\n source: \"task\"\n task_id: string\n}\n```\n\n### `FlowContextSettings`\n\nWhere a flow runs, and where people see it.\nA run is ALWAYS visible on the entities it runs on — the entity its trigger supplied and every context it picks up. That is not configurable: it is what running there means, and hiding a run from its own entity is what `visibility: background` is for.\n`dis\n\n```ts\ntype FlowContextSettings = {\n visibility?: \"entity_views\" | \"background\"\n main_context?: {\n schema: string\n relation_labels?: string[]\n }\n displays?: Array<{\n id: string\n entity_schema: string\n from?: {\n role: { ... }\n } | {\n role: { ... }\n rule_id: { ... }\n }\n relation_labels?: string[]\n attach_to_contexts?: boolean\n }>\n}\n```\n\n### `MainContextSetting`\n\nWhich of a flow's contexts owns the run: the entity conditions, automations and entity sync resolve against by default.\nABSENT means the default — the primary trigger's entity. A flow has ONE main context, not one per trigger (STABLE360-13503): a run started by another trigger resolves the default a\n\n```ts\ntype MainContextSetting = {\n schema: string\n relation_labels?: string[]\n}\n```\n\n### `FlowDisplayRule`\n\nOne additional entity kind the flow should be visible on, found by relation from the main context or from an earlier entry.\nAn entity reached this way has no context of its own: it shows the main context's run, and acting on it acts on the main context. Nothing is copied and no second run starts.\nTh\n\n```ts\ntype FlowDisplayRule = {\n id: string\n entity_schema: string\n from?: {\n role: \"main_context\"\n } | {\n role: \"rule\"\n rule_id: string\n }\n relation_labels?: string[]\n attach_to_contexts?: boolean\n}\n```\n\n### `FlowRuleAnchor`\n\nWhere an entry starts looking. Absent means `main_context`.\nA ROLE, not a schema: an entry anchored on `main_context` follows the primary when a task promotes another entity, where naming a schema would freeze it on the old one.\n\n\n```ts\ntype FlowRuleAnchor = {\n role: \"main_context\"\n} | {\n role: \"rule\"\n rule_id: string\n}\n```\n\n### `MainContextAnchor`\n\nThe run's primary context, whatever it currently is.\n\n```ts\ntype MainContextAnchor = {\n role: \"main_context\"\n}\n```\n\n### `RuleAnchor`\n\nAn earlier entry in `displays`, by its id: this entry searches from whatever that one matched. Chaining ticket -> contact -> account this way keeps both hops DISPLAY-only; making the contact a real context first is a separate decision (`attach_to_contexts`), not a prerequisite for reaching the accou\n\n```ts\ntype RuleAnchor = {\n role: \"rule\"\n rule_id: string\n}\n```\n\n### `AutomationOutputContext`\n\nOptional. What happens to the entity produced by this automation task (the last successful entity-producing action of its automation).\n\n\n```ts\ntype AutomationOutputContext = {\n set_as_primary?: boolean\n attach_to_contexts?: boolean\n}\n```\n\n### `AiAgentTask`\n\n```ts\ntype AiAgentTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n agent_config?: {\n agent_id: string\n // ...\n}\n```\n\n### `AgentConfig`\n\nConfiguration for AI Agent to run\n\n```ts\ntype AgentConfig = {\n agent_id: string\n}\n```\n\n### `TriggerMode`\n\n```ts\ntype TriggerMode = \"manual\" | \"automatic\"\n```\n\n### `ActionSchedule`\n\n```ts\ntype ActionSchedule = {\n mode?: \"immediate\"\n} | {\n mode: \"delayed\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n} | {\n mode: \"relative\"\n direction: \"before\" | \"after\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n reference: {\n id: string\n origin: \"flow_started\" | \"task_completed\" | \"trigger_entity_attribute\" | \"all_preceding_tasks_completed\"\n schema?: string\n attribute?: string\n }\n}\n```\n\n### `ImmediateSchedule`\n\n```ts\ntype ImmediateSchedule = {\n mode?: \"immediate\"\n}\n```\n\n### `DelayedSchedule`\n\n```ts\ntype DelayedSchedule = {\n mode: \"delayed\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n}\n```\n\n### `RelativeSchedule`\n\n```ts\ntype RelativeSchedule = {\n mode: \"relative\"\n direction: \"before\" | \"after\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n reference: {\n id: string\n origin: \"flow_started\" | \"task_completed\" | \"trigger_entity_attribute\" | \"all_preceding_tasks_completed\"\n schema?: string\n attribute?: string\n }\n}\n```\n\n### `DecisionTask`\n\n```ts\ntype DecisionTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n trigger_mode: \"manual\" | \"automatic\"\n conditions: Array<{\n // ...\n}\n```\n\n### `LoopDefinition`\n\n```ts\ntype LoopDefinition = {\n entry_branch_ids: string[]\n exit_branch_id: string\n max_iterations: number\n}\n```\n\n### `TaskAudience`\n\nA task audience, named after the task field holding its description: co-workers (description), end customers (ecp), installers and partners.\n\n```ts\ntype TaskAudience = \"description\" | \"ecp\" | \"installer\" | \"partner\"\n```\n\n### `TaskBase`\n\n```ts\ntype TaskBase = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n}\n```\n\n### `Phase`\n\n```ts\ntype Phase = {\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n taxonomies?: string[]\n}\n```\n\n### `Stage`\n\nA customer-facing progress segment layered on top of the flow graph. Unlike phases (internal task grouping), stages exist to communicate progress to outside users (e.g. end customers) with a title and description. Stages form a strict total order; the array order is the boundary order and must match\n\n```ts\ntype Stage = {\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n portal_names?: {\n ecp?: string\n installer?: string\n }\n portal_descriptions?: {\n ecp?: string\n installer?: string\n }\n}\n```\n\n### `VariableAssignment`\n\nRepresents a variable assignment with its expression and optional resolved value. Used for dynamic user assignments that get resolved during workflow execution.\n\n```ts\ntype VariableAssignment = {\n variable: string\n value?: string[]\n}\n```\n\n### `TaskType`\n\n```ts\ntype TaskType = \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n```\n\n### `Edge`\n\n```ts\ntype Edge = {\n id: string\n from_id: string\n to_id?: string\n condition_id?: string\n loop_id?: string\n none_met?: boolean\n}\n```\n\n### `Condition`\n\n```ts\ntype Condition = {\n id: string\n branch_name: string\n logical_operator: \"AND\" | \"OR\"\n statements: Array<{\n id: string\n source: {\n id?: { ... }\n origin?: { ... }\n origin_type?: { ... }\n schema?: { ... }\n attribute?: { ... }\n attribute_type?: { ... }\n attribute_repeatable?: { ... }\n attribute_operation?: { ... }\n attributes?: { ... }\n attributes_match?: { ... }\n attribute_sub_field?: { ... }\n date_offset?: { ... }\n }\n operator: \"equals\" | \"not_equals\" | \"any_of\" | \"none_of\" | \"contains\" | \"not_contains\" | \"starts_with\" | \"ends_with\" | \"greater_than\" | \"less_than\" | \"greater_than_or_equals\" | \"less_than_or_equals\" | \"is_empty\" | \"is_not_empty\"\n values: string[]\n value_type?: \"static\" | \"relative_date\"\n }>\n}\n```\n\n### `Statement`\n\n```ts\ntype Statement = {\n id: string\n source: {\n id?: string\n origin?: \"trigger\" | \"action\" | \"flow_runtime\"\n origin_type?: \"entity\" | \"workflow\" | \"journey_block\" | \"trigger_source\" | \"main_context\" | \"flow_trait\"\n schema?: string\n attribute?: string\n attribute_type?: \"string\" | \"text\" | \"number\" | \"boolean\" | \"date\" | \"datetime\" | \"tags\" | \"country\" | \"email\" | \"phone\" | \"product\" | \"price\" | \"status\" | \"relation\" | \"multiselect\" | \"select\" | \"radio\" | \"relation_user\" | \"purpose\" | \"label\" | \"message_email_address\"\n attribute_repeatable?: boolean\n attribute_operation?: \"all\" | \"updated\" | \"added\" | \"deleted\"\n attributes?: string[]\n attributes_match?: \"any\" | \"all\"\n attribute_sub_field?: string\n date_offset?: {\n amount?: { ... }\n unit?: { ... }\n }\n }\n operator: \"equals\" | \"not_equals\" | \"any_of\" | \"none_of\" | \"contains\" | \"not_contains\" | \"starts_with\" | \"ends_with\" | \"greater_than\" | \"less_than\" | \"greater_than_or_equals\" | \"less_than_or_equals\" | \"is_empty\" | \"is_not_empty\"\n values: string[]\n value_type?: \"static\" | \"relative_date\"\n}\n```\n\n### `EvaluationSource`\n\n```ts\ntype EvaluationSource = {\n id?: string\n origin?: \"trigger\" | \"action\" | \"flow_runtime\"\n origin_type?: \"entity\" | \"workflow\" | \"journey_block\" | \"trigger_source\" | \"main_context\" | \"flow_trait\"\n schema?: string\n attribute?: string\n attribute_type?: \"string\" | \"text\" | \"number\" | \"boolean\" | \"date\" | \"datetime\" | \"tags\" | \"country\" | \"email\" | \"phone\" | \"product\" | \"price\" | \"status\" | \"relation\" | \"multiselect\" | \"select\" | \"radio\" | \"relation_user\" | \"purpose\" | \"label\" | \"message_email_address\"\n attribute_repeatable?: boolean\n attribute_operation?: \"all\" | \"updated\" | \"added\" | \"deleted\"\n attributes?: string[]\n attributes_match?: \"any\" | \"all\"\n attribute_sub_field?: string\n date_offset?: {\n amount?: number\n unit?: \"days\" | \"months\" | \"years\"\n }\n}\n```\n\n### `Operator`\n\n```ts\ntype Operator = \"equals\" | \"not_equals\" | \"any_of\" | \"none_of\" | \"contains\" | \"not_contains\" | \"starts_with\" | \"ends_with\" | \"greater_than\" | \"less_than\" | \"greater_than_or_equals\" | \"less_than_or_equals\" | \"is_empty\" | \"is_not_empty\"\n```\n\n### `DueDateConfig`\n\nSet due date for the task based on a dynamic condition. `START_DATE` counts from the task's own start date (AL-3678) and is valid only on a task that has a start date.\n\n```ts\ntype DueDateConfig = {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n}\n```\n\n### `StartDateConfig`\n\nRelative start date of a task (AL-3678): `duration` `unit` after the most recent occurrence of the reference event. `THIS_TASK_LAST_COMPLETED` is the task's own previous completion (a loop's earlier pass); there is no wait while the reference event has not happened. Durations are positive whole numb\n\n```ts\ntype StartDateConfig = {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n}\n```\n\n### `TimeUnit`\n\n```ts\ntype TimeUnit = \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n```\n\n### `EnableRequirement`\n\ndescribe the requirement for a task to be enabled\n\n```ts\ntype EnableRequirement = {\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n}\n```\n\n### `Subtask`\n\nOne checklist item of a task, derived from the checklist markup in the party descriptions. Identity is the stable data-subtask-id the editor mints into the markup.\n\n```ts\ntype Subtask = {\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n}\n```\n\n### `WorkflowDefinition`\n\nV1 workflow definition schema. Defines a linear workflow structure with sections\nand steps. Sections group related steps together, and steps represent individual\ntasks that need to be completed. This is the legacy workflow model; for new\nimplementations, consider using V2 flow templates instead.\n\n\n```ts\ntype WorkflowDefinition = {\n id?: string\n name: string\n description?: string\n creationTime?: string\n enabled?: boolean\n lastUpdateTime?: string\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n }\n userIds?: number[]\n assignedTo?: string[]\n enableECPWorkflow?: boolean\n flow: Array<{\n id?: string\n name: string\n order: number\n type: \"STEP\" | \"SECTION\"\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: { ... }\n timePeriod: { ... }\n actionTypeCondition: { ... }\n stepId?: { ... }\n phaseId?: { ... }\n }\n assignedTo?: string[]\n steps: Array<{\n id?: { ... }\n name: { ... }\n description?: { ... }\n executionType?: { ... }\n automationConfig?: { ... }\n journey?: { ... }\n order: { ... }\n dueDate?: { ... }\n dynamicDueDate?: { ... }\n userIds?: { ... }\n requirements?: { ... }\n assignedTo?: { ... }\n type: { ... }\n ecp?: { ... }\n installer?: { ... }\n partner?: { ... }\n taxonomies?: { ... }\n }>\n taxonomies?: string[]\n } | {\n id?: string\n name: string\n description?: {\n enabled?: { ... }\n value?: { ... }\n }\n executionType?: \"MANUAL\" | \"AUTOMATION\"\n automationConfig?: {\n flowId: { ... }\n }\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n order: number\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: { ... }\n timePeriod: { ... }\n actionTypeCondition: { ... }\n stepId?: { ... }\n phaseId?: { ... }\n }\n userIds?: number[]\n requirements?: Array<{\n definitionId: { ... }\n type: { ... }\n condition: { ... }\n }>\n assignedTo?: string[]\n type: \"STEP\" | \"SECTION\"\n ecp?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n journey?: { ... }\n }\n installer?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n // ...\n}\n```\n\n### `Step`\n\nAction that needs to be done in a Workflow\n\n```ts\ntype Step = {\n id?: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n executionType?: \"MANUAL\" | \"AUTOMATION\"\n automationConfig?: {\n flowId: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n order: number\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n }\n userIds?: number[]\n requirements?: Array<{\n definitionId: string\n type: \"STEP\" | \"SECTION\"\n condition: \"CLOSED\"\n }>\n assignedTo?: string[]\n type: \"STEP\" | \"SECTION\"\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n taxonomies?: string[]\n}\n```\n\n### `Section`\n\nA group of Steps that define the progress of the Workflow\n\n```ts\ntype Section = {\n id?: string\n name: string\n order: number\n type: \"STEP\" | \"SECTION\"\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n }\n assignedTo?: string[]\n steps: Array<{\n id?: string\n name: string\n description?: {\n enabled?: { ... }\n value?: { ... }\n }\n executionType?: \"MANUAL\" | \"AUTOMATION\"\n automationConfig?: {\n flowId: { ... }\n }\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n order: number\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: { ... }\n timePeriod: { ... }\n actionTypeCondition: { ... }\n stepId?: { ... }\n phaseId?: { ... }\n }\n userIds?: number[]\n requirements?: Array<{\n definitionId: { ... }\n type: { ... }\n condition: { ... }\n }>\n assignedTo?: string[]\n type: \"STEP\" | \"SECTION\"\n ecp?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n journey?: { ... }\n }\n installer?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n journey?: { ... }\n }\n partner?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n }\n taxonomies?: string[]\n }>\n taxonomies?: string[]\n}\n```\n\n### `TriggerType`\n\n```ts\ntype TriggerType = \"MANUAL\" | \"AUTOMATIC\"\n```\n\n### `ItemType`\n\n```ts\ntype ItemType = \"STEP\" | \"SECTION\"\n```\n\n### `StepType`\n\n```ts\ntype StepType = \"MANUAL\" | \"AUTOMATION\"\n```\n\n### `StepJourney`\n\n```ts\ntype StepJourney = {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: string\n value: string\n }>\n ai_prefill?: {\n enabled?: boolean\n source?: {\n type?: { ... }\n input_entity?: { ... }\n }\n extraction_fields?: Array<{\n key: { ... }\n type: { ... }\n description?: { ... }\n description_overridden?: { ... }\n enum?: { ... }\n }>\n mappings?: Array<{\n source: { ... }\n block_id: { ... }\n block_type: { ... }\n block_field?: { ... }\n country_code?: { ... }\n }>\n min_confidence?: number\n instructions?: string\n }\n}\n```\n\n### `AiPrefillConfig`\n\nAI extraction + prefill configuration for the attached journey (Flows v2 only)\n\n```ts\ntype AiPrefillConfig = {\n enabled?: boolean\n source?: {\n type?: \"flow_context\"\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n }\n extraction_fields?: Array<{\n key: string\n type: \"string\" | \"number\" | \"boolean\" | \"date\" | \"enum\"\n description?: string\n description_overridden?: boolean\n enum?: string[]\n }>\n mappings?: Array<{\n source: string\n block_id: string\n block_type: \"text-input\" | \"number-input\" | \"personal-information\" | \"meter-reading\" | \"contact\" | \"single-choice\" | \"date-input\" | \"binary-input\" | \"address\" | \"payment-method\" | \"multiple-choice\" | \"availability-check\"\n block_field?: string\n country_code?: string\n }>\n min_confidence?: number\n instructions?: string\n}\n```\n\n### `AiPrefillExtractionField`\n\n```ts\ntype AiPrefillExtractionField = {\n key: string\n type: \"string\" | \"number\" | \"boolean\" | \"date\" | \"enum\"\n description?: string\n description_overridden?: boolean\n enum?: string[]\n}\n```\n\n### `AiPrefillMapping`\n\n```ts\ntype AiPrefillMapping = {\n source: string\n block_id: string\n block_type: \"text-input\" | \"number-input\" | \"personal-information\" | \"meter-reading\" | \"contact\" | \"single-choice\" | \"date-input\" | \"binary-input\" | \"address\" | \"payment-method\" | \"multiple-choice\" | \"availability-check\"\n block_field?: string\n country_code?: string\n}\n```\n\n### `JourneyContextParameter`\n\n```ts\ntype JourneyContextParameter = {\n key: string\n value: string\n}\n```\n\n### `ECPDetails`\n\nDetails regarding ECP for the workflow step\n\n```ts\ntype ECPDetails = {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n}\n```\n\n### `PartnerDetails`\n\nDetails regarding partner for the workflow step\n\n```ts\ntype PartnerDetails = {\n enabled?: boolean\n label?: string\n description?: string\n}\n```\n\n### `StepDescription`\n\nLonger information regarding Task\n\n```ts\ntype StepDescription = {\n enabled?: boolean\n value?: string\n}\n```\n\n### `MaxAllowedLimit`\n\n```ts\ntype MaxAllowedLimit = {\n currentNoOfWorkflows?: number\n maxAllowed?: number\n}\n```\n\n### `DefinitionNotFoundResp`\n\nError response returned when a workflow definition or flow template is not found.\n\n```ts\ntype DefinitionNotFoundResp = {\n message?: string\n}\n```\n\n### `ClosingReasonNotFoundResp`\n\nError response returned when a closing reason is not found.\n\n```ts\ntype ClosingReasonNotFoundResp = {\n message?: string\n}\n```\n\n### `ChangeReasonStatusReq`\n\n```ts\ntype ChangeReasonStatusReq = {\n status: \"ACTIVE\" | \"INACTIVE\"\n}\n```\n\n### `ClosingReasons`\n\n```ts\ntype ClosingReasons = {\n reasons: Array<{\n id?: string\n title?: string\n status?: \"ACTIVE\" | \"INACTIVE\"\n lastUpdateTime?: string\n creationTime?: string\n }>\n}\n```\n\n### `ClosingReason`\n\nOne Closing reason for a workflow\n\n```ts\ntype ClosingReason = {\n id?: string\n title?: string\n status?: \"ACTIVE\" | \"INACTIVE\"\n lastUpdateTime?: string\n creationTime?: string\n}\n```\n\n### `ClosingReasonsStatus`\n\n```ts\ntype ClosingReasonsStatus = \"ACTIVE\" | \"INACTIVE\"\n```\n\n### `ClosingReasonsIds`\n\n```ts\ntype ClosingReasonsIds = {\n reasons: Array<{\n id: string\n }>\n}\n```\n\n### `ClosingReasonId`\n\n```ts\ntype ClosingReasonId = {\n id: string\n}\n```\n\n### `ErrorResp`\n\nStandard error response returned when an API request fails.\n\n```ts\ntype ErrorResp = {\n message?: string\n}\n```\n\n### `UpdateEntityAttributes`\n\n```ts\ntype UpdateEntityAttributes = {\n source: \"workflow_status\" | \"current_section\" | \"current_step\"\n target: {\n entitySchema: string\n entityAttribute: string\n }\n}\n```\n\n### `EntitySync`\n\n```ts\ntype EntitySync = {\n trigger: {\n event: \"FlowStarted\" | \"FlowCompleted\" | \"FlowCancelled\" | \"FlowReopened\" | \"FlowDeleted\" | \"FlowAssigned\" | \"FlowDueDateChanged\" | \"FlowContextsChanged\" | \"TaskUpdated\" | \"CurrTaskChanged\" | \"TaskCompleted\" | \"TaskSkipped\" | \"TaskMarkedInProgress\" | \"TaskMarkedOnHold\" | \"PhaseUpdated\" | \"PhaseCompleted\" | \"PhaseSkipped\" | \"PhaseMarkedInProgress\"\n filter?: {\n task_template_id?: { ... }\n phase_template_id?: { ... }\n }\n }\n value: {\n source: \"workflow_name\" | \"workflow_status\" | \"workflow_assigned_to\" | \"task_name\" | \"task_status\" | \"task_assigned_to\" | \"phase_name\" | \"phase_status\" | \"phase_assigned_to\" | \"custom_value\"\n value?: string\n }\n target: {\n entitySchema: string\n entityAttribute: string\n }\n}\n```\n\n### `DynamicDueDate`\n\nConfiguration for calculating a due date dynamically based on workflow events.\nThe due date is computed by adding a duration (numberOfUnits + timePeriod) to\na reference point defined by actionTypeCondition (e.g., when workflow started,\nwhen a step closed, or when a phase finished).\n\n\n```ts\ntype DynamicDueDate = {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n}\n```\n\n### `StepRequirement`\n\ndescribe the requirement for step enablement\n\n```ts\ntype StepRequirement = {\n definitionId: string\n type: \"STEP\" | \"SECTION\"\n condition: \"CLOSED\"\n}\n```\n\n### `JourneyContextUsagesReq`\n\nRequest payload for getJourneyContextUsages.\n\n```ts\ntype JourneyContextUsagesReq = {\n journey_id: string\n param_keys: string[]\n param_ids?: string[]\n}\n```\n\n### `JourneyContextUsage`\n\nOne place a flow template task presets one of the requested context parameters.\n\n```ts\ntype JourneyContextUsage = {\n kind: \"workflow-task\"\n resource: {\n type: \"workflow_template\"\n id: string\n name?: string\n }\n location?: {\n task_id?: string\n task_name?: string\n }\n matched_as: {\n dialect: \"name\"\n token: string\n at: string\n }\n link_hint?: {\n route: \"workflows-hub-flow\"\n params: {\n template_id: { ... }\n }\n }\n}\n```\n\n### `JourneyContextUsagesResp`\n\nResponse payload for getJourneyContextUsages.\n\n```ts\ntype JourneyContextUsagesResp = {\n usages: Array<{\n kind: \"workflow-task\"\n resource: {\n type: { ... }\n id: { ... }\n name?: { ... }\n }\n location?: {\n task_id?: { ... }\n task_name?: { ... }\n }\n matched_as: {\n dialect: { ... }\n token: { ... }\n at: { ... }\n }\n link_hint?: {\n route: { ... }\n params: { ... }\n }\n }>\n status: \"ok\" | \"partial\"\n scanned: number\n}\n```\n" +"# Workflows Definitions\n\n- **Base URL:** `https://workflows-definition.sls.epilot.io`\n- **Full API Docs:** [https://docs.epilot.io/api/workflow-definition](https://docs.epilot.io/api/workflow-definition)\n\n## Usage\n\n```ts\nimport { epilot } from '@epilot/sdk'\n\nepilot.authorize(() => '')\nconst { data } = await epilot.workflowDefinition.getMaxAllowedLimit(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from '@epilot/sdk/workflow-definition'\n\nconst workflowDefinitionClient = getClient()\nauthorize(workflowDefinitionClient, () => '')\nconst { data } = await workflowDefinitionClient.getMaxAllowedLimit(...)\n```\n\n## Operations\n\n**Workflows**\n- [`getMaxAllowedLimit`](#getmaxallowedlimit)\n- [`getDefinitions`](#getdefinitions)\n- [`createDefinition`](#createdefinition)\n- [`getDefinition`](#getdefinition)\n- [`updateDefinition`](#updatedefinition)\n- [`deleteDefinition`](#deletedefinition)\n- [`getWorkflowClosingReasons`](#getworkflowclosingreasons)\n- [`setWorkflowClosingReasons`](#setworkflowclosingreasons)\n\n**Flows V2**\n- [`listFlowTemplates`](#listflowtemplates)\n- [`createFlowTemplate`](#createflowtemplate)\n- [`searchFlowTemplates`](#searchflowtemplates)\n- [`getFlowTemplate`](#getflowtemplate)\n- [`updateFlowTemplate`](#updateflowtemplate)\n- [`deleteFlowTemplate`](#deleteflowtemplate)\n- [`duplicateFlowTemplate`](#duplicateflowtemplate)\n\n**Closing Reason**\n- [`getAllClosingReasons`](#getallclosingreasons)\n- [`createClosingReason`](#createclosingreason)\n- [`getClosingReason`](#getclosingreason)\n- [`updateClosingReason`](#updateclosingreason)\n- [`deleteClosingReason`](#deleteclosingreason)\n- [`changeReasonStatus`](#changereasonstatus)\n- [`getAllClosingReasonCategories`](#getallclosingreasoncategories)\n- [`createClosingReasonCategory`](#createclosingreasoncategory)\n- [`getClosingReasonCategory`](#getclosingreasoncategory)\n- [`updateClosingReasonCategory`](#updateclosingreasoncategory)\n- [`deleteClosingReasonCategory`](#deleteclosingreasoncategory)\n\n**Schemas**\n- [`FlowTemplateBase`](#flowtemplatebase)\n- [`FlowLimitWarning`](#flowlimitwarning)\n- [`FlowStructuralWarning`](#flowstructuralwarning)\n- [`FlowTemplate`](#flowtemplate)\n- [`Version`](#version)\n- [`Trigger`](#trigger)\n- [`ManualTrigger`](#manualtrigger)\n- [`AutomationTrigger`](#automationtrigger)\n- [`JourneyAutomationTrigger`](#journeyautomationtrigger)\n- [`JourneySubmissionTrigger`](#journeysubmissiontrigger)\n- [`CreateFlowTemplate`](#createflowtemplate)\n- [`SearchFlowTemplates`](#searchflowtemplates)\n- [`FlowTemplatesList`](#flowtemplateslist)\n- [`FlowTemplateId`](#flowtemplateid)\n- [`Task`](#task)\n- [`ManualTask`](#manualtask)\n- [`AutomationTask`](#automationtask)\n- [`AutomationFailurePolicy`](#automationfailurepolicy)\n- [`AutomationConfig`](#automationconfig)\n- [`EmailReviewConfig`](#emailreviewconfig)\n- [`AutomationInputContext`](#automationinputcontext)\n- [`AutomationInputExtraContextRef`](#automationinputextracontextref)\n- [`AutomationInputExtraTaskRef`](#automationinputextrataskref)\n- [`FlowContextSettings`](#flowcontextsettings)\n- [`MainContextSetting`](#maincontextsetting)\n- [`FlowDisplayRule`](#flowdisplayrule)\n- [`FlowRuleAnchor`](#flowruleanchor)\n- [`MainContextAnchor`](#maincontextanchor)\n- [`RuleAnchor`](#ruleanchor)\n- [`AutomationOutputContext`](#automationoutputcontext)\n- [`AiAgentTask`](#aiagenttask)\n- [`AgentConfig`](#agentconfig)\n- [`TriggerMode`](#triggermode)\n- [`ActionSchedule`](#actionschedule)\n- [`ImmediateSchedule`](#immediateschedule)\n- [`DelayedSchedule`](#delayedschedule)\n- [`RelativeSchedule`](#relativeschedule)\n- [`DecisionTask`](#decisiontask)\n- [`LoopDefinition`](#loopdefinition)\n- [`TaskAudience`](#taskaudience)\n- [`TaskBase`](#taskbase)\n- [`Phase`](#phase)\n- [`Stage`](#stage)\n- [`VariableAssignment`](#variableassignment)\n- [`TaskType`](#tasktype)\n- [`Edge`](#edge)\n- [`Condition`](#condition)\n- [`Statement`](#statement)\n- [`EvaluationSource`](#evaluationsource)\n- [`Operator`](#operator)\n- [`DueDateConfig`](#duedateconfig)\n- [`StartDateConfig`](#startdateconfig)\n- [`TimeUnit`](#timeunit)\n- [`EnableRequirement`](#enablerequirement)\n- [`Subtask`](#subtask)\n- [`WorkflowDefinition`](#workflowdefinition)\n- [`Step`](#step)\n- [`Section`](#section)\n- [`TriggerType`](#triggertype)\n- [`ItemType`](#itemtype)\n- [`StepType`](#steptype)\n- [`StepJourney`](#stepjourney)\n- [`AiPrefillConfig`](#aiprefillconfig)\n- [`AiPrefillExtractionField`](#aiprefillextractionfield)\n- [`AiPrefillMapping`](#aiprefillmapping)\n- [`JourneyContextParameter`](#journeycontextparameter)\n- [`ECPDetails`](#ecpdetails)\n- [`PartnerDetails`](#partnerdetails)\n- [`StepDescription`](#stepdescription)\n- [`MaxAllowedLimit`](#maxallowedlimit)\n- [`DefinitionNotFoundResp`](#definitionnotfoundresp)\n- [`ClosingReasonNotFoundResp`](#closingreasonnotfoundresp)\n- [`ChangeReasonStatusReq`](#changereasonstatusreq)\n- [`ClosingReasons`](#closingreasons)\n- [`ClosingReason`](#closingreason)\n- [`ClosingReasonCategoryRef`](#closingreasoncategoryref)\n- [`ClosingReasonCategories`](#closingreasoncategories)\n- [`ClosingReasonCategory`](#closingreasoncategory)\n- [`ClosingReasonCategoryPayload`](#closingreasoncategorypayload)\n- [`ClosingReasonCategoryNotFoundResp`](#closingreasoncategorynotfoundresp)\n- [`ClosingReasonsStatus`](#closingreasonsstatus)\n- [`ClosingReasonsIds`](#closingreasonsids)\n- [`ClosingReasonId`](#closingreasonid)\n- [`ErrorResp`](#errorresp)\n- [`UpdateEntityAttributes`](#updateentityattributes)\n- [`EntitySync`](#entitysync)\n- [`DynamicDueDate`](#dynamicduedate)\n- [`StepRequirement`](#steprequirement)\n- [`JourneyContextUsagesReq`](#journeycontextusagesreq)\n- [`JourneyContextUsage`](#journeycontextusage)\n- [`JourneyContextUsagesResp`](#journeycontextusagesresp)\n\n### `getMaxAllowedLimit`\n\nGet limits and number of created executions for an Organization.\n\n`GET /v1/workflows/limits/max-allowed`\n\n```ts\nconst { data } = await client.getMaxAllowedLimit()\n```\n\n
\nResponse\n\n```json\n{\n \"currentNoOfWorkflows\": 0,\n \"maxAllowed\": 0\n}\n```\n\n
\n\n---\n\n### `getDefinitions`\n\nRetrieve all V1 workflow definitions belonging to the authenticated organization.\n\n`GET /v1/workflows/definitions`\n\n```ts\nconst { data } = await client.getDefinitions()\n```\n\n
\nResponse\n\n```json\n[\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {},\n {}\n ],\n \"closingReasons\": [\n {}\n ],\n \"updateEntityAttributes\": [\n {}\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n }\n]\n```\n\n
\n\n---\n\n### `createDefinition`\n\nCreate a new V1 workflow definition. The definition consists of sections and steps\nthat define the structure of the workflow. Once created, the definition can be used\nto start workflow executions.\n\n`POST /v1/workflows/definitions`\n\n```ts\nconst { data } = await client.createDefinition(\n null,\n {\n id: 'string',\n name: 'string',\n description: 'string',\n creationTime: '2021-04-27T12:01:13.000Z',\n enabled: true,\n lastUpdateTime: '2021-04-27T12:01:13.000Z',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: {\n numberOfUnits: 0,\n timePeriod: 'minutes',\n actionTypeCondition: 'WORKFLOW_STARTED',\n stepId: 'string',\n phaseId: 'string'\n },\n userIds: [0],\n assignedTo: ['string'],\n enableECPWorkflow: true,\n flow: [\n {\n id: 'string',\n name: 'string',\n order: 0,\n type: 'STEP',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n assignedTo: ['string'],\n steps: [ /* ... */ ],\n taxonomies: ['string']\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n executionType: 'MANUAL',\n automationConfig: { /* ... */ },\n journey: { /* ... */ },\n order: 0,\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n userIds: [0],\n requirements: [ /* ... */ ],\n assignedTo: ['string'],\n type: 'STEP',\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n taxonomies: ['string']\n }\n ],\n closingReasons: [\n {\n id: 'x739cew'\n }\n ],\n updateEntityAttributes: [\n {\n source: 'workflow_status',\n target: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string']\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"order\": 0,\n \"type\": \"STEP\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"assignedTo\": [\"string\"],\n \"steps\": [],\n \"taxonomies\": [\"string\"]\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"executionType\": \"MANUAL\",\n \"automationConfig\": {},\n \"journey\": {},\n \"order\": 0,\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"userIds\": [0],\n \"requirements\": [],\n \"assignedTo\": [\"string\"],\n \"type\": \"STEP\",\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"taxonomies\": [\"string\"]\n }\n ],\n \"closingReasons\": [\n {\n \"id\": \"x739cew\"\n }\n ],\n \"updateEntityAttributes\": [\n {\n \"source\": \"workflow_status\",\n \"target\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n}\n```\n\n
\n\n---\n\n### `listFlowTemplates`\n\nList all Flow Templates for a customer. Optionally, you can filter flow templates by trigger values.\n\n`GET /v2/flows/templates`\n\n```ts\nconst { data } = await client.listFlowTemplates({\n trigger_type: 'example',\n trigger_source_id: 'example',\n trigger_schema: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"results\": [\n {\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {},\n \"trigger\": {},\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [],\n \"phases\": [],\n \"stages\": [],\n \"tasks\": [],\n \"edges\": [],\n \"closing_reasons\": [],\n \"entity_sync\": [],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {},\n \"limit_warnings\": [],\n \"structural_warnings\": [],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createFlowTemplate`\n\nCreate a new Flow Template (V2 workflow definition).\n\n`POST /v2/flows/templates`\n\n```ts\nconst { data } = await client.createFlowTemplate(\n {\n enforce_limits: true,\n client_supports_adv_loops: true,\n },\n {\n id: 'string',\n org_id: 'string',\n name: 'string',\n description: 'string',\n portal_titles: {\n ecp: 'string',\n installer: 'string'\n },\n trigger: {\n type: 'automation',\n automation_id: 'g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg'\n },\n enabled: true,\n version: 2,\n created_at: '2021-04-27T12:01:13.000Z',\n updated_at: '2021-04-27T12:01:13.000Z',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: {\n duration: 0,\n unit: 'minutes',\n type: 'WORKFLOW_STARTED',\n task_id: 'string',\n phase_id: 'string'\n },\n assigned_to: ['string'],\n available_in_ecp: true,\n additional_triggers: [\n {\n id: 'string',\n type: 'manual',\n entity_schema: 'string'\n },\n {\n id: 'string',\n type: 'automation',\n automation_id: 'string',\n input_entity: 'thread',\n trigger_config: [ /* ... */ ],\n duplicated_automation_id: 'string'\n },\n /* ... 2 more */\n ],\n phases: [\n {\n id: 'string',\n name: 'string',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n assigned_to: ['string'],\n taxonomies: ['string']\n }\n ],\n stages: [\n {\n id: 'string',\n name: 'string',\n description: 'string',\n entry_node_id: 'string',\n cut_edge_ids: ['string'],\n color: 'string',\n portal_names: { /* ... */ },\n portal_descriptions: { /* ... */ }\n }\n ],\n tasks: [\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL'\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL',\n automation_config: { /* ... */ },\n on_failure: 'stop',\n trigger_mode: 'manual',\n schedule: { /* ... */ },\n created_automatically: false\n },\n /* ... 2 more */\n ],\n edges: [\n {\n id: 'string',\n from_id: 'string',\n to_id: 'string',\n condition_id: 'string',\n loop_id: 'string',\n none_met: true\n }\n ],\n closing_reasons: [\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n categoryId: 'c9wq81x',\n category: { /* ... */ },\n lastUpdateTime: 'string',\n creationTime: 'string'\n }\n ],\n entity_sync: [\n {\n trigger: { /* ... */ },\n target: { /* ... */ },\n value: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string'],\n linear: true,\n context_settings: {\n visibility: 'entity_views',\n main_context: {\n schema: 'string',\n relation_labels: ['string']\n },\n displays: [\n { /* ... */ }\n ]\n },\n limit_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n max: 0,\n current: 0,\n node_id: 'string',\n task_name: 'string',\n branch_name: 'string',\n param_name: 'string',\n path: [ /* ... */ ]\n }\n ],\n structural_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n node_id: 'string',\n edge_id: 'string',\n path: [ /* ... */ ]\n }\n ],\n keep_task_automations_in_sync: true,\n protected: true\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {},\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `searchFlowTemplates`\n\nSearch for flow templates by name, trigger type, enabled status, and more.\n\n`POST /v2/flows/templates:search`\n\n```ts\nconst { data } = await client.searchFlowTemplates(\n null,\n {\n name: 'string',\n definition_id: 'string',\n trigger_type: 'journey_submission',\n enabled: true,\n from: 0,\n size: 0,\n sort_by: 'updated_at',\n sort_order: 'desc'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"hits\": 0,\n \"results\": [\n {\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {},\n \"trigger\": {},\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [],\n \"phases\": [],\n \"stages\": [],\n \"tasks\": [],\n \"edges\": [],\n \"closing_reasons\": [],\n \"entity_sync\": [],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {},\n \"limit_warnings\": [],\n \"structural_warnings\": [],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n }\n ]\n}\n```\n\n
\n\n---\n\n### `getFlowTemplate`\n\nRetrieve a specific flow template by its unique identifier.\n\n`GET /v2/flows/templates/{flowId}`\n\n```ts\nconst { data } = await client.getFlowTemplate({\n flowId: 'example',\n skip_heal: true,\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {},\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `updateFlowTemplate`\n\nUpdate Flow Template.\n\n`PUT /v2/flows/templates/{flowId}`\n\n```ts\nconst { data } = await client.updateFlowTemplate(\n {\n flowId: 'example',\n enforce_limits: true,\n client_supports_adv_loops: true,\n },\n {\n id: 'string',\n org_id: 'string',\n name: 'string',\n description: 'string',\n portal_titles: {\n ecp: 'string',\n installer: 'string'\n },\n trigger: {\n type: 'automation',\n automation_id: 'g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg'\n },\n enabled: true,\n version: 2,\n created_at: '2021-04-27T12:01:13.000Z',\n updated_at: '2021-04-27T12:01:13.000Z',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: {\n duration: 0,\n unit: 'minutes',\n type: 'WORKFLOW_STARTED',\n task_id: 'string',\n phase_id: 'string'\n },\n assigned_to: ['string'],\n available_in_ecp: true,\n additional_triggers: [\n {\n id: 'string',\n type: 'manual',\n entity_schema: 'string'\n },\n {\n id: 'string',\n type: 'automation',\n automation_id: 'string',\n input_entity: 'thread',\n trigger_config: [ /* ... */ ],\n duplicated_automation_id: 'string'\n },\n /* ... 2 more */\n ],\n phases: [\n {\n id: 'string',\n name: 'string',\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n assigned_to: ['string'],\n taxonomies: ['string']\n }\n ],\n stages: [\n {\n id: 'string',\n name: 'string',\n description: 'string',\n entry_node_id: 'string',\n cut_edge_ids: ['string'],\n color: 'string',\n portal_names: { /* ... */ },\n portal_descriptions: { /* ... */ }\n }\n ],\n tasks: [\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL'\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n journey: { /* ... */ },\n due_date: '2021-04-27T12:00:00.000Z',\n due_date_config: { /* ... */ },\n start_date: '2021-04-27T12:00:00.000Z',\n start_date_config: { /* ... */ },\n requirements: [ /* ... */ ],\n required: false,\n only_assignee_can_complete: true,\n subtasks: [ /* ... */ ],\n assigned_to: ['string'],\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n audience_order: ['description'],\n taxonomies: ['string'],\n phase_id: 'string',\n task_type: 'MANUAL',\n automation_config: { /* ... */ },\n on_failure: 'stop',\n trigger_mode: 'manual',\n schedule: { /* ... */ },\n created_automatically: false\n },\n /* ... 2 more */\n ],\n edges: [\n {\n id: 'string',\n from_id: 'string',\n to_id: 'string',\n condition_id: 'string',\n loop_id: 'string',\n none_met: true\n }\n ],\n closing_reasons: [\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n categoryId: 'c9wq81x',\n category: { /* ... */ },\n lastUpdateTime: 'string',\n creationTime: 'string'\n }\n ],\n entity_sync: [\n {\n trigger: { /* ... */ },\n target: { /* ... */ },\n value: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string'],\n linear: true,\n context_settings: {\n visibility: 'entity_views',\n main_context: {\n schema: 'string',\n relation_labels: ['string']\n },\n displays: [\n { /* ... */ }\n ]\n },\n limit_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n max: 0,\n current: 0,\n node_id: 'string',\n task_name: 'string',\n branch_name: 'string',\n param_name: 'string',\n path: [ /* ... */ ]\n }\n ],\n structural_warnings: [\n {\n i18nKey: 'string',\n message: 'string',\n node_id: 'string',\n edge_id: 'string',\n path: [ /* ... */ ]\n }\n ],\n keep_task_automations_in_sync: true,\n protected: true\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {},\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `deleteFlowTemplate`\n\nDelete Flow Template.\n\n`DELETE /v2/flows/templates/{flowId}`\n\n```ts\nconst { data } = await client.deleteFlowTemplate({\n flowId: 'example',\n})\n```\n\n---\n\n### `duplicateFlowTemplate`\n\nCreate a copy of an existing flow template. The duplicated template will have a new\nunique identifier and can be modified independently of the original. This is useful\nfor creating variations of exist\n\n`POST /v2/flows/templates/{flowId}/duplicate`\n\n```ts\nconst { data } = await client.duplicateFlowTemplate({\n flowId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"org_id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"portal_titles\": {\n \"ecp\": \"string\",\n \"installer\": \"string\"\n },\n \"trigger\": {\n \"type\": \"automation\",\n \"automation_id\": \"g92j2-sg9ug92hjt1gh-9s9gajgs-a979gg\"\n },\n \"enabled\": true,\n \"version\": 2,\n \"created_at\": \"2021-04-27T12:01:13.000Z\",\n \"updated_at\": \"2021-04-27T12:01:13.000Z\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {\n \"duration\": 0,\n \"unit\": \"minutes\",\n \"type\": \"WORKFLOW_STARTED\",\n \"task_id\": \"string\",\n \"phase_id\": \"string\"\n },\n \"assigned_to\": [\"string\"],\n \"available_in_ecp\": true,\n \"additional_triggers\": [\n {\n \"id\": \"string\",\n \"type\": \"manual\",\n \"entity_schema\": \"string\"\n },\n {\n \"id\": \"string\",\n \"type\": \"automation\",\n \"automation_id\": \"string\",\n \"input_entity\": \"thread\",\n \"trigger_config\": [],\n \"duplicated_automation_id\": \"string\"\n }\n ],\n \"phases\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"assigned_to\": [\"string\"],\n \"taxonomies\": [\"string\"]\n }\n ],\n \"stages\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"entry_node_id\": \"string\",\n \"cut_edge_ids\": [\"string\"],\n \"color\": \"string\",\n \"portal_names\": {},\n \"portal_descriptions\": {}\n }\n ],\n \"tasks\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\"\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"journey\": {},\n \"due_date\": \"2021-04-27T12:00:00.000Z\",\n \"due_date_config\": {},\n \"start_date\": \"2021-04-27T12:00:00.000Z\",\n \"start_date_config\": {},\n \"requirements\": [],\n \"required\": false,\n \"only_assignee_can_complete\": true,\n \"subtasks\": [],\n \"assigned_to\": [\"string\"],\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"audience_order\": [\"description\"],\n \"taxonomies\": [\"string\"],\n \"phase_id\": \"string\",\n \"task_type\": \"MANUAL\",\n \"automation_config\": {},\n \"on_failure\": \"stop\",\n \"trigger_mode\": \"manual\",\n \"schedule\": {},\n \"created_automatically\": false\n }\n ],\n \"edges\": [\n {\n \"id\": \"string\",\n \"from_id\": \"string\",\n \"to_id\": \"string\",\n \"condition_id\": \"string\",\n \"loop_id\": \"string\",\n \"none_met\": true\n }\n ],\n \"closing_reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {},\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ],\n \"entity_sync\": [\n {\n \"trigger\": {},\n \"target\": {},\n \"value\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"],\n \"linear\": true,\n \"context_settings\": {\n \"visibility\": \"entity_views\",\n \"main_context\": {\n \"schema\": \"string\",\n \"relation_labels\": [\"string\"]\n },\n \"displays\": [\n {}\n ]\n },\n \"limit_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"max\": 0,\n \"current\": 0,\n \"node_id\": \"string\",\n \"task_name\": \"string\",\n \"branch_name\": \"string\",\n \"param_name\": \"string\",\n \"path\": []\n }\n ],\n \"structural_warnings\": [\n {\n \"i18nKey\": \"string\",\n \"message\": \"string\",\n \"node_id\": \"string\",\n \"edge_id\": \"string\",\n \"path\": []\n }\n ],\n \"keep_task_automations_in_sync\": true,\n \"protected\": true\n}\n```\n\n
\n\n---\n\n### `getDefinition`\n\nGet specific Definition by id from the Organization.\n\n`GET /v1/workflows/definitions/{definitionId}`\n\n```ts\nconst { data } = await client.getDefinition({\n definitionId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"order\": 0,\n \"type\": \"STEP\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"assignedTo\": [\"string\"],\n \"steps\": [],\n \"taxonomies\": [\"string\"]\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"executionType\": \"MANUAL\",\n \"automationConfig\": {},\n \"journey\": {},\n \"order\": 0,\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"userIds\": [0],\n \"requirements\": [],\n \"assignedTo\": [\"string\"],\n \"type\": \"STEP\",\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"taxonomies\": [\"string\"]\n }\n ],\n \"closingReasons\": [\n {\n \"id\": \"x739cew\"\n }\n ],\n \"updateEntityAttributes\": [\n {\n \"source\": \"workflow_status\",\n \"target\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n}\n```\n\n
\n\n---\n\n### `updateDefinition`\n\nUpdate Workflow Definition.\n\n`PUT /v1/workflows/definitions/{definitionId}`\n\n```ts\nconst { data } = await client.updateDefinition(\n {\n definitionId: 'example',\n },\n {\n id: 'string',\n name: 'string',\n description: 'string',\n creationTime: '2021-04-27T12:01:13.000Z',\n enabled: true,\n lastUpdateTime: '2021-04-27T12:01:13.000Z',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: {\n numberOfUnits: 0,\n timePeriod: 'minutes',\n actionTypeCondition: 'WORKFLOW_STARTED',\n stepId: 'string',\n phaseId: 'string'\n },\n userIds: [0],\n assignedTo: ['string'],\n enableECPWorkflow: true,\n flow: [\n {\n id: 'string',\n name: 'string',\n order: 0,\n type: 'STEP',\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n assignedTo: ['string'],\n steps: [ /* ... */ ],\n taxonomies: ['string']\n },\n {\n id: 'string',\n name: 'string',\n description: { /* ... */ },\n executionType: 'MANUAL',\n automationConfig: { /* ... */ },\n journey: { /* ... */ },\n order: 0,\n dueDate: '2021-04-27T12:00:00.000Z',\n dynamicDueDate: { /* ... */ },\n userIds: [0],\n requirements: [ /* ... */ ],\n assignedTo: ['string'],\n type: 'STEP',\n ecp: { /* ... */ },\n installer: { /* ... */ },\n partner: { /* ... */ },\n taxonomies: ['string']\n }\n ],\n closingReasons: [\n {\n id: 'x739cew'\n }\n ],\n updateEntityAttributes: [\n {\n source: 'workflow_status',\n target: { /* ... */ }\n }\n ],\n taxonomies: ['string'],\n singleClosingReasonSelection: true,\n _manifest: ['string']\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"creationTime\": \"2021-04-27T12:01:13.000Z\",\n \"enabled\": true,\n \"lastUpdateTime\": \"2021-04-27T12:01:13.000Z\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {\n \"numberOfUnits\": 0,\n \"timePeriod\": \"minutes\",\n \"actionTypeCondition\": \"WORKFLOW_STARTED\",\n \"stepId\": \"string\",\n \"phaseId\": \"string\"\n },\n \"userIds\": [0],\n \"assignedTo\": [\"string\"],\n \"enableECPWorkflow\": true,\n \"flow\": [\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"order\": 0,\n \"type\": \"STEP\",\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"assignedTo\": [\"string\"],\n \"steps\": [],\n \"taxonomies\": [\"string\"]\n },\n {\n \"id\": \"string\",\n \"name\": \"string\",\n \"description\": {},\n \"executionType\": \"MANUAL\",\n \"automationConfig\": {},\n \"journey\": {},\n \"order\": 0,\n \"dueDate\": \"2021-04-27T12:00:00.000Z\",\n \"dynamicDueDate\": {},\n \"userIds\": [0],\n \"requirements\": [],\n \"assignedTo\": [\"string\"],\n \"type\": \"STEP\",\n \"ecp\": {},\n \"installer\": {},\n \"partner\": {},\n \"taxonomies\": [\"string\"]\n }\n ],\n \"closingReasons\": [\n {\n \"id\": \"x739cew\"\n }\n ],\n \"updateEntityAttributes\": [\n {\n \"source\": \"workflow_status\",\n \"target\": {}\n }\n ],\n \"taxonomies\": [\"string\"],\n \"singleClosingReasonSelection\": true,\n \"_manifest\": [\"string\"]\n}\n```\n\n
\n\n---\n\n### `deleteDefinition`\n\nDelete Workflow Definition.\n\n`DELETE /v1/workflows/definitions/{definitionId}`\n\n```ts\nconst { data } = await client.deleteDefinition({\n definitionId: 'example',\n})\n```\n\n---\n\n### `getAllClosingReasons`\n\nGet all Closing Reasons defined in the organization by default all Active.\n\n`GET /v1/workflows/closing-reasons`\n\n```ts\nconst { data } = await client.getAllClosingReasons({\n includeInactive: true,\n})\n```\n\n
\nResponse\n\n```json\n{\n \"reasons\": [\n {\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {\n \"id\": \"string\",\n \"title\": \"string\"\n },\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createClosingReason`\n\nA created Closing Reason is stored for the organization and will be displayed in the library of reasons.\n\n`POST /v1/workflows/closing-reasons`\n\n```ts\nconst { data } = await client.createClosingReason(\n null,\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n categoryId: 'c9wq81x',\n category: {\n id: 'string',\n title: 'string'\n },\n lastUpdateTime: 'string',\n creationTime: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {\n \"id\": \"string\",\n \"title\": \"string\"\n },\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `getClosingReason`\n\nGet specific closing reason by id from the organisation.\n\n`GET /v2/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.getClosingReason({\n reasonId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {\n \"id\": \"string\",\n \"title\": \"string\"\n },\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `updateClosingReason`\n\nUpdate an existing closing reason\n\n`PATCH /v2/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.updateClosingReason(\n {\n reasonId: 'example',\n },\n {\n id: 'string',\n title: 'string',\n status: 'ACTIVE',\n categoryId: 'c9wq81x',\n category: {\n id: 'string',\n title: 'string'\n },\n lastUpdateTime: 'string',\n creationTime: 'string'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"string\",\n \"status\": \"ACTIVE\",\n \"categoryId\": \"c9wq81x\",\n \"category\": {\n \"id\": \"string\",\n \"title\": \"string\"\n },\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `deleteClosingReason`\n\nPermanently delete a closing reason (Using INACTIVE status is recommended instead)\n\n`DELETE /v2/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.deleteClosingReason({\n reasonId: 'example',\n})\n```\n\n---\n\n### `changeReasonStatus`\n\nChange the status of a Closing Reason (eg. ACTIVE to INACTIVE).\n\n`PATCH /v1/workflows/closing-reasons/{reasonId}`\n\n```ts\nconst { data } = await client.changeReasonStatus(\n {\n reasonId: 'example',\n },\n {\n status: 'ACTIVE'\n },\n)\n```\n\n---\n\n### `getAllClosingReasonCategories`\n\nGet all closing reason categories defined in the organization.\n\n`GET /v1/workflows/closing-reason-categories`\n\n```ts\nconst { data } = await client.getAllClosingReasonCategories()\n```\n\n
\nResponse\n\n```json\n{\n \"categories\": [\n {\n \"id\": \"string\",\n \"title\": \"Wirtschaftlichkeit\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `createClosingReasonCategory`\n\nCreate a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace.\n\n`POST /v1/workflows/closing-reason-categories`\n\n```ts\nconst { data } = await client.createClosingReasonCategory(\n null,\n {\n title: 'Wirtschaftlichkeit'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"Wirtschaftlichkeit\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `getClosingReasonCategory`\n\nGet a closing reason category by id.\n\n`GET /v1/workflows/closing-reason-categories/{categoryId}`\n\n```ts\nconst { data } = await client.getClosingReasonCategory({\n categoryId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"Wirtschaftlichkeit\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `updateClosingReasonCategory`\n\nRename a closing reason category. Running flows keep the title they started with.\n\n`PATCH /v1/workflows/closing-reason-categories/{categoryId}`\n\n```ts\nconst { data } = await client.updateClosingReasonCategory(\n {\n categoryId: 'example',\n },\n {\n title: 'Wirtschaftlichkeit'\n },\n)\n```\n\n
\nResponse\n\n```json\n{\n \"id\": \"string\",\n \"title\": \"Wirtschaftlichkeit\",\n \"lastUpdateTime\": \"string\",\n \"creationTime\": \"string\"\n}\n```\n\n
\n\n---\n\n### `deleteClosingReasonCategory`\n\nDelete a closing reason category. Its reasons are kept and lose their category.\n\n`DELETE /v1/workflows/closing-reason-categories/{categoryId}`\n\n```ts\nconst { data } = await client.deleteClosingReasonCategory({\n categoryId: 'example',\n})\n```\n\n---\n\n### `getWorkflowClosingReasons`\n\nReturns all closing reasons defined for the workflow.\n\n`GET /v1/workflows/definitions/{definitionId}/closing-reasons`\n\n```ts\nconst { data } = await client.getWorkflowClosingReasons({\n definitionId: 'example',\n})\n```\n\n
\nResponse\n\n```json\n{\n \"reasons\": [\n {\n \"id\": \"x739cew\"\n }\n ]\n}\n```\n\n
\n\n---\n\n### `setWorkflowClosingReasons`\n\nSets which closing reasons are defined for this workflow, based on the entire closing reasons catalog.\n\n`PATCH /v1/workflows/definitions/{definitionId}/closing-reasons`\n\n```ts\nconst { data } = await client.setWorkflowClosingReasons(\n {\n definitionId: 'example',\n },\n {\n reasons: [\n {\n id: 'x739cew'\n }\n ]\n },\n)\n```\n\n---\n\n## Schemas\n\n### `FlowTemplateBase`\n\nBase schema for V2 flow templates. A flow template defines the structure of a workflow\nincluding phases, tasks, edges, triggers, and other configuration. Flow templates serve\nas blueprints that can be instantiated as flow executions.\n\n\n```ts\ntype FlowTemplateBase = {\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: string\n installer?: string\n }\n trigger?: {\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }>\n phases?: Array<{\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n taxonomies?: string[]\n }>\n stages?: Array<{\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n // ...\n}\n```\n\n### `FlowLimitWarning`\n\nA configuration limit that the flow currently exceeds. Returned by the get-flow endpoint and by create/update responses so the UI can show a non-blocking banner. Size/count limit violations never cause a 400 — only structural errors do. The flow remains fully usable; users are encouraged to bring va\n\n```ts\ntype FlowLimitWarning = {\n i18nKey: string\n message: string\n max: number\n current?: number\n node_id?: string\n task_name?: string\n branch_name?: string\n param_name?: string\n path: unknown[]\n}\n```\n\n### `FlowStructuralWarning`\n\nA structural problem the flow has that does not block a save. Returned by the get-flow endpoint and by create/update responses. Today the only one is errors.loop_id_after_exit: a loop connection can be reached from its loop's exit branch, so leaving the loop leads back into it.\n\n```ts\ntype FlowStructuralWarning = {\n i18nKey: string\n message: string\n node_id?: string\n edge_id?: string\n path: unknown[]\n}\n```\n\n### `FlowTemplate`\n\n```ts\ntype FlowTemplate = {\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: string\n installer?: string\n }\n trigger?: {\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }>\n phases?: Array<{\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n taxonomies?: string[]\n }>\n stages?: Array<{\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n // ...\n}\n```\n\n### `Version`\n\nVersion of the workflow schema.\n\n- `v1` – *Deprecated*. The initial version of workflows with limited structure and automation capabilities.\n- `v2` – Linear workflows. Supports sequential task execution with basic automation triggers.\n- `v3` – Advanced workflows. Adds support for branching logic (co\n\n```ts\ntype Version = \"v1\" | \"v2\" | \"v3\"\n```\n\n### `Trigger`\n\n```ts\ntype Trigger = {\n id?: string\n type: \"manual\"\n entity_schema?: string\n} | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: string\n configuration?: Record\n }>\n duplicated_automation_id?: string\n} | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n} | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n}\n```\n\n### `ManualTrigger`\n\n```ts\ntype ManualTrigger = {\n id?: string\n type: \"manual\"\n entity_schema?: string\n}\n```\n\n### `AutomationTrigger`\n\n```ts\ntype AutomationTrigger = {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: string\n configuration?: Record\n }>\n duplicated_automation_id?: string\n}\n```\n\n### `JourneyAutomationTrigger`\n\n```ts\ntype JourneyAutomationTrigger = {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n}\n```\n\n### `JourneySubmissionTrigger`\n\n```ts\ntype JourneySubmissionTrigger = {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n}\n```\n\n### `CreateFlowTemplate`\n\n```ts\ntype CreateFlowTemplate = {\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: string\n installer?: string\n }\n trigger?: {\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: string\n type: \"manual\"\n entity_schema?: string\n } | {\n id?: string\n type: \"automation\"\n automation_id?: string\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n trigger_config?: Array<{\n type: { ... }\n configuration?: { ... }\n }>\n duplicated_automation_id?: string\n } | {\n id?: string\n type: \"journey_submission\"\n journey_id: string\n journey_name?: string\n automation_id?: string\n } | {\n id?: string\n type: \"journey_automation\"\n entity_schema?: string\n }>\n phases?: Array<{\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n taxonomies?: string[]\n }>\n stages?: Array<{\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n // ...\n}\n```\n\n### `SearchFlowTemplates`\n\n```ts\ntype SearchFlowTemplates = {\n name?: string\n definition_id?: string\n trigger_type?: \"journey_submission\" | \"manual\" | \"automation\"\n enabled?: boolean\n from?: number\n size?: number\n sort_by?: \"created_at\" | \"updated_at\" | \"name\" | \"enabled\" | \"id\"\n sort_order?: \"asc\" | \"desc\"\n}\n```\n\n### `FlowTemplatesList`\n\n```ts\ntype FlowTemplatesList = {\n results: Array<{\n id?: string\n org_id?: string\n name: string\n description?: string\n portal_titles?: {\n ecp?: { ... }\n installer?: { ... }\n }\n trigger?: {\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n automation_id?: { ... }\n input_entity?: { ... }\n trigger_config?: { ... }\n duplicated_automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n journey_id: { ... }\n journey_name?: { ... }\n automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n }\n enabled?: boolean\n version?: \"v1\" | \"v2\" | \"v3\"\n created_at?: string\n updated_at?: string\n due_date?: string\n due_date_config?: {\n duration: { ... }\n unit: { ... }\n type: { ... }\n task_id?: { ... }\n phase_id?: { ... }\n }\n assigned_to?: Array\n available_in_ecp?: boolean\n additional_triggers?: Array<{\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n automation_id?: { ... }\n input_entity?: { ... }\n trigger_config?: { ... }\n duplicated_automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n journey_id: { ... }\n journey_name?: { ... }\n automation_id?: { ... }\n } | {\n id?: { ... }\n type: { ... }\n entity_schema?: { ... }\n }>\n phases?: Array<{\n id: { ... }\n name: { ... }\n due_date?: { ... }\n due_date_config?: { ... }\n assigned_to?: { ... }\n taxonomies?: { ... }\n }>\n stages?: Array<{\n id: { ... }\n name: { ... }\n description?: { ... }\n entry_node_id?: { ... }\n cut_edge_ids?: { ... }\n color?: { ... }\n portal_names?: { ... }\n portal_descriptions?: { ... }\n }>\n tasks: Array<{\n id: { ... }\n name: { ... }\n description?: { ... }\n journey?: { ... }\n due_date?: { ... }\n due_date_config?: { ... }\n start_date?: { ... }\n start_date_config?: { ... }\n requirements?: { ... }\n required?: { ... }\n // ...\n}\n```\n\n### `FlowTemplateId`\n\nShort unique id (length 8) to identify the Flow Template.\n\n```ts\ntype FlowTemplateId = string\n```\n\n### `Task`\n\n```ts\ntype Task = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n} | {\n id: string\n // ...\n}\n```\n\n### `ManualTask`\n\n```ts\ntype ManualTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n}\n```\n\n### `AutomationTask`\n\n```ts\ntype AutomationTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n automation_config: {\n flow_id?: string\n // ...\n}\n```\n\n### `AutomationFailurePolicy`\n\nWhat the flow does when this automation ends in a failed state. `stop` waits on the failed task until it is retried or skipped. `continue` proceeds to the next task. An absent value means `stop`.\n\n```ts\ntype AutomationFailurePolicy = \"stop\" | \"continue\"\n```\n\n### `AutomationConfig`\n\nConfiguration for automation execution to run\n\n```ts\ntype AutomationConfig = {\n flow_id?: string\n action_config?: {\n type: string\n config?: Record\n }\n duplicated_flow_id?: string\n input_context?: {\n source: \"main_context\" | \"task\" | \"trigger\"\n task_id?: string\n trigger_id?: string\n with_relations?: boolean\n also_pass?: Array<{\n source: { ... }\n } | {\n source: { ... }\n task_id: { ... }\n }>\n }\n output_context?: {\n set_as_primary?: boolean\n attach_to_contexts?: boolean\n }\n eligible_closing_reason_ids?: string[]\n email_review?: {\n enabled?: boolean\n allow_document_selection?: boolean\n allow_subject_and_body_edit?: boolean\n }\n allow_execution_note?: boolean\n}\n```\n\n### `EmailReviewConfig`\n\nWhether the person running a semi-automated send-email step may adjust the email before it goes out, and what they may adjust. Meaningful only on a task a person triggers — the engine's own dispatch has nobody to review — so the template healer clears it from an `automatic` task. With `enabled` fals\n\n```ts\ntype EmailReviewConfig = {\n enabled?: boolean\n allow_document_selection?: boolean\n allow_subject_and_body_edit?: boolean\n}\n```\n\n### `AutomationInputContext`\n\nOptional. Source of the entity fed into this automation task. If omitted, the run's current main context is used.\n\n\n```ts\ntype AutomationInputContext = {\n source: \"main_context\" | \"task\" | \"trigger\"\n task_id?: string\n trigger_id?: string\n with_relations?: boolean\n also_pass?: Array<{\n source: \"main_context\"\n } | {\n source: \"task\"\n task_id: string\n }>\n}\n```\n\n### `AutomationInputExtraContextRef`\n\nOne of the run's own entities. `main_context` = the run's current main context.\n\n\n```ts\ntype AutomationInputExtraContextRef = {\n source: \"main_context\"\n}\n```\n\n### `AutomationInputExtraTaskRef`\n\nEvery entity produced by an upstream task.\n\n```ts\ntype AutomationInputExtraTaskRef = {\n source: \"task\"\n task_id: string\n}\n```\n\n### `FlowContextSettings`\n\nWhere a flow runs, and where people see it.\nA run is ALWAYS visible on the entities it runs on — the entity its trigger supplied and every context it picks up. That is not configurable: it is what running there means, and hiding a run from its own entity is what `visibility: background` is for.\n`dis\n\n```ts\ntype FlowContextSettings = {\n visibility?: \"entity_views\" | \"background\"\n main_context?: {\n schema: string\n relation_labels?: string[]\n }\n displays?: Array<{\n id: string\n entity_schema: string\n from?: {\n role: { ... }\n } | {\n role: { ... }\n rule_id: { ... }\n }\n relation_labels?: string[]\n attach_to_contexts?: boolean\n }>\n}\n```\n\n### `MainContextSetting`\n\nWhich of a flow's contexts owns the run: the entity conditions, automations and entity sync resolve against by default.\nABSENT means the default — the primary trigger's entity. A flow has ONE main context, not one per trigger (STABLE360-13503): a run started by another trigger resolves the default a\n\n```ts\ntype MainContextSetting = {\n schema: string\n relation_labels?: string[]\n}\n```\n\n### `FlowDisplayRule`\n\nOne additional entity kind the flow should be visible on, found by relation from the main context or from an earlier entry.\nAn entity reached this way has no context of its own: it shows the main context's run, and acting on it acts on the main context. Nothing is copied and no second run starts.\nTh\n\n```ts\ntype FlowDisplayRule = {\n id: string\n entity_schema: string\n from?: {\n role: \"main_context\"\n } | {\n role: \"rule\"\n rule_id: string\n }\n relation_labels?: string[]\n attach_to_contexts?: boolean\n}\n```\n\n### `FlowRuleAnchor`\n\nWhere an entry starts looking. Absent means `main_context`.\nA ROLE, not a schema: an entry anchored on `main_context` follows the primary when a task promotes another entity, where naming a schema would freeze it on the old one.\n\n\n```ts\ntype FlowRuleAnchor = {\n role: \"main_context\"\n} | {\n role: \"rule\"\n rule_id: string\n}\n```\n\n### `MainContextAnchor`\n\nThe run's primary context, whatever it currently is.\n\n```ts\ntype MainContextAnchor = {\n role: \"main_context\"\n}\n```\n\n### `RuleAnchor`\n\nAn earlier entry in `displays`, by its id: this entry searches from whatever that one matched. Chaining ticket -> contact -> account this way keeps both hops DISPLAY-only; making the contact a real context first is a separate decision (`attach_to_contexts`), not a prerequisite for reaching the accou\n\n```ts\ntype RuleAnchor = {\n role: \"rule\"\n rule_id: string\n}\n```\n\n### `AutomationOutputContext`\n\nOptional. What happens to the entity produced by this automation task (the last successful entity-producing action of its automation).\n\n\n```ts\ntype AutomationOutputContext = {\n set_as_primary?: boolean\n attach_to_contexts?: boolean\n}\n```\n\n### `AiAgentTask`\n\n```ts\ntype AiAgentTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n agent_config?: {\n agent_id: string\n // ...\n}\n```\n\n### `AgentConfig`\n\nConfiguration for AI Agent to run\n\n```ts\ntype AgentConfig = {\n agent_id: string\n}\n```\n\n### `TriggerMode`\n\n```ts\ntype TriggerMode = \"manual\" | \"automatic\"\n```\n\n### `ActionSchedule`\n\n```ts\ntype ActionSchedule = {\n mode?: \"immediate\"\n} | {\n mode: \"delayed\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n} | {\n mode: \"relative\"\n direction: \"before\" | \"after\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n reference: {\n id: string\n origin: \"flow_started\" | \"task_completed\" | \"trigger_entity_attribute\" | \"all_preceding_tasks_completed\"\n schema?: string\n attribute?: string\n }\n}\n```\n\n### `ImmediateSchedule`\n\n```ts\ntype ImmediateSchedule = {\n mode?: \"immediate\"\n}\n```\n\n### `DelayedSchedule`\n\n```ts\ntype DelayedSchedule = {\n mode: \"delayed\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n}\n```\n\n### `RelativeSchedule`\n\n```ts\ntype RelativeSchedule = {\n mode: \"relative\"\n direction: \"before\" | \"after\"\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n reference: {\n id: string\n origin: \"flow_started\" | \"task_completed\" | \"trigger_entity_attribute\" | \"all_preceding_tasks_completed\"\n schema?: string\n attribute?: string\n }\n}\n```\n\n### `DecisionTask`\n\n```ts\ntype DecisionTask = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n trigger_mode: \"manual\" | \"automatic\"\n conditions: Array<{\n // ...\n}\n```\n\n### `LoopDefinition`\n\n```ts\ntype LoopDefinition = {\n entry_branch_ids: string[]\n exit_branch_id: string\n max_iterations: number\n}\n```\n\n### `TaskAudience`\n\nA task audience, named after the task field holding its description: co-workers (description), end customers (ecp), installers and partners.\n\n```ts\ntype TaskAudience = \"description\" | \"ecp\" | \"installer\" | \"partner\"\n```\n\n### `TaskBase`\n\n```ts\ntype TaskBase = {\n id: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n start_date?: string\n start_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n }\n requirements?: Array<{\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n }>\n required?: boolean\n only_assignee_can_complete?: boolean\n subtasks?: Array<{\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n }>\n assigned_to?: Array\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n audience_order?: \"description\" | \"ecp\" | \"installer\" | \"partner\"[]\n taxonomies?: string[]\n phase_id?: string\n task_type: \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n}\n```\n\n### `Phase`\n\n```ts\ntype Phase = {\n id: string\n name: string\n due_date?: string\n due_date_config?: {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n }\n assigned_to?: Array\n taxonomies?: string[]\n}\n```\n\n### `Stage`\n\nA customer-facing progress segment layered on top of the flow graph. Unlike phases (internal task grouping), stages exist to communicate progress to outside users (e.g. end customers) with a title and description. Stages form a strict total order; the array order is the boundary order and must match\n\n```ts\ntype Stage = {\n id: string\n name: string\n description?: string\n entry_node_id?: string\n cut_edge_ids?: string[]\n color?: string\n portal_names?: {\n ecp?: string\n installer?: string\n }\n portal_descriptions?: {\n ecp?: string\n installer?: string\n }\n}\n```\n\n### `VariableAssignment`\n\nRepresents a variable assignment with its expression and optional resolved value. Used for dynamic user assignments that get resolved during workflow execution.\n\n```ts\ntype VariableAssignment = {\n variable: string\n value?: string[]\n}\n```\n\n### `TaskType`\n\n```ts\ntype TaskType = \"MANUAL\" | \"AUTOMATION\" | \"DECISION\" | \"AI_AGENT\"\n```\n\n### `Edge`\n\n```ts\ntype Edge = {\n id: string\n from_id: string\n to_id?: string\n condition_id?: string\n loop_id?: string\n none_met?: boolean\n}\n```\n\n### `Condition`\n\n```ts\ntype Condition = {\n id: string\n branch_name: string\n logical_operator: \"AND\" | \"OR\"\n statements: Array<{\n id: string\n source: {\n id?: { ... }\n origin?: { ... }\n origin_type?: { ... }\n schema?: { ... }\n attribute?: { ... }\n attribute_type?: { ... }\n attribute_repeatable?: { ... }\n attribute_operation?: { ... }\n attributes?: { ... }\n attributes_match?: { ... }\n attribute_sub_field?: { ... }\n date_offset?: { ... }\n }\n operator: \"equals\" | \"not_equals\" | \"any_of\" | \"none_of\" | \"contains\" | \"not_contains\" | \"starts_with\" | \"ends_with\" | \"greater_than\" | \"less_than\" | \"greater_than_or_equals\" | \"less_than_or_equals\" | \"is_empty\" | \"is_not_empty\"\n values: string[]\n value_type?: \"static\" | \"relative_date\"\n }>\n}\n```\n\n### `Statement`\n\n```ts\ntype Statement = {\n id: string\n source: {\n id?: string\n origin?: \"trigger\" | \"action\" | \"flow_runtime\"\n origin_type?: \"entity\" | \"workflow\" | \"journey_block\" | \"trigger_source\" | \"main_context\" | \"flow_trait\"\n schema?: string\n attribute?: string\n attribute_type?: \"string\" | \"text\" | \"number\" | \"boolean\" | \"date\" | \"datetime\" | \"tags\" | \"country\" | \"email\" | \"phone\" | \"product\" | \"price\" | \"status\" | \"relation\" | \"multiselect\" | \"select\" | \"radio\" | \"relation_user\" | \"purpose\" | \"label\" | \"message_email_address\"\n attribute_repeatable?: boolean\n attribute_operation?: \"all\" | \"updated\" | \"added\" | \"deleted\"\n attributes?: string[]\n attributes_match?: \"any\" | \"all\"\n attribute_sub_field?: string\n date_offset?: {\n amount?: { ... }\n unit?: { ... }\n }\n }\n operator: \"equals\" | \"not_equals\" | \"any_of\" | \"none_of\" | \"contains\" | \"not_contains\" | \"starts_with\" | \"ends_with\" | \"greater_than\" | \"less_than\" | \"greater_than_or_equals\" | \"less_than_or_equals\" | \"is_empty\" | \"is_not_empty\"\n values: string[]\n value_type?: \"static\" | \"relative_date\"\n}\n```\n\n### `EvaluationSource`\n\n```ts\ntype EvaluationSource = {\n id?: string\n origin?: \"trigger\" | \"action\" | \"flow_runtime\"\n origin_type?: \"entity\" | \"workflow\" | \"journey_block\" | \"trigger_source\" | \"main_context\" | \"flow_trait\"\n schema?: string\n attribute?: string\n attribute_type?: \"string\" | \"text\" | \"number\" | \"boolean\" | \"date\" | \"datetime\" | \"tags\" | \"country\" | \"email\" | \"phone\" | \"product\" | \"price\" | \"status\" | \"relation\" | \"multiselect\" | \"select\" | \"radio\" | \"relation_user\" | \"purpose\" | \"label\" | \"message_email_address\"\n attribute_repeatable?: boolean\n attribute_operation?: \"all\" | \"updated\" | \"added\" | \"deleted\"\n attributes?: string[]\n attributes_match?: \"any\" | \"all\"\n attribute_sub_field?: string\n date_offset?: {\n amount?: number\n unit?: \"days\" | \"months\" | \"years\"\n }\n}\n```\n\n### `Operator`\n\n```ts\ntype Operator = \"equals\" | \"not_equals\" | \"any_of\" | \"none_of\" | \"contains\" | \"not_contains\" | \"starts_with\" | \"ends_with\" | \"greater_than\" | \"less_than\" | \"greater_than_or_equals\" | \"less_than_or_equals\" | \"is_empty\" | \"is_not_empty\"\n```\n\n### `DueDateConfig`\n\nSet due date for the task based on a dynamic condition. `START_DATE` counts from the task's own start date (AL-3678) and is valid only on a task that has a start date.\n\n```ts\ntype DueDateConfig = {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"PHASE_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"START_DATE\"\n task_id?: string\n phase_id?: string\n}\n```\n\n### `StartDateConfig`\n\nRelative start date of a task (AL-3678): `duration` `unit` after the most recent occurrence of the reference event. `THIS_TASK_LAST_COMPLETED` is the task's own previous completion (a loop's earlier pass); there is no wait while the reference event has not happened. Durations are positive whole numb\n\n```ts\ntype StartDateConfig = {\n duration: number\n unit: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n type: \"WORKFLOW_STARTED\" | \"TASK_FINISHED\" | \"A_PRECEDING_TASK_COMPLETED\" | \"ALL_PRECEDING_TASKS_COMPLETED\" | \"THIS_TASK_LAST_COMPLETED\"\n task_id?: string\n}\n```\n\n### `TimeUnit`\n\n```ts\ntype TimeUnit = \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n```\n\n### `EnableRequirement`\n\ndescribe the requirement for a task to be enabled\n\n```ts\ntype EnableRequirement = {\n task_id?: string\n phase_id?: string\n when: \"TASK_FINISHED\" | \"PHASE_FINISHED\"\n}\n```\n\n### `Subtask`\n\nOne checklist item of a task, derived from the checklist markup in the party descriptions. Identity is the stable data-subtask-id the editor mints into the markup.\n\n```ts\ntype Subtask = {\n id: string\n name?: string\n party: \"description\" | \"ecp\" | \"installer\" | \"partner\"\n required?: boolean\n}\n```\n\n### `WorkflowDefinition`\n\nV1 workflow definition schema. Defines a linear workflow structure with sections\nand steps. Sections group related steps together, and steps represent individual\ntasks that need to be completed. This is the legacy workflow model; for new\nimplementations, consider using V2 flow templates instead.\n\n\n```ts\ntype WorkflowDefinition = {\n id?: string\n name: string\n description?: string\n creationTime?: string\n enabled?: boolean\n lastUpdateTime?: string\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n }\n userIds?: number[]\n assignedTo?: string[]\n enableECPWorkflow?: boolean\n flow: Array<{\n id?: string\n name: string\n order: number\n type: \"STEP\" | \"SECTION\"\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: { ... }\n timePeriod: { ... }\n actionTypeCondition: { ... }\n stepId?: { ... }\n phaseId?: { ... }\n }\n assignedTo?: string[]\n steps: Array<{\n id?: { ... }\n name: { ... }\n description?: { ... }\n executionType?: { ... }\n automationConfig?: { ... }\n journey?: { ... }\n order: { ... }\n dueDate?: { ... }\n dynamicDueDate?: { ... }\n userIds?: { ... }\n requirements?: { ... }\n assignedTo?: { ... }\n type: { ... }\n ecp?: { ... }\n installer?: { ... }\n partner?: { ... }\n taxonomies?: { ... }\n }>\n taxonomies?: string[]\n } | {\n id?: string\n name: string\n description?: {\n enabled?: { ... }\n value?: { ... }\n }\n executionType?: \"MANUAL\" | \"AUTOMATION\"\n automationConfig?: {\n flowId: { ... }\n }\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n order: number\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: { ... }\n timePeriod: { ... }\n actionTypeCondition: { ... }\n stepId?: { ... }\n phaseId?: { ... }\n }\n userIds?: number[]\n requirements?: Array<{\n definitionId: { ... }\n type: { ... }\n condition: { ... }\n }>\n assignedTo?: string[]\n type: \"STEP\" | \"SECTION\"\n ecp?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n journey?: { ... }\n }\n installer?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n // ...\n}\n```\n\n### `Step`\n\nAction that needs to be done in a Workflow\n\n```ts\ntype Step = {\n id?: string\n name: string\n description?: {\n enabled?: boolean\n value?: string\n }\n executionType?: \"MANUAL\" | \"AUTOMATION\"\n automationConfig?: {\n flowId: string\n }\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n order: number\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n }\n userIds?: number[]\n requirements?: Array<{\n definitionId: string\n type: \"STEP\" | \"SECTION\"\n condition: \"CLOSED\"\n }>\n assignedTo?: string[]\n type: \"STEP\" | \"SECTION\"\n ecp?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n installer?: {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n }\n partner?: {\n enabled?: boolean\n label?: string\n description?: string\n }\n taxonomies?: string[]\n}\n```\n\n### `Section`\n\nA group of Steps that define the progress of the Workflow\n\n```ts\ntype Section = {\n id?: string\n name: string\n order: number\n type: \"STEP\" | \"SECTION\"\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n }\n assignedTo?: string[]\n steps: Array<{\n id?: string\n name: string\n description?: {\n enabled?: { ... }\n value?: { ... }\n }\n executionType?: \"MANUAL\" | \"AUTOMATION\"\n automationConfig?: {\n flowId: { ... }\n }\n journey?: {\n id?: { ... }\n journeyId?: { ... }\n name?: { ... }\n portal_button_label?: { ... }\n complete_task_automatically?: { ... }\n journey_submission_required?: { ... }\n context_parameters?: { ... }\n ai_prefill?: { ... }\n }\n order: number\n dueDate?: string\n dynamicDueDate?: {\n numberOfUnits: { ... }\n timePeriod: { ... }\n actionTypeCondition: { ... }\n stepId?: { ... }\n phaseId?: { ... }\n }\n userIds?: number[]\n requirements?: Array<{\n definitionId: { ... }\n type: { ... }\n condition: { ... }\n }>\n assignedTo?: string[]\n type: \"STEP\" | \"SECTION\"\n ecp?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n journey?: { ... }\n }\n installer?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n journey?: { ... }\n }\n partner?: {\n enabled?: { ... }\n label?: { ... }\n description?: { ... }\n }\n taxonomies?: string[]\n }>\n taxonomies?: string[]\n}\n```\n\n### `TriggerType`\n\n```ts\ntype TriggerType = \"MANUAL\" | \"AUTOMATIC\"\n```\n\n### `ItemType`\n\n```ts\ntype ItemType = \"STEP\" | \"SECTION\"\n```\n\n### `StepType`\n\n```ts\ntype StepType = \"MANUAL\" | \"AUTOMATION\"\n```\n\n### `StepJourney`\n\n```ts\ntype StepJourney = {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: string\n value: string\n }>\n ai_prefill?: {\n enabled?: boolean\n source?: {\n type?: { ... }\n input_entity?: { ... }\n }\n extraction_fields?: Array<{\n key: { ... }\n type: { ... }\n description?: { ... }\n description_overridden?: { ... }\n enum?: { ... }\n }>\n mappings?: Array<{\n source: { ... }\n block_id: { ... }\n block_type: { ... }\n block_field?: { ... }\n country_code?: { ... }\n }>\n min_confidence?: number\n instructions?: string\n }\n}\n```\n\n### `AiPrefillConfig`\n\nAI extraction + prefill configuration for the attached journey (Flows v2 only)\n\n```ts\ntype AiPrefillConfig = {\n enabled?: boolean\n source?: {\n type?: \"flow_context\"\n input_entity?: \"thread\" | \"first_email\" | \"last_email\"\n }\n extraction_fields?: Array<{\n key: string\n type: \"string\" | \"number\" | \"boolean\" | \"date\" | \"enum\"\n description?: string\n description_overridden?: boolean\n enum?: string[]\n }>\n mappings?: Array<{\n source: string\n block_id: string\n block_type: \"text-input\" | \"number-input\" | \"personal-information\" | \"meter-reading\" | \"contact\" | \"single-choice\" | \"date-input\" | \"binary-input\" | \"address\" | \"payment-method\" | \"multiple-choice\" | \"availability-check\"\n block_field?: string\n country_code?: string\n }>\n min_confidence?: number\n instructions?: string\n}\n```\n\n### `AiPrefillExtractionField`\n\n```ts\ntype AiPrefillExtractionField = {\n key: string\n type: \"string\" | \"number\" | \"boolean\" | \"date\" | \"enum\"\n description?: string\n description_overridden?: boolean\n enum?: string[]\n}\n```\n\n### `AiPrefillMapping`\n\n```ts\ntype AiPrefillMapping = {\n source: string\n block_id: string\n block_type: \"text-input\" | \"number-input\" | \"personal-information\" | \"meter-reading\" | \"contact\" | \"single-choice\" | \"date-input\" | \"binary-input\" | \"address\" | \"payment-method\" | \"multiple-choice\" | \"availability-check\"\n block_field?: string\n country_code?: string\n}\n```\n\n### `JourneyContextParameter`\n\n```ts\ntype JourneyContextParameter = {\n key: string\n value: string\n}\n```\n\n### `ECPDetails`\n\nDetails regarding ECP for the workflow step\n\n```ts\ntype ECPDetails = {\n enabled?: boolean\n label?: string\n description?: string\n journey?: {\n id?: string\n journeyId?: string\n name?: string\n portal_button_label?: string\n complete_task_automatically?: boolean\n journey_submission_required?: boolean\n context_parameters?: Array<{\n key: { ... }\n value: { ... }\n }>\n ai_prefill?: {\n enabled?: { ... }\n source?: { ... }\n extraction_fields?: { ... }\n mappings?: { ... }\n min_confidence?: { ... }\n instructions?: { ... }\n }\n }\n}\n```\n\n### `PartnerDetails`\n\nDetails regarding partner for the workflow step\n\n```ts\ntype PartnerDetails = {\n enabled?: boolean\n label?: string\n description?: string\n}\n```\n\n### `StepDescription`\n\nLonger information regarding Task\n\n```ts\ntype StepDescription = {\n enabled?: boolean\n value?: string\n}\n```\n\n### `MaxAllowedLimit`\n\n```ts\ntype MaxAllowedLimit = {\n currentNoOfWorkflows?: number\n maxAllowed?: number\n}\n```\n\n### `DefinitionNotFoundResp`\n\nError response returned when a workflow definition or flow template is not found.\n\n```ts\ntype DefinitionNotFoundResp = {\n message?: string\n}\n```\n\n### `ClosingReasonNotFoundResp`\n\nError response returned when a closing reason is not found.\n\n```ts\ntype ClosingReasonNotFoundResp = {\n message?: string\n}\n```\n\n### `ChangeReasonStatusReq`\n\n```ts\ntype ChangeReasonStatusReq = {\n status: \"ACTIVE\" | \"INACTIVE\"\n}\n```\n\n### `ClosingReasons`\n\n```ts\ntype ClosingReasons = {\n reasons: Array<{\n id?: string\n title?: string\n status?: \"ACTIVE\" | \"INACTIVE\"\n categoryId?: string\n category?: {\n id: { ... }\n title: { ... }\n }\n lastUpdateTime?: string\n creationTime?: string\n }>\n}\n```\n\n### `ClosingReason`\n\nOne Closing reason for a workflow\n\n```ts\ntype ClosingReason = {\n id?: string\n title?: string\n status?: \"ACTIVE\" | \"INACTIVE\"\n categoryId?: string\n category?: {\n id: string\n title: string\n }\n lastUpdateTime?: string\n creationTime?: string\n}\n```\n\n### `ClosingReasonCategoryRef`\n\nThe reason's category, resolved when a flow template is read. Ignored on writes.\n\n```ts\ntype ClosingReasonCategoryRef = {\n id: string\n title: string\n}\n```\n\n### `ClosingReasonCategories`\n\n```ts\ntype ClosingReasonCategories = {\n categories: Array<{\n id?: string\n title?: string\n lastUpdateTime?: string\n creationTime?: string\n }>\n}\n```\n\n### `ClosingReasonCategory`\n\nA category that groups closing reasons, e.g. \"Wirtschaftlichkeit\" for several economic reasons\n\n```ts\ntype ClosingReasonCategory = {\n id?: string\n title?: string\n lastUpdateTime?: string\n creationTime?: string\n}\n```\n\n### `ClosingReasonCategoryPayload`\n\n```ts\ntype ClosingReasonCategoryPayload = {\n title: string\n}\n```\n\n### `ClosingReasonCategoryNotFoundResp`\n\nError response returned when a closing reason category is not found.\n\n```ts\ntype ClosingReasonCategoryNotFoundResp = {\n message?: string\n}\n```\n\n### `ClosingReasonsStatus`\n\n```ts\ntype ClosingReasonsStatus = \"ACTIVE\" | \"INACTIVE\"\n```\n\n### `ClosingReasonsIds`\n\n```ts\ntype ClosingReasonsIds = {\n reasons: Array<{\n id: string\n }>\n}\n```\n\n### `ClosingReasonId`\n\n```ts\ntype ClosingReasonId = {\n id: string\n}\n```\n\n### `ErrorResp`\n\nStandard error response returned when an API request fails.\n\n```ts\ntype ErrorResp = {\n message?: string\n}\n```\n\n### `UpdateEntityAttributes`\n\n```ts\ntype UpdateEntityAttributes = {\n source: \"workflow_status\" | \"current_section\" | \"current_step\"\n target: {\n entitySchema: string\n entityAttribute: string\n }\n}\n```\n\n### `EntitySync`\n\n```ts\ntype EntitySync = {\n trigger: {\n event: \"FlowStarted\" | \"FlowCompleted\" | \"FlowCancelled\" | \"FlowReopened\" | \"FlowDeleted\" | \"FlowAssigned\" | \"FlowDueDateChanged\" | \"FlowContextsChanged\" | \"TaskUpdated\" | \"CurrTaskChanged\" | \"TaskCompleted\" | \"TaskSkipped\" | \"TaskMarkedInProgress\" | \"TaskMarkedOnHold\" | \"PhaseUpdated\" | \"PhaseCompleted\" | \"PhaseSkipped\" | \"PhaseMarkedInProgress\"\n filter?: {\n task_template_id?: { ... }\n phase_template_id?: { ... }\n }\n }\n value: {\n source: \"workflow_name\" | \"workflow_status\" | \"workflow_assigned_to\" | \"task_name\" | \"task_status\" | \"task_assigned_to\" | \"phase_name\" | \"phase_status\" | \"phase_assigned_to\" | \"custom_value\"\n value?: string\n }\n target: {\n entitySchema: string\n entityAttribute: string\n }\n}\n```\n\n### `DynamicDueDate`\n\nConfiguration for calculating a due date dynamically based on workflow events.\nThe due date is computed by adding a duration (numberOfUnits + timePeriod) to\na reference point defined by actionTypeCondition (e.g., when workflow started,\nwhen a step closed, or when a phase finished).\n\n\n```ts\ntype DynamicDueDate = {\n numberOfUnits: number\n timePeriod: \"minutes\" | \"hours\" | \"days\" | \"weeks\" | \"months\" | \"years\"\n actionTypeCondition: \"WORKFLOW_STARTED\" | \"STEP_CLOSED\" | \"PHASE_FINISHED\"\n stepId?: string\n phaseId?: string\n}\n```\n\n### `StepRequirement`\n\ndescribe the requirement for step enablement\n\n```ts\ntype StepRequirement = {\n definitionId: string\n type: \"STEP\" | \"SECTION\"\n condition: \"CLOSED\"\n}\n```\n\n### `JourneyContextUsagesReq`\n\nRequest payload for getJourneyContextUsages.\n\n```ts\ntype JourneyContextUsagesReq = {\n journey_id: string\n param_keys: string[]\n param_ids?: string[]\n}\n```\n\n### `JourneyContextUsage`\n\nOne place a flow template task presets one of the requested context parameters.\n\n```ts\ntype JourneyContextUsage = {\n kind: \"workflow-task\"\n resource: {\n type: \"workflow_template\"\n id: string\n name?: string\n }\n location?: {\n task_id?: string\n task_name?: string\n }\n matched_as: {\n dialect: \"name\"\n token: string\n at: string\n }\n link_hint?: {\n route: \"workflows-hub-flow\"\n params: {\n template_id: { ... }\n }\n }\n}\n```\n\n### `JourneyContextUsagesResp`\n\nResponse payload for getJourneyContextUsages.\n\n```ts\ntype JourneyContextUsagesResp = {\n usages: Array<{\n kind: \"workflow-task\"\n resource: {\n type: { ... }\n id: { ... }\n name?: { ... }\n }\n location?: {\n task_id?: { ... }\n task_name?: { ... }\n }\n matched_as: {\n dialect: { ... }\n token: { ... }\n at: { ... }\n }\n link_hint?: {\n route: { ... }\n params: { ... }\n }\n }>\n status: \"ok\" | \"partial\"\n scanned: number\n}\n```\n" diff --git a/packages/epilot-sdk-v2/src/types/workflow-definition.d.ts b/packages/epilot-sdk-v2/src/types/workflow-definition.d.ts index 15e4cad8..8ded7ecd 100644 --- a/packages/epilot-sdk-v2/src/types/workflow-definition.d.ts +++ b/packages/epilot-sdk-v2/src/types/workflow-definition.d.ts @@ -359,9 +359,56 @@ export declare namespace Components { id?: string; title?: string; status?: ClosingReasonsStatus; + /** + * Id of the category the reason is grouped under. Omit or send null for a reason without a category. + * example: + * c9wq81x + */ + categoryId?: string | null; + category?: /* The reason's category, resolved when a flow template is read. Ignored on writes. */ ClosingReasonCategoryRef; + lastUpdateTime?: string; + creationTime?: string; + } + export interface ClosingReasonCategories { + categories: /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ ClosingReasonCategory[]; + } + /** + * A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons + */ + export interface ClosingReasonCategory { + id?: string; + /** + * example: + * Wirtschaftlichkeit + */ + title?: string; lastUpdateTime?: string; creationTime?: string; } + /** + * Error response returned when a closing reason category is not found. + */ + export interface ClosingReasonCategoryNotFoundResp { + /** + * example: + * Closing reason category not found + */ + message?: string; + } + export interface ClosingReasonCategoryPayload { + /** + * example: + * Wirtschaftlichkeit + */ + title: string; + } + /** + * The reason's category, resolved when a flow template is read. Ignored on writes. + */ + export interface ClosingReasonCategoryRef { + id: string; + title: string; + } export interface ClosingReasonId { /** * example: @@ -2092,6 +2139,15 @@ export declare namespace Paths { export type $201 = /* One Closing reason for a workflow */ Components.Schemas.ClosingReason; } } + namespace CreateClosingReasonCategory { + export type RequestBody = Components.Schemas.ClosingReasonCategoryPayload; + namespace Responses { + export type $201 = /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ Components.Schemas.ClosingReasonCategory; + export type $400 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $409 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + } + } namespace CreateDefinition { export type RequestBody = /** * V1 workflow definition schema. Defines a linear workflow structure with sections @@ -2167,6 +2223,14 @@ export declare namespace Paths { export type $404 = /* Error response returned when a closing reason is not found. */ Components.Schemas.ClosingReasonNotFoundResp; } } + namespace DeleteClosingReasonCategory { + namespace Responses { + export interface $204 { + } + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $404 = /* Error response returned when a closing reason category is not found. */ Components.Schemas.ClosingReasonCategoryNotFoundResp; + } + } namespace DeleteDefinition { namespace Parameters { export type DefinitionId = string; @@ -2228,6 +2292,12 @@ export declare namespace Paths { export type $500 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; } } + namespace GetAllClosingReasonCategories { + namespace Responses { + export type $200 = Components.Schemas.ClosingReasonCategories; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + } + } namespace GetAllClosingReasons { namespace Parameters { export type IncludeInactive = boolean; @@ -2261,6 +2331,13 @@ export declare namespace Paths { export type $404 = /* Error response returned when a closing reason is not found. */ Components.Schemas.ClosingReasonNotFoundResp; } } + namespace GetClosingReasonCategory { + namespace Responses { + export type $200 = /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ Components.Schemas.ClosingReasonCategory; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $404 = /* Error response returned when a closing reason category is not found. */ Components.Schemas.ClosingReasonCategoryNotFoundResp; + } + } namespace GetClosingReasonV1 { namespace Parameters { export type ReasonId = string; @@ -2426,6 +2503,16 @@ export declare namespace Paths { export type $404 = /* Error response returned when a closing reason is not found. */ Components.Schemas.ClosingReasonNotFoundResp; } } + namespace UpdateClosingReasonCategory { + export type RequestBody = Components.Schemas.ClosingReasonCategoryPayload; + namespace Responses { + export type $200 = /* A category that groups closing reasons, e.g. "Wirtschaftlichkeit" for several economic reasons */ Components.Schemas.ClosingReasonCategory; + export type $400 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $403 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + export type $404 = /* Error response returned when a closing reason category is not found. */ Components.Schemas.ClosingReasonCategoryNotFoundResp; + export type $409 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; + } + } namespace UpdateDefinition { namespace Parameters { export type DefinitionId = string; @@ -2495,6 +2582,22 @@ export declare namespace Paths { export type $500 = /* Standard error response returned when an API request fails. */ Components.Schemas.ErrorResp; } } + namespace V1WorkflowsClosingReasonCategories$CategoryId { + namespace Parameters { + /** + * example: + * c9wq81x + */ + export type CategoryId = string; + } + export interface PathParameters { + categoryId: /** + * example: + * c9wq81x + */ + Parameters.CategoryId; + } + } } @@ -2713,6 +2816,56 @@ export interface OperationMethods { data?: Paths.ChangeReasonStatus.RequestBody, config?: AxiosRequestConfig ): OperationResponse + /** + * getAllClosingReasonCategories - getAllClosingReasonCategories + * + * Get all closing reason categories defined in the organization. + */ + 'getAllClosingReasonCategories'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * createClosingReasonCategory - createClosingReasonCategory + * + * Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace. + */ + 'createClosingReasonCategory'( + parameters?: Parameters | null, + data?: Paths.CreateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + /** + * getClosingReasonCategory - getClosingReasonCategory + * + * Get a closing reason category by id. + */ + 'getClosingReasonCategory'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * updateClosingReasonCategory - updateClosingReasonCategory + * + * Rename a closing reason category. Running flows keep the title they started with. + */ + 'updateClosingReasonCategory'( + parameters?: Parameters | null, + data?: Paths.UpdateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + /** + * deleteClosingReasonCategory - deleteClosingReasonCategory + * + * Delete a closing reason category. Its reasons are kept and lose their category. + */ + 'deleteClosingReasonCategory'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse /** * getWorkflowClosingReasons - getWorkflowClosingReasons * @@ -2970,6 +3123,60 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/v1/workflows/closing-reason-categories']: { + /** + * getAllClosingReasonCategories - getAllClosingReasonCategories + * + * Get all closing reason categories defined in the organization. + */ + 'get'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * createClosingReasonCategory - createClosingReasonCategory + * + * Create a category that closing reasons can be grouped under. Titles are unique per organization, ignoring case and surrounding whitespace. + */ + 'post'( + parameters?: Parameters | null, + data?: Paths.CreateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + } + ['/v1/workflows/closing-reason-categories/{categoryId}']: { + /** + * getClosingReasonCategory - getClosingReasonCategory + * + * Get a closing reason category by id. + */ + 'get'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + /** + * updateClosingReasonCategory - updateClosingReasonCategory + * + * Rename a closing reason category. Running flows keep the title they started with. + */ + 'patch'( + parameters?: Parameters | null, + data?: Paths.UpdateClosingReasonCategory.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + /** + * deleteClosingReasonCategory - deleteClosingReasonCategory + * + * Delete a closing reason category. Its reasons are kept and lose their category. + */ + 'delete'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + } ['/v1/workflows/definitions/{definitionId}/closing-reasons']: { /** * getWorkflowClosingReasons - getWorkflowClosingReasons @@ -3013,6 +3220,11 @@ export type AutomationTask = Components.Schemas.AutomationTask; export type AutomationTrigger = Components.Schemas.AutomationTrigger; export type ChangeReasonStatusReq = Components.Schemas.ChangeReasonStatusReq; export type ClosingReason = Components.Schemas.ClosingReason; +export type ClosingReasonCategories = Components.Schemas.ClosingReasonCategories; +export type ClosingReasonCategory = Components.Schemas.ClosingReasonCategory; +export type ClosingReasonCategoryNotFoundResp = Components.Schemas.ClosingReasonCategoryNotFoundResp; +export type ClosingReasonCategoryPayload = Components.Schemas.ClosingReasonCategoryPayload; +export type ClosingReasonCategoryRef = Components.Schemas.ClosingReasonCategoryRef; export type ClosingReasonId = Components.Schemas.ClosingReasonId; export type ClosingReasonNotFoundResp = Components.Schemas.ClosingReasonNotFoundResp; export type ClosingReasons = Components.Schemas.ClosingReasons;