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.
LogoLogo
PlaygroundDiscordStatusDashboardSign Up >
SDK ReferenceGraph

Add Fact Triple

POST
https://api.getzep.com/api/v2/graph/add-fact-triple
POST
/api/v2/graph/add-fact-triple
1from zep_cloud import Zep
2
3client = Zep(
4 api_key="YOUR_API_KEY",
5)
6client.graph.add_fact_triple(
7 fact="fact",
8 fact_name="fact_name",
9)
1{
2 "edge": {
3 "created_at": "string",
4 "fact": "string",
5 "name": "string",
6 "source_node_uuid": "string",
7 "target_node_uuid": "string",
8 "uuid": "string",
9 "attributes": {},
10 "episodes": [
11 "string"
12 ],
13 "expired_at": "string",
14 "invalid_at": "string",
15 "relevance": 1.1,
16 "scope": "string",
17 "score": 1.1,
18 "selection_rank": 1,
19 "valid_at": "string"
20 },
21 "source_node": {
22 "created_at": "string",
23 "name": "string",
24 "summary": "string",
25 "uuid": "string",
26 "attributes": {},
27 "labels": [
28 "string"
29 ],
30 "relevance": 1.1,
31 "score": 1.1,
32 "selection_rank": 1
33 },
34 "target_node": {
35 "created_at": "string",
36 "name": "string",
37 "summary": "string",
38 "uuid": "string",
39 "attributes": {},
40 "labels": [
41 "string"
42 ],
43 "relevance": 1.1,
44 "score": 1.1,
45 "selection_rank": 1
46 },
47 "task_id": "string"
48}
Add a fact triple for a user or group
Was this page helpful?
Previous

Clone graph

Next
Built with

Request

Triple to add
factstringRequired<=250 characters
The fact relating the two nodes that this edge represents
fact_namestringRequired1-50 characters

The name of the edge to add. Should be all caps using snake case (eg RELATES_TO)

created_atstringOptional
The timestamp of the message
edge_attributesmap from strings to anyOptional

Additional attributes of the edge. Values must be scalar types (string, number, boolean, or null). Nested objects and arrays are not allowed.

expired_atstringOptional

The time (if any) at which the edge expires

fact_uuidstringOptional
The uuid of the edge to add
graph_idstringOptional
invalid_atstringOptional

The time (if any) at which the fact stops being true

metadatamap from strings to anyOptional

Optional metadata key-value pairs for the shadow episode created for this fact triple. Max 10 keys. Values must be strings, numbers, or booleans.

source_node_attributesmap from strings to anyOptional

Additional attributes of the source node. Values must be scalar types (string, number, boolean, or null). Nested objects and arrays are not allowed.

source_node_labelslist of stringsOptional

The labels for the source node. At most one entity-type label may be provided so that manually-added triples remain consistent with automatic episode extraction, which assigns one best-match entity type per node. The base “Entity” label is added implicitly by the graph layer on save and does not need to be supplied here.

source_node_namestringOptional<=50 characters
The name of the source node to add
source_node_summarystringOptional<=500 characters
The summary of the source node to add
source_node_uuidstringOptional
The source node uuid
target_node_attributesmap from strings to anyOptional

Additional attributes of the target node. Values must be scalar types (string, number, boolean, or null). Nested objects and arrays are not allowed.

target_node_labelslist of stringsOptional

The labels for the target node. At most one entity-type label may be provided so that manually-added triples remain consistent with automatic episode extraction, which assigns one best-match entity type per node. The base “Entity” label is added implicitly by the graph layer on save and does not need to be supplied here.

target_node_namestringOptional<=50 characters
The name of the target node to add
target_node_summarystringOptional<=500 characters
The summary of the target node to add
target_node_uuidstringOptional
The target node uuid
user_idstringOptional
valid_atstringOptional
The time at which the fact becomes true

Response

Resulting triple
edgeobject
source_nodeobject
target_nodeobject
task_idstring
Task ID of the add triple task

Errors

400
Bad Request Error
500
Internal Server Error