For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
PlaygroundDiscordStatusDashboardSign Up >
DocumentationSDK ReferenceGraphiti
DocumentationSDK ReferenceGraphiti
  • SDK Reference
      • PUTSet graph ontology
      • GETList graph ontology
      • POSTAdd Data
      • POSTAdd Data in batch mode
      • POSTAdd Fact Triple
      • POSTClone graph
      • POSTCreate Graph
      • GETList all graphs.
      • POSTDetect Patterns (Experimental)
      • POSTSearch Graph
      • GETGet Graph
      • DELDelete Graph
      • PATCHUpdate Graph.
      • GETWarm Graph Cache
LogoLogo
PlaygroundDiscordStatusDashboardSign Up >
SDK ReferenceGraph

Detect Patterns (Experimental)

POST
https://api.getzep.com/api/v2/graph/patterns
POST
/api/v2/graph/patterns
1from zep_cloud import Zep
2
3client = Zep(
4 api_key="YOUR_API_KEY",
5)
6client.graph.detect_patterns()
1{
2 "metadata": {
3 "edges_analyzed": 1,
4 "elapsed_ms": 1,
5 "nodes_analyzed": 1
6 },
7 "nodes": [
8 {
9 "created_at": "string",
10 "name": "string",
11 "summary": "string",
12 "uuid": "string",
13 "attributes": {},
14 "labels": [
15 "string"
16 ],
17 "relevance": 1.1,
18 "score": 1.1,
19 "selection_rank": 1
20 }
21 ],
22 "patterns": [
23 {
24 "description": "string",
25 "edge_types": [
26 "string"
27 ],
28 "edges": [
29 {
30 "created_at": "string",
31 "fact": "string",
32 "name": "string",
33 "source_node_uuid": "string",
34 "target_node_uuid": "string",
35 "uuid": "string",
36 "attributes": {},
37 "episodes": [
38 "string"
39 ],
40 "expired_at": "string",
41 "invalid_at": "string",
42 "relevance": 1.1,
43 "scope": "string",
44 "score": 1.1,
45 "selection_rank": 1,
46 "valid_at": "string"
47 }
48 ],
49 "node_labels": [
50 "string"
51 ],
52 "occurrences": 1,
53 "summary": "string",
54 "type": "string",
55 "weighted_score": 1.1
56 }
57 ]
58}

Detects structural patterns in a knowledge graph including relationship frequencies, multi-hop paths, co-occurrences, hubs, and clusters. When a query is provided, uses hybrid search to discover seed nodes, detects triple-frequency patterns, and returns resolved edges ranked by relevance.

Was this page helpful?
Previous

Search Graph

Next
Built with

Request

Pattern detection request
detectobjectOptional

Which pattern types to detect with type-specific configuration. Omit to detect all types with defaults. Ignored when query is set.

edge_limitintegerOptional1-100

Max resolved edges per pattern. Default: 10, Max: 100. Only used with query.

graph_idstringOptional
Graph ID when detecting patterns on a named graph
limitintegerOptional1-200

Max patterns to return. Default: 50, Max: 200

min_occurrencesintegerOptional>=1

Minimum occurrence count to report a pattern. Default: 2

querystringOptional1-400 characters

Search query for discovering seed nodes via hybrid search. When set, forces triple-frequency detection only and enables edge resolution with cross-encoder reranking. Mutually exclusive with seeds.

query_limitintegerOptional1-50

Max seed nodes from search. Default: 10, Max: 50. Only used with query.

recency_weightenumOptional

Exponential half-life decay applied to edge created_at timestamps. Valid values: none, 7_days, 30_days, 90_days. Default: none

Allowed values:
search_filtersobjectOptional

Filters which edges/nodes participate in pattern detection. Reuses the same filter format as /graph/search.

seedsobjectOptional
Seed selection. If omitted, analyzes the entire graph. Mutually exclusive with query.
user_idstringOptional
User ID when detecting patterns on a user graph

Response

Detected patterns
metadataobject
Statistics about the detection run
nodeslist of objects

Resolved nodes referenced by pattern edges (deduplicated). Only populated when query is set.

patternslist of objects

Detected patterns, sorted by weighted_score descending

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error