Skip to content
Start here

Get Workflow version graph

client.workflows.versions.graph(stringworkflowName, stringversionId, VersionGraphParams { account_id } params, RequestOptionsoptions?): VersionGraphResponse { id, class_name, created_on, 3 more }
GET/accounts/{account_id}/workflows/{workflow_name}/versions/{version_id}/graph

Retrieves the graph visualization of a workflow version.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers Tail ReadWorkers Scripts WriteWorkers Scripts Read
ParametersExpand Collapse
workflowName: string
maxLength64
minLength1
versionId: string
formatuuid
params: VersionGraphParams { account_id }
account_id: string
ReturnsExpand Collapse
VersionGraphResponse { id, class_name, created_on, 3 more }
id: string
formatuuid
class_name: string
created_on: string
formatdate-time
graph: Graph | null

Versioned workflow graph payload.

version: number
workflow: Workflow { class_name, functions, nodes, payload }

A parsed workflow entrypoint with its step graph.

class_name: string
functions: Record<string, Functions>
name: string
nodes: Array<unknown>

Child nodes (recursive).

type: "function_def"
nodes: Array<UnionMember0 { duration, name, type, 2 more } | UnionMember1 { config, name, nodes, 3 more } | UnionMember2 { name, options, type, 3 more } | 11 more>
One of the following:
UnionMember0 { duration, name, type, 2 more }
duration: number | string

Duration as milliseconds (number) or human-readable string.

One of the following:
number
string
name: string
type: "step_sleep"
resolves?: number
starts?: number
UnionMember1 { config, name, nodes, 3 more }
config: Config { retries, timeout }

Configuration for a step (retries and timeout).

retries: Retries { backoff, delay, limit }

Retry policy for a step.

backoff: "constant" | "linear" | "exponential"

Backoff strategy for step retries.

One of the following:
"constant"
"linear"
"exponential"
delay: number | string

Duration as milliseconds (number) or human-readable string.

One of the following:
number
string
limit: number
timeout: number | string

Duration as milliseconds (number) or human-readable string.

One of the following:
number
string
name: string
nodes: Array<unknown>

Child nodes (recursive).

type: "step_do"
resolves?: number
starts?: number
UnionMember2 { name, options, type, 3 more }
name: string
options: Options | null

Options for a waitForEvent step.

event_type: string
timeout: number | string

Duration as milliseconds (number) or human-readable string.

One of the following:
number
string
type: "step_wait_for_event"
payload?: Type { type } | UnionMember1 { fields, type }

Shape descriptor for JSON payloads.

One of the following:
Type { type }
type: "unknown"
UnionMember1 { fields, type }
fields: Record<string, unknown>

Nested JsonShape fields (recursive structure).

type: "object"
resolves?: number
starts?: number
UnionMember3 { name, timestamp, type, 2 more }
name: string
timestamp: string
type: "step_sleep_until"
resolves?: number
starts?: number
UnionMember4 { nodes, type }
nodes: Array<unknown>

Child nodes (recursive).

type: "loop"
UnionMember5 { kind, nodes, type }
kind: "all" | "any" | "all_settled" | "race"

Parallel execution strategy.

One of the following:
"all"
"any"
"all_settled"
"race"
nodes: Array<unknown>

Child nodes (recursive).

type: "parallel"
UnionMember6 { catch_block, finally_block, try_block, type }
catch_block: CatchBlock | null
nodes: Array<unknown>

Child nodes (recursive).

type: "block"
finally_block: FinallyBlock | null
nodes: Array<unknown>

Child nodes (recursive).

type: "block"
try_block: TryBlock | null
nodes: Array<unknown>

Child nodes (recursive).

type: "block"
type: "try"
UnionMember7 { nodes, type }
nodes: Array<unknown>

Child nodes (recursive).

type: "block"
UnionMember8 { branches, type }
branches: Array<Branch>
condition: string | null
nodes: Array<unknown>

Child nodes (recursive).

type: "if"
UnionMember9 { branches, discriminant, type }
branches: Array<Branch>
condition: string | null
nodes: Array<unknown>

Child nodes (recursive).

discriminant: string
type: "switch"
UnionMember10 { class_name, functions, nodes, 2 more }
class_name: string
functions: Record<string, Functions>
name: string
nodes: Array<unknown>

Child nodes (recursive).

type: "function_def"
nodes: Array<unknown>

Child nodes (recursive).

type: "start"
payload?: Type { type } | UnionMember1 { fields, type }

Shape descriptor for JSON payloads.

One of the following:
Type { type }
type: "unknown"
UnionMember1 { fields, type }
fields: Record<string, unknown>

Nested JsonShape fields (recursive structure).

type: "object"
UnionMember11 { name, type, resolves, starts }
name: string
type: "function_call"
resolves?: number
starts?: number
UnionMember12 { name, nodes, type }
name: string
nodes: Array<unknown>

Child nodes (recursive).

type: "function_def"
UnionMember13 { kind, type }
kind: "break" | "return"

Break or return from a loop.

One of the following:
"break"
"return"
type: "break"
payload?: Type { type } | UnionMember1 { fields, type }

Shape descriptor for JSON payloads.

One of the following:
Type { type }
type: "unknown"
UnionMember1 { fields, type }
fields: Record<string, unknown>

Nested JsonShape fields (recursive structure).

type: "object"
modified_on: string
formatdate-time
workflow_id: string
formatuuid

Get Workflow version graph

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(
  'x',
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  { account_id: 'account_id' },
);

console.log(response.id);
{
  "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
  }
}
Returns Examples
{
  "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
  }
}