Data Models

This section describes the data models used in the Dify client.

App Token

class AppToken

Represents an API token for an application.

id: str

Unique identifier for the token

type: Literal["app"]

Token type, always “app”

token: str

The actual token string

last_used_at: Optional[int]

Timestamp of last usage

created_at: int

Timestamp of creation

Workflow Models

class WorkflowDraft

Represents a workflow configuration draft.

graph: Optional[Graph]

The workflow graph structure

features: dict

Feature configuration

environment_variables: list

Environment variables used in the workflow

conversation_variables: list

Conversation variables used in the workflow

Graph Models

class Graph

Represents the complete workflow graph structure.

nodes: list[GraphNode]

List of nodes in the graph

edges: list[GraphEdge]

List of edges connecting the nodes

viewport: Viewport

View configuration for the graph

class GraphNode

Represents a node in the workflow graph.

id: str

Unique identifier for the node

type: str

Node type

data: dict

Node configuration data

position: dict

Node position in the graph

targetPosition: str

Position of target connection point

sourcePosition: str

Position of source connection point

positionAbsolute: dict

Absolute position in the graph

width: int

Node width

height: int

Node height

class GraphEdge

Represents an edge connecting two nodes in the workflow graph.

id: str

Unique identifier for the edge

type: str

Edge type

source: str

Source node ID

sourceHandle: str

Source connection point

target: str

Target node ID

targetHandle: str

Target connection point

data: GraphEdgeData

Edge configuration data

zIndex: int

Z-index for rendering

class GraphEdgeData

Configuration data for graph edges.

sourceType: GraphNodeDataTypes

Type of the source node

targetType: GraphNodeDataTypes

Type of the target node

isInIteration: bool

Whether the edge is part of an iteration

class GraphNodeData

Configuration data for graph nodes.

type: GraphNodeDataTypes

Node type (start, end, or llm)

title: str

Node title

description: str

Node description

variables: list

List of variables used by the node

class Viewport

Graph view configuration.

x: Optional[int]

X coordinate of the viewport (default: 0)

y: Optional[int]

Y coordinate of the viewport (default: 0)

zoom: Optional[int]

Zoom level (default: 1)