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)
Base Models
- class BaseModel
Base model with common functionality for all data models.
- created_datetime -> Optional[datetime]
Get creation timestamp as datetime object.
- Returns:
Datetime object or None
- updated_datetime -> Optional[datetime]
Get update timestamp as datetime object.
- Returns:
Datetime object or None
Pagination Models
Logging Models
- class AgentConversation
Represents a single agent or chat conversation.
- agent_model_config: Dict
Model configuration for the agent (aliased as “model_config” in API)
- user_feedback_stats: Dict
Statistics about user feedback
- admin_feedback_stats: Dict
Statistics about admin feedback
- status_count: Dict
Count of different statuses
- class ChatMessage
Represents a single chat message in a conversation.
- class PaginatedChatMessages
Paginated response containing chat messages.
Inherits from
PaginatedResponsewithChatMessageas the item type.- data: List[ChatMessage]
List of chat messages in the current page
- class PaginatedAgentLogs
Paginated response containing agent conversation logs.
Inherits from
PaginatedResponsewithAgentConversationas the item type.- data: List[AgentConversation]
List of conversations in the current page
- class PaginatedWorkflowLogs
Paginated response containing workflow execution logs.
Inherits from
PaginatedResponsewithWorkflowLogEntryas the item type.- data: List[WorkflowLogEntry]
List of workflow log entries in the current page
Workflow Execution Models
- class WorkflowNodeExecutionMetadata
Metadata about workflow node execution.
- class WorkflowNodeExecutions
Container for a list of node executions.
- data: List[WorkflowNodeExecution]
List of node executions