Skip to content

GraphQuery

Query the graph using structured query language

Endpoint: /api/graph/graphquery

Tags: Graph

API Details

GET /api/graph/graphquery
schema: z.object({
tenantId: Str({ description: "ID of the tenant" }),
query: z.object({
// Starting point for the query
from: z.object({
type: Str({ description: "Entity type to start from" }).optional(),
id: Str({ description: "Specific entity ID to start from" }).optional(),
name: Str({ description: "Entity name to start from" }).optional(),
properties: z.record(z.any()).optional(),
}),
// Traversal patterns
traverse: z.array(z.object({
direction: z.enum(["outgoing", "incoming", "both"]).optional(),
relationshipType: Str({ description: "Type of relationship to traverse" }).optional(),
depth: Num({ description: "Depth of traversal" }).optional(),
limit: Num({ description: "Maximum number of results" }).optional(),
})).optional(),
// Filtering conditions
where: z.array(z.object({
field: Str({ description: "Field to filter on" }).optional(),
operator: z.enum(["equals", "contains", "startsWith", "endsWith", "gt", "lt", "gte", "lte"]).optional(),
value: z.any({ description: "Value to compare against" }).optional(),
})).optional(),
// Return specification
return: z.object({
entities: Bool({ description: "Whether to return entities" }).optional(),
relationships: Bool({ description: "Whether to return relationships" }).optional(),
count: Bool({ description: "Whether to return count only" }).optional(),
fields: z.array(Str()).optional(),
}).optional(),
}),
}),

Returns the query results

schema: z.object({
success: Bool(),
results: z.any(),
count: Num().optional(),
}),

Bad request

schema: z.object({
success: Bool(),
error: Str(),
}),

Unauthorized

schema: z.object({
success: Bool(),
error: Str(),
}),

View Source