# Versions ## List deployed Workflow versions `client.workflows.versions.list(stringworkflowName, VersionListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/workflows/{workflow_name}/versions` Lists all deployed versions of a workflow. ### Parameters - `workflowName: string` - `params: VersionListParams` - `account_id: string` Path param - `page?: number` Query param - `per_page?: number` Query param ### Returns - `VersionListResponse` - `id: string` - `class_name: string` - `created_on: string` - `has_dag: boolean` - `language: "javascript" | "python"` The programming language of the workflow implementation - `"javascript"` - `"python"` - `modified_on: string` - `workflow_id: string` - `limits?: Limits` - `steps?: number` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const versionListResponse of client.workflows.versions.list('x', { account_id: 'account_id', })) { console.log(versionListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "class_name": "class_name", "created_on": "2019-12-27T18:11:19.117Z", "has_dag": true, "language": "javascript", "modified_on": "2019-12-27T18:11:19.117Z", "workflow_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "limits": { "steps": 1 } } ], "success": true, "result_info": { "count": 0, "per_page": 0, "total_count": 0, "cursor": "cursor", "page": 0, "total_pages": 0 } } ``` ## Get Workflow version details `client.workflows.versions.get(stringversionID, VersionGetParamsparams, RequestOptionsoptions?): VersionGetResponse` **get** `/accounts/{account_id}/workflows/{workflow_name}/versions/{version_id}` Retrieves details for a specific deployed workflow version. ### Parameters - `versionID: string` - `params: VersionGetParams` - `account_id: string` - `workflow_name: string` ### Returns - `VersionGetResponse` - `id: string` - `class_name: string` - `created_on: string` - `has_dag: boolean` - `language: "javascript" | "python"` The programming language of the workflow implementation - `"javascript"` - `"python"` - `modified_on: string` - `workflow_id: string` - `limits?: Limits` - `steps?: number` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const version = await client.workflows.versions.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: 'account_id', workflow_name: 'x', }); console.log(version.id); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "class_name": "class_name", "created_on": "2019-12-27T18:11:19.117Z", "has_dag": true, "language": "javascript", "modified_on": "2019-12-27T18:11:19.117Z", "workflow_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "limits": { "steps": 1 } }, "success": true, "result_info": { "count": 0, "per_page": 0, "total_count": 0, "cursor": "cursor", "page": 0, "total_pages": 0 } } ``` ## Get Workflow version graph `client.workflows.versions.graph(stringversionID, VersionGraphParamsparams, RequestOptionsoptions?): VersionGraphResponse` **get** `/accounts/{account_id}/workflows/{workflow_name}/versions/{version_id}/graph` Retrieves the graph visualization of a workflow version. ### Parameters - `versionID: string` - `params: VersionGraphParams` - `account_id: string` - `workflow_name: string` ### Returns - `VersionGraphResponse` - `id: string` - `class_name: string` - `created_on: string` - `graph: Graph | null` Versioned workflow graph payload. - `version: number` - `workflow: Workflow` A parsed workflow entrypoint with its step graph. - `class_name: string` - `functions: Record` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "function_def"` - `"function_def"` - `nodes: Array` - `UnionMember0` - `duration: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `name: string` - `type: "step_sleep"` - `"step_sleep"` - `resolves?: number` - `starts?: number` - `UnionMember1` - `config: Config` Configuration for a step (retries and timeout). - `retries: Retries` Retry policy for a step. - `backoff: "constant" | "linear" | "exponential"` Backoff strategy for step retries. - `"constant"` - `"linear"` - `"exponential"` - `delay: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `limit: number` - `timeout: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "step_do"` - `"step_do"` - `resolves?: number` - `starts?: number` - `UnionMember2` - `name: string` - `options: Options | null` Options for a waitForEvent step. - `event_type: string` - `timeout: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `type: "step_wait_for_event"` - `"step_wait_for_event"` - `payload?: Type | UnionMember1` Shape descriptor for JSON payloads. - `Type` - `type: "unknown"` - `"unknown"` - `UnionMember1` - `fields: Record` Nested JsonShape fields (recursive structure). - `type: "object"` - `"object"` - `resolves?: number` - `starts?: number` - `UnionMember3` - `name: string` - `timestamp: string` - `type: "step_sleep_until"` - `"step_sleep_until"` - `resolves?: number` - `starts?: number` - `UnionMember4` - `nodes: Array` Child nodes (recursive). - `type: "loop"` - `"loop"` - `UnionMember5` - `kind: "all" | "any" | "all_settled" | "race"` Parallel execution strategy. - `"all"` - `"any"` - `"all_settled"` - `"race"` - `nodes: Array` Child nodes (recursive). - `type: "parallel"` - `"parallel"` - `UnionMember6` - `catch_block: CatchBlock | null` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `finally_block: FinallyBlock | null` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `try_block: TryBlock | null` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `type: "try"` - `"try"` - `UnionMember7` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `UnionMember8` - `branches: Array` - `condition: string | null` - `nodes: Array` Child nodes (recursive). - `type: "if"` - `"if"` - `UnionMember9` - `branches: Array` - `condition: string | null` - `nodes: Array` Child nodes (recursive). - `discriminant: string` - `type: "switch"` - `"switch"` - `UnionMember10` - `class_name: string` - `functions: Record` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "function_def"` - `"function_def"` - `nodes: Array` Child nodes (recursive). - `type: "start"` - `"start"` - `payload?: Type | UnionMember1` Shape descriptor for JSON payloads. - `Type` - `type: "unknown"` - `"unknown"` - `UnionMember1` - `fields: Record` Nested JsonShape fields (recursive structure). - `type: "object"` - `"object"` - `UnionMember11` - `name: string` - `type: "function_call"` - `"function_call"` - `resolves?: number` - `starts?: number` - `UnionMember12` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "function_def"` - `"function_def"` - `UnionMember13` - `kind: "break" | "return"` Break or return from a loop. - `"break"` - `"return"` - `type: "break"` - `"break"` - `payload?: Type | UnionMember1` Shape descriptor for JSON payloads. - `Type` - `type: "unknown"` - `"unknown"` - `UnionMember1` - `fields: Record` Nested JsonShape fields (recursive structure). - `type: "object"` - `"object"` - `modified_on: string` - `workflow_id: string` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.workflows.versions.graph('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: 'account_id', workflow_name: 'x', }); console.log(response.id); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "class_name": "class_name", "created_on": "2019-12-27T18:11:19.117Z", "graph": { "version": 0, "workflow": { "class_name": "class_name", "functions": { "foo": { "name": "name", "nodes": [ {} ], "type": "function_def" } }, "nodes": [ { "duration": 0, "name": "name", "type": "step_sleep", "resolves": 0, "starts": 0 } ], "payload": { "type": "unknown" } } }, "modified_on": "2019-12-27T18:11:19.117Z", "workflow_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" }, "success": true, "result_info": { "count": 0, "per_page": 0, "total_count": 0, "cursor": "cursor", "page": 0, "total_pages": 0 } } ``` ## Domain Types ### Version List Response - `VersionListResponse` - `id: string` - `class_name: string` - `created_on: string` - `has_dag: boolean` - `language: "javascript" | "python"` The programming language of the workflow implementation - `"javascript"` - `"python"` - `modified_on: string` - `workflow_id: string` - `limits?: Limits` - `steps?: number` ### Version Get Response - `VersionGetResponse` - `id: string` - `class_name: string` - `created_on: string` - `has_dag: boolean` - `language: "javascript" | "python"` The programming language of the workflow implementation - `"javascript"` - `"python"` - `modified_on: string` - `workflow_id: string` - `limits?: Limits` - `steps?: number` ### Version Graph Response - `VersionGraphResponse` - `id: string` - `class_name: string` - `created_on: string` - `graph: Graph | null` Versioned workflow graph payload. - `version: number` - `workflow: Workflow` A parsed workflow entrypoint with its step graph. - `class_name: string` - `functions: Record` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "function_def"` - `"function_def"` - `nodes: Array` - `UnionMember0` - `duration: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `name: string` - `type: "step_sleep"` - `"step_sleep"` - `resolves?: number` - `starts?: number` - `UnionMember1` - `config: Config` Configuration for a step (retries and timeout). - `retries: Retries` Retry policy for a step. - `backoff: "constant" | "linear" | "exponential"` Backoff strategy for step retries. - `"constant"` - `"linear"` - `"exponential"` - `delay: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `limit: number` - `timeout: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "step_do"` - `"step_do"` - `resolves?: number` - `starts?: number` - `UnionMember2` - `name: string` - `options: Options | null` Options for a waitForEvent step. - `event_type: string` - `timeout: number | string` Duration as milliseconds (number) or human-readable string. - `number` - `string` - `type: "step_wait_for_event"` - `"step_wait_for_event"` - `payload?: Type | UnionMember1` Shape descriptor for JSON payloads. - `Type` - `type: "unknown"` - `"unknown"` - `UnionMember1` - `fields: Record` Nested JsonShape fields (recursive structure). - `type: "object"` - `"object"` - `resolves?: number` - `starts?: number` - `UnionMember3` - `name: string` - `timestamp: string` - `type: "step_sleep_until"` - `"step_sleep_until"` - `resolves?: number` - `starts?: number` - `UnionMember4` - `nodes: Array` Child nodes (recursive). - `type: "loop"` - `"loop"` - `UnionMember5` - `kind: "all" | "any" | "all_settled" | "race"` Parallel execution strategy. - `"all"` - `"any"` - `"all_settled"` - `"race"` - `nodes: Array` Child nodes (recursive). - `type: "parallel"` - `"parallel"` - `UnionMember6` - `catch_block: CatchBlock | null` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `finally_block: FinallyBlock | null` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `try_block: TryBlock | null` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `type: "try"` - `"try"` - `UnionMember7` - `nodes: Array` Child nodes (recursive). - `type: "block"` - `"block"` - `UnionMember8` - `branches: Array` - `condition: string | null` - `nodes: Array` Child nodes (recursive). - `type: "if"` - `"if"` - `UnionMember9` - `branches: Array` - `condition: string | null` - `nodes: Array` Child nodes (recursive). - `discriminant: string` - `type: "switch"` - `"switch"` - `UnionMember10` - `class_name: string` - `functions: Record` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "function_def"` - `"function_def"` - `nodes: Array` Child nodes (recursive). - `type: "start"` - `"start"` - `payload?: Type | UnionMember1` Shape descriptor for JSON payloads. - `Type` - `type: "unknown"` - `"unknown"` - `UnionMember1` - `fields: Record` Nested JsonShape fields (recursive structure). - `type: "object"` - `"object"` - `UnionMember11` - `name: string` - `type: "function_call"` - `"function_call"` - `resolves?: number` - `starts?: number` - `UnionMember12` - `name: string` - `nodes: Array` Child nodes (recursive). - `type: "function_def"` - `"function_def"` - `UnionMember13` - `kind: "break" | "return"` Break or return from a loop. - `"break"` - `"return"` - `type: "break"` - `"break"` - `payload?: Type | UnionMember1` Shape descriptor for JSON payloads. - `Type` - `type: "unknown"` - `"unknown"` - `UnionMember1` - `fields: Record` Nested JsonShape fields (recursive structure). - `type: "object"` - `"object"` - `modified_on: string` - `workflow_id: string`