Skip to content
Start here

Get Workflow version graph

workflows.versions.graph(strversion_id, VersionGraphParams**kwargs) -> VersionGraphResponse
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
account_id: str
workflow_name: str
maxLength64
minLength1
version_id: str
formatuuid
ReturnsExpand Collapse
class VersionGraphResponse:
id: str
formatuuid
class_name: str
created_on: datetime
formatdate-time
graph: Optional[Graph]

Versioned workflow graph payload.

version: float
workflow: GraphWorkflow

A parsed workflow entrypoint with its step graph.

class_name: str
functions: Dict[str, GraphWorkflowFunctions]
name: str
nodes: List[object]

Child nodes (recursive).

type: Literal["function_def"]
nodes: List[GraphWorkflowNode]
One of the following:
class GraphWorkflowNodeUnionMember0:
duration: Union[float, str]

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

One of the following:
float
str
name: str
type: Literal["step_sleep"]
resolves: Optional[float]
starts: Optional[float]
class GraphWorkflowNodeUnionMember1:
config: GraphWorkflowNodeUnionMember1Config

Configuration for a step (retries and timeout).

retries: GraphWorkflowNodeUnionMember1ConfigRetries

Retry policy for a step.

backoff: Literal["constant", "linear", "exponential"]

Backoff strategy for step retries.

One of the following:
"constant"
"linear"
"exponential"
delay: Union[float, str]

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

One of the following:
float
str
limit: float
timeout: Union[float, str]

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

One of the following:
float
str
name: str
nodes: List[object]

Child nodes (recursive).

type: Literal["step_do"]
resolves: Optional[float]
starts: Optional[float]
class GraphWorkflowNodeUnionMember2:
name: str
options: Optional[GraphWorkflowNodeUnionMember2Options]

Options for a waitForEvent step.

event_type: str
timeout: Union[float, str]

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

One of the following:
float
str
type: Literal["step_wait_for_event"]
payload: Optional[GraphWorkflowNodeUnionMember2Payload]

Shape descriptor for JSON payloads.

One of the following:
class GraphWorkflowNodeUnionMember2PayloadType:
type: Literal["unknown"]
class GraphWorkflowNodeUnionMember2PayloadUnionMember1:
fields: Dict[str, object]

Nested JsonShape fields (recursive structure).

type: Literal["object"]
resolves: Optional[float]
starts: Optional[float]
class GraphWorkflowNodeUnionMember3:
name: str
timestamp: str
type: Literal["step_sleep_until"]
resolves: Optional[float]
starts: Optional[float]
class GraphWorkflowNodeUnionMember4:
nodes: List[object]

Child nodes (recursive).

type: Literal["loop"]
class GraphWorkflowNodeUnionMember5:
kind: Literal["all", "any", "all_settled", "race"]

Parallel execution strategy.

One of the following:
"all"
"any"
"all_settled"
"race"
nodes: List[object]

Child nodes (recursive).

type: Literal["parallel"]
class GraphWorkflowNodeUnionMember6:
catch_block: Optional[GraphWorkflowNodeUnionMember6CatchBlock]
nodes: List[object]

Child nodes (recursive).

type: Literal["block"]
finally_block: Optional[GraphWorkflowNodeUnionMember6FinallyBlock]
nodes: List[object]

Child nodes (recursive).

type: Literal["block"]
try_block: Optional[GraphWorkflowNodeUnionMember6TryBlock]
nodes: List[object]

Child nodes (recursive).

type: Literal["block"]
type: Literal["try"]
class GraphWorkflowNodeUnionMember7:
nodes: List[object]

Child nodes (recursive).

type: Literal["block"]
class GraphWorkflowNodeUnionMember8:
branches: List[GraphWorkflowNodeUnionMember8Branch]
condition: Optional[str]
nodes: List[object]

Child nodes (recursive).

type: Literal["if"]
class GraphWorkflowNodeUnionMember9:
branches: List[GraphWorkflowNodeUnionMember9Branch]
condition: Optional[str]
nodes: List[object]

Child nodes (recursive).

discriminant: str
type: Literal["switch"]
class GraphWorkflowNodeUnionMember10:
class_name: str
functions: Dict[str, GraphWorkflowNodeUnionMember10Functions]
name: str
nodes: List[object]

Child nodes (recursive).

type: Literal["function_def"]
nodes: List[object]

Child nodes (recursive).

type: Literal["start"]
payload: Optional[GraphWorkflowNodeUnionMember10Payload]

Shape descriptor for JSON payloads.

One of the following:
class GraphWorkflowNodeUnionMember10PayloadType:
type: Literal["unknown"]
class GraphWorkflowNodeUnionMember10PayloadUnionMember1:
fields: Dict[str, object]

Nested JsonShape fields (recursive structure).

type: Literal["object"]
class GraphWorkflowNodeUnionMember11:
name: str
type: Literal["function_call"]
resolves: Optional[float]
starts: Optional[float]
class GraphWorkflowNodeUnionMember12:
name: str
nodes: List[object]

Child nodes (recursive).

type: Literal["function_def"]
class GraphWorkflowNodeUnionMember13:
kind: Literal["break", "return"]

Break or return from a loop.

One of the following:
"break"
"return"
type: Literal["break"]
payload: Optional[GraphWorkflowPayload]

Shape descriptor for JSON payloads.

One of the following:
class GraphWorkflowPayloadType:
type: Literal["unknown"]
class GraphWorkflowPayloadUnionMember1:
fields: Dict[str, object]

Nested JsonShape fields (recursive structure).

type: Literal["object"]
modified_on: datetime
formatdate-time
workflow_id: str
formatuuid

Get Workflow version graph

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
response = client.workflows.versions.graph(
    version_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    account_id="account_id",
    workflow_name="x",
)
print(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
  }
}