TrustGraph API Gateway (1.8)

Download OpenAPI specification:

REST API for TrustGraph - an AI-powered knowledge graph and RAG system.

Overview

The API provides access to:

  • Global Services: Configuration, flow management, knowledge storage, library management
  • Flow-Hosted Services: AI services like RAG, text completion, embeddings (require running flow)
  • Import/Export: Bulk data operations for triples, embeddings, entity contexts
  • WebSocket: Multiplexed interface for all services

Service Types

Global Services

Fixed endpoints accessible via /api/v1/{kind}:

  • config - Configuration management
  • flow - Flow lifecycle and blueprints
  • librarian - Document library management
  • knowledge - Knowledge graph core management
  • collection-management - Collection metadata

Flow-Hosted Services

Require running flow instance, accessed via /api/v1/flow/{flow}/service/{kind}:

  • AI services: agent, text-completion, prompt, RAG (document/graph)
  • Embeddings: embeddings, graph-embeddings, document-embeddings
  • Query: triples, objects, nlp-query, structured-query
  • Data loading: text-load, document-load
  • Utilities: mcp-tool, structured-diag

Authentication

Bearer token authentication when GATEWAY_SECRET environment variable is set. Include token in Authorization header:

Authorization: Bearer <token>

If GATEWAY_SECRET is not set, API runs without authentication (development mode).

Field Naming

All JSON fields use kebab-case: flow-id, blueprint-name, doc-limit, etc.

Error Responses

All endpoints may return errors in this format:

{
  "error": {
    "type": "gateway-error",
    "message": "Timeout"
  }
}

Config

Configuration management (global service)

Configuration service

Manage TrustGraph configuration including flows, prompts, token costs, parameter types, and more.

Operations

config

Get the complete system configuration including all flows, prompts, token costs, etc.

list

List all configuration items of a specific type (e.g., all flows, all prompts).

get

Retrieve specific configuration items by type and key.

put

Create or update configuration values.

delete

Delete configuration items.

Configuration Types

  • flow - Flow instance definitions
  • flow-blueprint - Flow blueprint definitions (stored separately from flow instances)
  • prompt - Prompt templates
  • token-cost - Model token pricing
  • parameter-type - Parameter type definitions
  • interface-description - Interface descriptions
  • Custom types as needed

Important Distinction

The config service manages stored configuration. The flow service (/api/v1/flow) manages running flow instances.

  • Use config service to store/retrieve flow definitions
  • Use flow service to start/stop/manage running flows
Authorizations:
bearerAuth
Request Body schema: application/json
required
operation
required
string
Enum: "config" "list" "get" "put" "delete"

Operation to perform:

  • config: Get complete configuration
  • list: List all items of a specific type
  • get: Get specific configuration items
  • put: Set/update configuration values
  • delete: Delete configuration items
type
string

Configuration type (required for list, get, put, delete operations). Common types: flow, prompt, token-cost, parameter-type, interface-description

Array of objects

Keys to retrieve (for get operation) or delete (for delete operation)

Array of objects

Values to set/update (for put operation)

Responses

Request samples

Content type
application/json
Example
{
  • "operation": "config"
}

Response samples

Content type
application/json
Example
{
  • "version": 42,
  • "config": {
    }
}

Flow

Flow lifecycle and blueprint management (global service)

Flow lifecycle and blueprint management

Manage flow instances and blueprints.

Important Distinction

The flow service manages running flow instances. The config service (/api/v1/config) manages stored configuration.

  • Use flow service to start/stop/manage running flows
  • Use config service to store/retrieve flow definitions

Flow Instance Operations

start-flow

Start a new flow instance from a blueprint. The blueprint must exist (either built-in or created via put-blueprint).

Parameters are resolved from:

  1. User-provided values (--param)
  2. Default values from parameter type definitions
  3. Controlled-by relationships

stop-flow

Stop a running flow instance. This terminates all processors and releases resources.

list-flows

List all currently running flow instances.

get-flow

Get details of a running flow including its configuration, parameters, and interface queue names.

Blueprint Operations

list-blueprints

List all available flow blueprints (built-in and custom).

get-blueprint

Retrieve a blueprint definition showing its structure, parameters, processors, and interfaces.

put-blueprint

Create or update a flow blueprint definition.

Blueprints define:

  • Class processors: Shared across all instances of this blueprint
  • Flow processors: Unique to each flow instance
  • Interfaces: Entry points for external systems
  • Parameters: Configurable values for customization

delete-blueprint

Delete a custom blueprint definition. Built-in blueprints cannot be deleted.

Authorizations:
bearerAuth
Request Body schema: application/json
required
operation
required
string
Enum: "start-flow" "stop-flow" "list-flows" "get-flow" "list-blueprints" "get-blueprint" "put-blueprint" "delete-blueprint"

Flow operation:

  • start-flow: Start a new flow instance from a blueprint
  • stop-flow: Stop a running flow instance
  • list-flows: List all running flow instances
  • get-flow: Get details of a running flow
  • list-blueprints: List available flow blueprints
  • get-blueprint: Get blueprint definition
  • put-blueprint: Create/update blueprint definition
  • delete-blueprint: Delete blueprint definition
flow-id
string

Flow instance ID (required for start-flow, stop-flow, get-flow)

blueprint-name
string

Flow blueprint name (required for start-flow, get-blueprint, put-blueprint, delete-blueprint)

object

Flow blueprint definition (required for put-blueprint)

description
string

Flow description (optional for start-flow)

object

Flow parameters (for start-flow). All values are stored as strings, regardless of input type.

Responses

Request samples

Content type
application/json
Example
{
  • "operation": "start-flow",
  • "flow-id": "my-flow",
  • "blueprint-name": "document-rag",
  • "description": "My document processing flow",
  • "parameters": {
    }
}

Response samples

Content type
application/json
Example
{
  • "flow-id": "my-flow"
}

Librarian

Document library management (global service)

Document library management

Manage document library: add, remove, list documents, and control processing.

Document Library

The librarian service manages a persistent library of documents that can be:

  • Added with metadata for organization
  • Queried and filtered by criteria
  • Processed through flows on-demand or continuously
  • Tracked for processing status

Operations

add-document

Add a document to the library with metadata (URL, title, author, etc.). Documents can be added by URL or with inline content.

remove-document

Remove a document from the library by document ID or URL.

list-documents

List all documents in the library, optionally filtered by criteria.

start-processing

Start processing library documents through a flow. Documents are queued for processing and handled asynchronously.

stop-processing

Stop ongoing library document processing.

list-processing

List current processing tasks and their status.

Authorizations:
bearerAuth
Request Body schema: application/json
required
operation
required
string
Enum: "add-document" "remove-document" "list-documents" "start-processing" "stop-processing" "list-processing"

Library operation:

  • add-document: Add document to library
  • remove-document: Remove document from library
  • list-documents: List documents in library
  • start-processing: Start processing library documents
  • stop-processing: Stop library processing
  • list-processing: List processing status
flow
string

Flow ID

collection
string
Default: "default"

Collection identifier

user
string
Default: "trustgraph"

User identifier

document-id
string

Document identifier

processing-id
string

Processing task identifier

object (DocumentMetadata)

Document metadata for library management

object (ProcessingMetadata)

Processing metadata for library document processing

content
string

Document content (for add-document with inline content)

Array of objects

Search criteria for filtering documents

Responses

Request samples

Content type
application/json
Example
{
  • "operation": "add-document",
  • "flow": "my-flow",
  • "collection": "default",
  • "document-metadata": {}
}

Response samples

Content type
application/json
Example
{}

Knowledge

Knowledge graph core management (global service)

Knowledge graph core management

Manage knowledge graph cores - persistent storage of triples and embeddings.

Knowledge Cores

Knowledge cores are the foundational storage units for:

  • Triples: RDF triples representing knowledge graph data
  • Graph Embeddings: Vector embeddings for entities
  • Metadata: Descriptive information about the knowledge

Each core has an ID, user, and collection for organization.

Operations

list-kg-cores

List all knowledge cores for a user. Returns array of core IDs.

get-kg-core

Retrieve a knowledge core by ID. Returns triples and/or graph embeddings. Response is streamed - may receive multiple messages followed by EOS marker.

put-kg-core

Store triples and/or graph embeddings. Creates new core or updates existing. Can store triples only, embeddings only, or both together.

delete-kg-core

Delete a knowledge core by ID. Removes all associated data.

load-kg-core

Load a knowledge core into a running flow's collection. Makes the data available for querying within that flow instance.

unload-kg-core

Unload a knowledge core from a flow's collection. Removes data from flow instance but doesn't delete the core.

Streaming Responses

The get-kg-core operation streams data in chunks:

  1. Multiple messages with triples or graph-embeddings
  2. Final message with eos: true to signal completion
Authorizations:
bearerAuth
Request Body schema: application/json
required
operation
required
string
Enum: "list-kg-cores" "get-kg-core" "put-kg-core" "delete-kg-core" "load-kg-core" "unload-kg-core"

Knowledge core operation:

  • list-kg-cores: List knowledge cores for user
  • get-kg-core: Get knowledge core by ID
  • put-kg-core: Store triples and/or embeddings
  • delete-kg-core: Delete knowledge core by ID
  • load-kg-core: Load knowledge core into flow
  • unload-kg-core: Unload knowledge core from flow
user
string
Default: "trustgraph"

User identifier (for list-kg-cores, put-kg-core, delete-kg-core)

id
string

Knowledge core ID (for get, put, delete, load, unload)

flow
string

Flow ID (for load-kg-core)

collection
string
Default: "default"

Collection identifier (for load-kg-core)

object

Triples to store (for put-kg-core)

object

Graph embeddings to store (for put-kg-core)

Responses

Request samples

Content type
application/json
Example
{
  • "operation": "list-kg-cores",
  • "user": "alice"
}

Response samples

Content type
application/json
Example
{
  • "ids": [
    ]
}

Collection

Collection metadata management (global service)

Collection metadata management

Manage collection metadata for organizing documents and knowledge.

Collections

Collections are organizational units for grouping:

  • Documents in the librarian
  • Knowledge cores
  • User data

Each collection has:

  • user: Owner identifier
  • collection: Unique collection ID
  • name: Human-readable display name
  • description: Purpose and contents
  • tags: Labels for filtering and organization

Operations

list-collections

List all collections for a user. Optionally filter by tags and limit results. Returns array of collection metadata.

update-collection

Create or update collection metadata. If collection doesn't exist, it's created. If it exists, metadata is updated. Allows setting name, description, and tags.

delete-collection

Delete a collection by user and collection ID. This removes the metadata but typically does not delete the associated data (documents, knowledge cores).

Authorizations:
bearerAuth
Request Body schema: application/json
required
operation
required
string
Enum: "list-collections" "update-collection" "delete-collection"

Collection operation:

  • list-collections: List collections for user
  • update-collection: Create or update collection metadata
  • delete-collection: Delete collection
user
string
Default: "trustgraph"

User identifier

collection
string

Collection identifier (for update, delete)

timestamp
string <date-time>

ISO timestamp

name
string

Human-readable collection name (for update)

description
string

Collection description (for update)

tags
Array of strings

Collection tags for organization (for update)

tag-filter
Array of strings

Filter collections by tags (for list)

limit
integer
Default: 0

Maximum number of results (for list)

Responses

Request samples

Content type
application/json
Example
{
  • "operation": "list-collections",
  • "user": "alice"
}

Response samples

Content type
application/json
Example
{
  • "timestamp": "2024-01-15T10:30:00Z",
  • "collections": [
    ]
}

Flow Services

Services hosted within flow instances

Agent service - conversational AI with reasoning

AI agent that can understand questions, reason about them, and take actions.

Agent Overview

The agent service provides a conversational AI that:

  • Understands natural language questions
  • Reasons about problems using thoughts
  • Takes actions to gather information
  • Provides coherent answers

Request Format

Send a question with optional:

  • state: Continue from previous conversation
  • history: Previous agent steps for context
  • group: Collaborative agent identifiers
  • streaming: Enable streaming responses

Response Modes

Streaming Mode (streaming: true)

Responses arrive as chunks with chunk-type:

  • thought: Agent's reasoning process
  • action: Action being taken
  • observation: Result from action
  • answer: Final response to user
  • error: Error occurred

Each chunk may have multiple messages. Check flags:

  • end-of-message: Current chunk type complete
  • end-of-dialog: Entire conversation complete

Legacy Mode (streaming: false)

Single response with:

  • answer: Complete answer
  • thought: Reasoning (if any)
  • observation: Observations (if any)

Multi-turn Conversations

Include history array with previous steps to maintain context. Each step has: thought, action, arguments, observation.

Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
question
required
string

User question or prompt for the agent

state
string

Agent state for continuation (optional, for multi-turn)

group
Array of strings

Group identifiers for collaborative agents (optional)

Array of objects

Conversation history (optional, list of previous agent steps)

user
string
Default: "trustgraph"

User identifier for multi-tenancy

streaming
boolean
Default: false

Enable streaming response delivery

Responses

Request samples

Content type
application/json
Example
{
  • "question": "What is the capital of France?",
  • "user": "alice"
}

Response samples

Content type
application/json
Example
{
  • "chunk-type": "thought",
  • "content": "I need to search for information about quantum computing",
  • "end-of-message": false,
  • "end-of-dialog": false
}

Document RAG - retrieve and generate from documents

Retrieval-Augmented Generation over document embeddings.

Document RAG Overview

Document RAG combines:

  1. Retrieval: Search document embeddings using semantic similarity
  2. Generation: Use LLM to synthesize answer from retrieved documents

This provides grounded answers based on your document corpus.

Query Process

  1. Convert query to embedding
  2. Search document embeddings for most similar chunks
  3. Retrieve top N document chunks (configurable via doc-limit)
  4. Pass query + retrieved context to LLM
  5. Generate answer grounded in documents

Streaming

Enable streaming: true to receive the answer as it's generated:

  • Multiple messages with response content
  • Final message with end-of-stream: true

Without streaming, returns complete answer in single response.

Parameters

  • doc-limit: Controls retrieval depth (1-100, default 20)
    • Higher = more context but slower
    • Lower = faster but may miss relevant info
  • collection: Target specific document collection
  • user: Multi-tenant isolation
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
query
required
string

User query or question

user
string
Default: "trustgraph"

User identifier for multi-tenancy

collection
string
Default: "default"

Collection to search within

doc-limit
integer [ 1 .. 100 ]
Default: 20

Maximum number of documents to retrieve

streaming
boolean
Default: false

Enable streaming response delivery

Responses

Request samples

Content type
application/json
Example
{
  • "query": "What are the key findings in the research papers?",
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
Example
{
  • "response": "The research papers present three key findings:\n1. Quantum entanglement exhibits non-local correlations\n2. Bell's inequality is violated in experimental tests\n3. Applications in quantum cryptography are promising\n",
  • "end-of-stream": false
}

Graph RAG - retrieve and generate from knowledge graph

Retrieval-Augmented Generation over knowledge graph.

Graph RAG Overview

Graph RAG combines:

  1. Retrieval: Find relevant entities and subgraph from knowledge graph
  2. Generation: Use LLM to reason over graph structure and generate answer

This provides graph-aware answers that leverage relationships and structure.

Query Process

  1. Identify relevant entities from query (using embeddings)
  2. Retrieve connected subgraph around entities
  3. Optionally traverse paths up to max-path-length hops
  4. Limit subgraph size to stay within context window
  5. Pass query + graph structure to LLM
  6. Generate answer incorporating graph relationships

Streaming

Enable streaming: true to receive the answer as it's generated:

  • Multiple messages with response content
  • Final message with end-of-stream: true

Without streaming, returns complete answer in single response.

Parameters

Control retrieval scope with multiple knobs:

  • entity-limit: How many starting entities to find (1-200, default 50)
  • triple-limit: Triples per entity (1-100, default 30)
  • max-subgraph-size: Total subgraph cap (10-5000, default 1000)
  • max-path-length: Graph traversal depth (1-5, default 2)

Higher limits = more context but:

  • Slower retrieval
  • Larger context for LLM
  • May hit context window limits

Use Cases

Best for queries requiring:

  • Relationship understanding ("How are X and Y connected?")
  • Multi-hop reasoning ("What's the path from A to B?")
  • Structural analysis ("What are the main entities related to X?")
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
query
required
string

User query or question

user
string
Default: "trustgraph"

User identifier for multi-tenancy

collection
string
Default: "default"

Collection to search within

entity-limit
integer [ 1 .. 200 ]
Default: 50

Maximum number of entities to retrieve

triple-limit
integer [ 1 .. 100 ]
Default: 30

Maximum number of triples to retrieve per entity

max-subgraph-size
integer [ 10 .. 5000 ]
Default: 1000

Maximum total subgraph size (triples)

max-path-length
integer [ 1 .. 5 ]
Default: 2

Maximum path length for graph traversal

streaming
boolean
Default: false

Enable streaming response delivery

Responses

Request samples

Content type
application/json
Example
{
  • "query": "What connections exist between quantum physics and computer science?",
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
Example
{
  • "response": "Quantum physics and computer science intersect primarily through quantum computing.\nThe knowledge graph shows connections through:\n- Quantum algorithms (Shor's algorithm, Grover's algorithm)\n- Quantum information theory\n- Computational complexity theory\n",
  • "end-of-stream": false
}

Text completion - direct LLM generation

Direct text completion using LLM without retrieval augmentation.

Text Completion Overview

Pure LLM generation for:

  • General knowledge questions
  • Creative writing
  • Code generation
  • Analysis and reasoning
  • Any task not requiring specific document/graph context

System vs Prompt

  • system: Sets LLM behavior, role, constraints
    • "You are a helpful assistant"
    • "You are an expert Python developer"
    • "Respond in JSON format"
  • prompt: The actual user request/question

Streaming

Enable streaming: true to receive tokens as generated:

  • Multiple messages with partial response
  • Final message with end-of-stream: true

Without streaming, returns complete response in single message.

Token Counting

Response includes token usage:

  • in-token: Input tokens (system + prompt)
  • out-token: Generated tokens
  • Useful for cost tracking and optimization

When to Use

Use text-completion when:

  • No specific context needed (general knowledge)
  • System prompt provides sufficient context
  • Want direct control over prompting

Use document-rag/graph-rag when:

  • Need to ground response in specific documents
  • Want to leverage knowledge graph relationships
  • Require citations or provenance
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
system
required
string

System prompt that sets behavior and context for the LLM

prompt
required
string

User prompt or question

streaming
boolean
Default: false

Enable streaming response delivery

Responses

Request samples

Content type
application/json
Example
{
  • "system": "You are a helpful assistant that provides concise answers.",
  • "prompt": "Explain the concept of recursion in programming."
}

Response samples

Content type
application/json
Example
{
  • "response": "Recursion is a programming technique where a function calls itself\nto solve a problem by breaking it down into smaller, similar subproblems.\nEach recursive call works on a simpler version until reaching a base case.\n",
  • "in-token": 45,
  • "out-token": 128,
  • "model": "gpt-4",
  • "end-of-stream": false
}

Prompt service - template-based generation

Execute stored prompt templates with variable substitution.

Prompt Service Overview

The prompt service enables:

  • Reusable prompt templates stored in configuration
  • Variable substitution for dynamic prompts
  • Consistent prompt engineering across requests
  • Text or structured object outputs

Template System

Prompts are stored via config service (/api/v1/config) with:

  • id: Unique prompt identifier
  • template: Prompt text with {variable} placeholders
  • system: Optional system prompt
  • output_format: "text" or "object"

Example template:

Summarize the following document in {max_length} words:

{document}

Variable Substitution

Two ways to pass variables:

  1. terms (explicit JSON strings):

    {
      "terms": {
        "document": "\"Text here...\"",
        "max_length": "\"200\""
      }
    }
    
  2. variables (auto-converted):

    {
      "variables": {
        "document": "Text here...",
        "max_length": 200
      }
    }
    

Output Types

  • text: Plain text response in text field
  • object: Structured JSON in object field (as string)

Streaming

Enable streaming: true to receive response incrementally.

Use Cases

  • Document summarization
  • Entity extraction
  • Classification tasks
  • Data transformation
  • Any repeatable LLM task with consistent prompting
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
id
required
string

Prompt template ID (stored in config)

object

Template variables as key-value pairs (values are JSON strings)

object

Alternative to terms - variables as native JSON values (auto-converted)

streaming
boolean
Default: false

Enable streaming response delivery

Responses

Request samples

Content type
application/json
Example
{
  • "id": "summarize-document",
  • "terms": {
    }
}

Response samples

Content type
application/json
Example
{
  • "text": "This document provides an overview of quantum computing fundamentals and cryptographic applications.",
  • "end-of-stream": false
}

Embeddings - text to vector conversion

Convert text to embedding vectors for semantic similarity search.

Embeddings Overview

Embeddings transform text into dense vector representations that:

  • Capture semantic meaning
  • Enable similarity comparisons via cosine distance
  • Support semantic search and retrieval
  • Power RAG systems

Use Cases

  • Document indexing: Convert documents to vectors for storage
  • Query encoding: Convert search queries for similarity matching
  • Semantic similarity: Find related texts via vector distance
  • Clustering: Group similar content
  • Classification: Use as features for ML models

Vector Dimensions

Dimension count depends on embedding model:

  • text-embedding-ada-002: 1536 dimensions
  • text-embedding-3-small: 1536 dimensions
  • text-embedding-3-large: 3072 dimensions
  • Custom models: Varies

Single Request

Unlike batch embedding APIs, this endpoint processes one text at a time. For bulk operations, use document-load or text-load services.

Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
text
required
string

Text to convert to embedding vector

Responses

Request samples

Content type
application/json
Example
{
  • "text": "Machine learning"
}

Response samples

Content type
application/json
{
  • "vectors": [
    ]
}

MCP Tool - execute Model Context Protocol tools

Execute MCP (Model Context Protocol) tools for agent capabilities.

MCP Tool Overview

MCP tools provide agent capabilities through standardized protocol:

  • Search tools: Web search, document search
  • Data tools: Database queries, API calls
  • Action tools: File operations, system commands
  • Integration tools: Third-party service connectors

Tools extend agent capabilities beyond pure LLM generation.

Tool Execution

Tools are:

  1. Registered via MCP protocol
  2. Discovered by agent
  3. Called with structured parameters
  4. Return text or structured results

Request Format

  • name: Tool identifier (e.g., "search", "calculator", "weather")
  • parameters: Tool-specific arguments as JSON object

Response Format

Tools can return:

  • text: Plain text result (simple tools)
  • object: Structured JSON result (complex tools)

Tool Registration

Tools are registered via MCP server configuration:

  • Define tool schema (name, parameters, description)
  • Implement tool handler
  • Register with MCP server
  • Agent discovers and uses tool

Use Cases

  • Web search: Find external information
  • Calculator: Perform calculations
  • Database query: Retrieve structured data
  • API integration: Call external services
  • File operations: Read/write files
  • Code execution: Run scripts
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
name
required
string

Tool name to execute

object

Tool parameters (JSON object, auto-converted to string internally)

Responses

Request samples

Content type
application/json
Example
{
  • "name": "search",
  • "parameters": {
    }
}

Response samples

Content type
application/json
Example
{
  • "text": "The result is 309"
}

Triples query - pattern-based graph queries

Query knowledge graph using subject-predicate-object patterns.

Triples Query Overview

Query RDF triples with flexible pattern matching:

  • Specify subject, predicate, and/or object
  • Any combination of filters (all optional)
  • Returns matching triples up to limit

Pattern Matching

Pattern syntax supports:

  • All triples: Omit all filters (returns everything up to limit)
  • Subject match: Specify s only (all triples about that subject)
  • Predicate match: Specify p only (all uses of that property)
  • Object match: Specify o only (all triples with that value)
  • Combinations: Any combination of s/p/o

RDF Value Format

Each component (s/p/o) uses RdfValue format:

  • Entity/URI: {"v": "https://example.com/entity", "e": true}
  • Literal: {"v": "Some text", "e": false}

Query Examples

Find all properties of an entity:

{"s": {"v": "https://example.com/person/alice", "e": true}}

Find all instances of a type:

{
  "p": {"v": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "e": true},
  "o": {"v": "https://example.com/type/Person", "e": true}
}

Find specific relationship:

{
  "s": {"v": "https://example.com/person/alice", "e": true},
  "p": {"v": "https://example.com/knows", "e": true}
}

Performance

  • Default limit: 10,000 triples
  • Max limit: 100,000 triples
  • More specific patterns = faster queries
  • Consider limit for large result sets
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
object (RdfValue)

Subject filter (optional)

object (RdfValue)

Predicate filter (optional)

object (RdfValue)

Object filter (optional)

limit
integer [ 1 .. 100000 ]
Default: 10000

Maximum number of triples to return

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection to query

Responses

Request samples

Content type
application/json
Example
{}

Response samples

Content type
application/json
{}

Objects query - GraphQL over knowledge graph

Query knowledge graph using GraphQL for object-oriented data access.

Objects Query Overview

GraphQL interface to knowledge graph:

  • Schema-driven: Predefined types and relationships
  • Flexible queries: Request exactly what you need
  • Nested data: Traverse relationships in single query
  • Type-safe: Strong typing with introspection

Abstracts RDF triples into familiar object model.

GraphQL Benefits

Compared to triples query:

  • Developer-friendly: Objects instead of triples
  • Efficient: Get related data in one query
  • Typed: Schema defines available fields
  • Discoverable: Introspection for tooling

Query Structure

Standard GraphQL query format:

query OperationName($var: Type!) {
  fieldName(arg: $var) {
    subField1
    subField2
    nestedObject {
      nestedField
    }
  }
}

Variables

Pass variables for parameterized queries:

{
  "query": "query GetPerson($id: ID!) { person(id: $id) { name } }",
  "variables": {"id": "https://example.com/person/alice"}
}

Error Handling

GraphQL distinguishes:

  • Field errors: Invalid query, missing fields (in errors array)
  • System errors: Connection issues, timeouts (in error object)

Partial data may be returned with field errors.

Schema Definition

Schema defines available types via config service. Use introspection query to discover schema.

Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
query
required
string

GraphQL query string

object

GraphQL query variables

operation-name
string

Operation name (for multi-operation documents)

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection to query

Responses

Request samples

Content type
application/json
Example
{
  • "query": "{\n person(id: \"https://example.com/person/alice\") {\n name\n email\n }\n}\n",
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
Example
{
  • "data": {
    },
  • "extensions": {
    }
}

NLP Query - natural language to structured query

Convert natural language questions to structured GraphQL queries.

NLP Query Overview

Transforms user questions into executable GraphQL:

  • Natural input: Ask questions in plain English
  • Structured output: Get GraphQL query + variables
  • Schema-aware: Uses knowledge graph schema
  • Confidence scoring: Know how well question was understood

Enables non-technical users to query knowledge graph.

Process

  1. Parse natural language question
  2. Identify entities and relationships
  3. Map to GraphQL schema types
  4. Generate query with variables
  5. Return query + confidence score

Using Results

Generated query can be:

  • Executed via objects query service
  • Inspected and modified if needed
  • Cached for similar questions

Example workflow:

1. User asks: "Who does Alice know?"
2. NLP Query generates GraphQL
3. Execute via /api/v1/flow/{flow}/service/objects
4. Return results to user

Schema Detection

Response includes detected-schemas array showing:

  • Which types were identified
  • What entities were matched
  • Schema coverage of question

Helps understand query scope.

Confidence Scores

  • 0.9-1.0: High confidence, likely correct
  • 0.7-0.9: Good confidence, probably correct
  • 0.5-0.7: Medium confidence, may need review
  • < 0.5: Low confidence, likely incorrect

Low scores suggest:

  • Ambiguous question
  • Missing schema coverage
  • Complex query structure
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
question
required
string

Natural language question

max-results
integer [ 1 .. 10000 ]
Default: 100

Maximum results to return when query is executed

Responses

Request samples

Content type
application/json
Example
{
  • "question": "Who does Alice know?",
  • "max-results": 50
}

Response samples

Content type
application/json
Example
{
  • "graphql-query": "query GetConnections($person: ID!) {\n person(id: $person) {\n knows { name email }\n }\n}\n",
  • "variables": {},
  • "detected-schemas": [
    ],
  • "confidence": 0.92
}

Structured Query - question to results (all-in-one)

Ask natural language questions and get results directly.

Structured Query Overview

Combines two operations in one call:

  1. NLP Query: Generate GraphQL from question
  2. Objects Query: Execute generated query
  3. Return Results: Direct answer data

Simplest way to query knowledge graph with natural language.

Comparison with Other Services

Structured Query (this service)

  • Input: Natural language question
  • Output: Query results (data)
  • Use when: Want simple, direct answers

NLP Query + Objects Query (separate calls)

  • Step 1: Convert question → GraphQL
  • Step 2: Execute GraphQL → results
  • Use when: Need to inspect/modify query before execution

Triples Query (low-level)

  • Input: RDF pattern
  • Output: Matching triples
  • Use when: Need precise control over graph queries

Response Format

Returns standard GraphQL response:

  • data: Query results (null if error)
  • errors: Field-level errors (array of strings)
  • error: System-level error (generation or execution failure)

Error Handling

Three types of errors:

  1. Query generation failed: Couldn't understand question
    • Error in error object
    • data = null
  2. Query execution failed: Generated query had errors
    • Errors in errors array
    • data may be partial
  3. System error: Infrastructure issue
    • Error in error object

Performance

Convenience vs control trade-off:

  • Faster development: One call instead of two
  • Less control: Can't inspect/modify generated query
  • Simpler code: No need to handle intermediate steps
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
question
required
string

Natural language question

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection to query

Responses

Request samples

Content type
application/json
Example
{
  • "question": "Who does Alice know?",
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
Example
{
  • "data": {
    },
  • "errors": [ ]
}

Structured Diag - analyze structured data formats

Analyze and understand structured data (CSV, JSON, XML).

Structured Diag Overview

Helps process unknown structured data:

  • Detect format: Identify CSV, JSON, or XML
  • Generate schema: Create descriptor from sample
  • Match schemas: Find existing schemas that fit data
  • Full diagnosis: Complete analysis in one call

Essential for data ingestion pipelines.

Operations

detect-type

Identify data format from sample:

  • Input: Data sample
  • Output: Format (csv/json/xml) + confidence
  • Use when: Format is unknown

generate-descriptor

Create schema descriptor:

  • Input: Sample + known type
  • Output: Field definitions, types, structure
  • Use when: Need to understand data structure

Combined analysis:

  • Input: Data sample
  • Output: Format + descriptor + metadata
  • Use when: Starting from scratch

schema-selection

Find matching schemas:

  • Input: Data sample
  • Output: List of schema IDs that match
  • Use when: Have existing schemas, need to match data

Data Types

Supported formats:

  • CSV: Comma-separated values (or custom delimiter)
  • JSON: JSON objects or arrays
  • XML: XML documents

Options

Format-specific options:

  • CSV: delimiter, has_header, quote_char
  • JSON: array_path (for nested arrays)
  • XML: root_element, record_path

Workflow Example

  1. Receive unknown data file
  2. Call diagnose operation with sample
  3. Get format + schema descriptor
  4. Use descriptor to process full dataset
  5. Load data via document-load or text-load
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
operation
required
string
Enum: "detect-type" "generate-descriptor" "diagnose" "schema-selection"

Diagnosis operation:

  • detect-type: Identify data format (CSV, JSON, XML)
  • generate-descriptor: Create schema descriptor for data
  • diagnose: Full analysis (detect + generate descriptor)
  • schema-selection: Find matching schemas for data
sample
required
string

Data sample to analyze (text content)

type
string
Enum: "csv" "json" "xml"

Data type (required for generate-descriptor)

schema-name
string

Target schema name for descriptor generation (optional)

object

Format-specific options (e.g., CSV delimiter)

Responses

Request samples

Content type
application/json
Example
{
  • "operation": "detect-type",
  • "sample": "name,age,email\nAlice,30,alice@example.com\nBob,25,bob@example.com\n"
}

Response samples

Content type
application/json
Example
{
  • "operation": "detect-type",
  • "detected-type": "csv",
  • "confidence": 0.95
}

Graph Embeddings Query - find similar entities

Query graph embeddings to find similar entities by vector similarity.

Graph Embeddings Query Overview

Find entities semantically similar to a query vector:

  • Input: Query embedding vector
  • Search: Compare against stored entity embeddings
  • Output: Most similar entities (RDF URIs)

Core component of graph RAG retrieval.

Use Cases

  • Entity discovery: Find related entities
  • Concept expansion: Discover similar concepts
  • Graph exploration: Navigate by semantic similarity
  • RAG retrieval: Get entities for context

Process

  1. Obtain query embedding (via embeddings service)
  2. Query stored entity embeddings
  3. Calculate cosine similarity
  4. Return top N most similar entities
  5. Use entities to retrieve triples/subgraph

Similarity Scoring

Uses cosine similarity between vectors:

  • Results ordered by similarity (most similar first)
  • No explicit similarity scores returned
  • Limit controls result count

Entity Format

Returns RDF values (entities):

  • URI entities: {v: "https://...", e: true}
  • These are references to knowledge graph entities
  • Use with triples query to get entity details
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
vectors
required
Array of numbers

Query embedding vector

limit
integer [ 1 .. 1000 ]
Default: 10

Maximum number of entities to return

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection to search

Responses

Request samples

Content type
application/json
Example
{
  • "vectors": [
    ],
  • "limit": 10,
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json

Document Embeddings Query - find similar text chunks

Query document embeddings to find similar text chunks by vector similarity.

Document Embeddings Query Overview

Find document chunks semantically similar to a query vector:

  • Input: Query embedding vector
  • Search: Compare against stored chunk embeddings
  • Output: Most similar text chunks

Core component of document RAG retrieval.

Use Cases

  • Document retrieval: Find relevant passages
  • Semantic search: Search by meaning not keywords
  • Context gathering: Get text for RAG
  • Similar content: Discover related documents

Process

  1. Obtain query embedding (via embeddings service)
  2. Query stored document chunk embeddings
  3. Calculate cosine similarity
  4. Return top N most similar chunks
  5. Use chunks as context for generation

Chunking

Documents are split into chunks during indexing:

  • Typical size: 200-1000 tokens
  • Overlap between chunks for continuity
  • Each chunk has own embedding

Queries return individual chunks, not full documents.

Similarity Scoring

Uses cosine similarity:

  • Results ordered by similarity
  • No explicit scores in response
  • Limit controls result count

Output Format

Returns text chunks as strings:

  • Raw chunk text
  • No metadata (source, position, etc.)
  • Use for LLM context directly
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
vectors
required
Array of numbers

Query embedding vector

limit
integer [ 1 .. 1000 ]
Default: 10

Maximum number of document chunks to return

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection to search

Responses

Request samples

Content type
application/json
Example
{
  • "vectors": [
    ],
  • "limit": 10,
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
{
  • "chunks": [
    ]
}

Text Load - load text documents

Load text documents into processing pipeline for indexing and embedding.

Text Load Overview

Fire-and-forget document loading:

  • Input: Text content (base64 encoded)
  • Process: Chunk, embed, store
  • Output: None (202 Accepted)

Asynchronous processing - document queued for background processing.

Processing Pipeline

Text documents go through:

  1. Chunking: Split into overlapping chunks
  2. Embedding: Generate vectors for each chunk
  3. Storage: Store chunks + embeddings
  4. Indexing: Make searchable via document-embeddings query

Pipeline runs asynchronously after request returns.

Text Format

Text must be base64 encoded:

text_content = "This is the document..."
encoded = base64.b64encode(text_content.encode('utf-8'))

Default charset is UTF-8, specify charset if different.

Metadata

Optional RDF triples describing document:

  • Title, author, date
  • Source URL
  • Custom properties
  • Used for organization and retrieval

Use Cases

  • Document ingestion: Add documents to knowledge base
  • Bulk loading: Process multiple documents
  • Content updates: Replace existing documents
  • Library integration: Load from document library

No Response Data

Returns 202 Accepted immediately:

  • Document queued for processing
  • No synchronous result
  • No processing status
  • Check document-embeddings query later to verify indexed
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
text
required
string <byte>

Text content (base64 encoded)

id
string

Document identifier

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection for document

charset
string
Default: "utf-8"

Text character encoding

Array of objects (Triple)

Document metadata as RDF triples

Responses

Request samples

Content type
application/json
Example
{
  • "text": "VGhpcyBpcyB0aGUgZG9jdW1lbnQgdGV4dC4uLg==",
  • "id": "doc-123",
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
{ }

Document Load - load binary documents (PDF, etc.)

Load binary documents (PDF, Word, etc.) into processing pipeline.

Document Load Overview

Fire-and-forget binary document loading:

  • Input: Document data (base64 encoded)
  • Process: Extract text, chunk, embed, store
  • Output: None (202 Accepted)

Asynchronous processing for PDF and other binary formats.

Processing Pipeline

Documents go through:

  1. Text extraction: PDF→text, DOCX→text, etc.
  2. Chunking: Split into overlapping chunks
  3. Embedding: Generate vectors for each chunk
  4. Storage: Store chunks + embeddings
  5. Indexing: Make searchable

Pipeline runs asynchronously.

Supported Formats

  • PDF: Portable Document Format
  • DOCX: Microsoft Word
  • HTML: Web pages
  • Other formats via extractors

Format detected from content, not extension.

Binary Encoding

Documents must be base64 encoded:

with open('document.pdf', 'rb') as f:
    doc_bytes = f.read()
encoded = base64.b64encode(doc_bytes).decode('utf-8')

Metadata

Optional RDF triples:

  • Document properties
  • Source information
  • Custom attributes

Use Cases

  • PDF ingestion: Process research papers
  • Document libraries: Index document collections
  • Content migration: Import from other systems
  • Automated processing: Batch document loading

No Response Data

Returns 202 Accepted immediately:

  • Document queued
  • Processing happens asynchronously
  • No status tracking
  • Query later to verify indexed
Authorizations:
bearerAuth
path Parameters
flow
required
string
Example: my-flow

Flow instance ID

Request Body schema: application/json
required
data
required
string <byte>

Document data (base64 encoded)

id
string

Document identifier

user
string
Default: "trustgraph"

User identifier

collection
string
Default: "default"

Collection for document

Array of objects (Triple)

Document metadata as RDF triples

Responses

Request samples

Content type
application/json
Example
{
  • "data": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFI+PmVuZG9iagoyIDAgb2JqCjw8L1R5cGUvUGFnZXMvS2lkc1szIDAgUl0vQ291bnQgMT4+ZW5kb2JqCg==",
  • "id": "doc-789",
  • "user": "alice",
  • "collection": "research"
}

Response samples

Content type
application/json
{ }

Import/Export

Bulk data import and export

Import Core - bulk import triples and embeddings

Import knowledge cores in bulk using streaming MessagePack format.

Import Core Overview

Bulk data import for knowledge graph:

  • Format: MessagePack streaming
  • Content: Triples and/or graph embeddings
  • Target: Global knowledge storage
  • Use: Backup restoration, data migration, bulk loading

MessagePack Protocol

Request body is MessagePack stream with message tuples:

Triple Message

("t", {
  "m": {              // Metadata
    "i": "core-id",   // Knowledge core ID
    "m": [...],       // Metadata triples array
    "u": "user",      // User
    "c": "collection" // Collection
  },
  "t": [...]          // Triples array
})

Graph Embeddings Message

("ge", {
  "m": {              // Metadata
    "i": "core-id",
    "m": [...],
    "u": "user",
    "c": "collection"
  },
  "e": [              // Entities array
    {
      "e": {"v": "uri", "e": true},  // Entity RdfValue
      "v": [0.1, 0.2, ...]             // Vectors
    }
  ]
})

Query Parameters

  • id: Knowledge core ID
  • user: User identifier

Streaming

Multiple messages can be sent in stream. Each message processed as received. No response body - returns 202 Accepted.

Use Cases

  • Backup restoration: Restore from export
  • Data migration: Move data between systems
  • Bulk loading: Initial knowledge base population
  • Replication: Copy knowledge cores
Authorizations:
bearerAuth
query Parameters
id
required
string
Example: id=core-123

Knowledge core ID to import

user
required
string
Example: user=alice

User identifier

Request Body schema: application/msgpack
required
string <binary>

MessagePack stream of knowledge data

Responses

Response samples

Content type
application/json
{ }

Export Core - bulk export triples and embeddings

Export knowledge cores in bulk using streaming MessagePack format.

Export Core Overview

Bulk data export for knowledge graph:

  • Format: MessagePack streaming
  • Content: Triples and graph embeddings
  • Source: Global knowledge storage
  • Use: Backups, data migration, archival

MessagePack Protocol

Response body is MessagePack stream with message tuples:

Triple Message

("t", {
  "m": {              // Metadata
    "i": "core-id",   // Knowledge core ID
    "m": [...],       // Metadata triples array
    "u": "user",      // User
    "c": "collection" // Collection
  },
  "t": [...]          // Triples array
})

Graph Embeddings Message

("ge", {
  "m": {              // Metadata
    "i": "core-id",
    "m": [...],
    "u": "user",
    "c": "collection"
  },
  "e": [              // Entities array
    {
      "e": {"v": "uri", "e": true},  // Entity RdfValue
      "v": [0.1, 0.2, ...]             // Vectors
    }
  ]
})

End of Stream Message

("eos", {})

Query Parameters

  • id: Knowledge core ID to export
  • user: User identifier

Streaming

Data streamed incrementally:

  • Triples sent first
  • Graph embeddings sent next
  • EOS marker signals completion

Client should process messages as received.

Use Cases

  • Backups: Export for disaster recovery
  • Data migration: Move to another system
  • Archival: Long-term storage
  • Replication: Copy knowledge cores
  • Analysis: External processing
Authorizations:
bearerAuth
query Parameters
id
required
string
Example: id=core-123

Knowledge core ID to export

user
required
string
Example: user=alice

User identifier

Responses

Response samples

Content type
application/json
{
  • "error": "Unauthorized"
}

WebSocket

WebSocket interfaces

WebSocket - multiplexed service interface

WebSocket interface providing multiplexed access to all TrustGraph services over a single persistent connection.

Overview

The WebSocket API provides access to the same services as the REST API but with:

  • Multiplexed: Multiple concurrent requests over one connection
  • Asynchronous: Non-blocking request/response with ID matching
  • Efficient: Reduced overhead compared to HTTP
  • Real-time: Low latency bidirectional communication

Connection

Establish WebSocket connection to:

ws://localhost:8088/api/v1/socket

Message Protocol

All messages are JSON objects with the following structure:

Request Message Format

Global Service Request (no flow parameter):

{
  "id": "req-123",
  "service": "config",
  "request": {
    "operation": "list",
    "type": "flow"
  }
}

Flow-Hosted Service Request (with flow parameter):

{
  "id": "req-456",
  "service": "agent",
  "flow": "my-flow",
  "request": {
    "question": "What is quantum computing?",
    "streaming": true
  }
}

Request Fields:

  • id (string, required): Client-generated unique identifier for this request within the session. Used to match responses to requests.
  • service (string, required): Service identifier (e.g., "config", "agent", "document-rag"). Same as {kind} in REST URLs.
  • flow (string, optional): Flow ID for flow-hosted services. Omit for global services.
  • request (object, required): Service-specific request payload. Same structure as REST API request body.

Response Message Format

Success Response:

{
  "id": "req-123",
  "response": {
    "chunk-type": "answer",
    "content": "Quantum computing uses...",
    "end-of-stream": false
  }
}

Error Response:

{
  "id": "req-123",
  "error": {
    "type": "gateway-error",
    "message": "Flow not found"
  }
}

Response Fields:

  • id (string, required): Matches the id from the request. Client uses this to correlate responses.
  • response (object, conditional): Service-specific response payload. Same structure as REST API response. Present on success.
  • error (object, conditional): Error information with type and message fields. Present on failure.

Service Routing

The WebSocket protocol routes to services using message parameters instead of URL paths:

REST Endpoint WebSocket Message
POST /api/v1/config {"service": "config"}
POST /api/v1/flow/{flow}/service/agent {"service": "agent", "flow": "my-flow"}

Global Services (no flow parameter):

  • config - Configuration management
  • flow - Flow lifecycle and blueprints
  • librarian - Document library management
  • knowledge - Knowledge graph core management
  • collection-management - Collection metadata

Flow-Hosted Services (require flow parameter):

  • AI services: agent, text-completion, prompt, document-rag, graph-rag
  • Embeddings: embeddings, graph-embeddings, document-embeddings
  • Query: triples, objects, nlp-query, structured-query
  • Data loading: text-load, document-load
  • Utilities: mcp-tool, structured-diag

Request/Response Schemas

The request and response fields use identical schemas to the REST API for each service. See individual service documentation for detailed request/response formats.

Multiplexing and Asynchronous Operation

Multiple requests can be in flight simultaneously:

  • Client sends requests with unique id values
  • Server processes requests concurrently
  • Responses arrive asynchronously and may be out of order
  • Client matches responses to requests using the id field
  • No head-of-line blocking

Example concurrent requests:

{"id": "req-1", "service": "config", "request": {...}}
{"id": "req-2", "service": "agent", "flow": "f1", "request": {...}}
{"id": "req-3", "service": "document-rag", "flow": "f2", "request": {...}}

Responses may arrive in any order: req-2, req-1, req-3

Streaming Responses

Services that support streaming (e.g., agent, RAG) send multiple response messages with the same id:

{"id": "req-1", "response": {"chunk-type": "thought", "content": "...", "end-of-stream": false}}
{"id": "req-1", "response": {"chunk-type": "answer", "content": "...", "end-of-stream": false}}
{"id": "req-1", "response": {"chunk-type": "answer", "content": "...", "end-of-stream": true}}

The end-of-stream flag (or service-specific completion flag) indicates the final message.

Authentication

When GATEWAY_SECRET is set, include bearer token:

  • As query parameter: ws://localhost:8088/api/v1/socket?token=<token>
  • Or in WebSocket subprotocol header

Benefits Over REST

  • Lower latency: No TCP/TLS handshake per request
  • Connection reuse: Single persistent connection
  • Reduced overhead: No HTTP headers per message
  • True streaming: Bidirectional real-time communication
  • Efficient multiplexing: Concurrent operations without connection pooling
Authorizations:
bearerAuth
header Parameters
Upgrade
required
string
Value: "websocket"

WebSocket upgrade header

Connection
required
string
Value: "Upgrade"

Connection upgrade header

Responses

Response samples

Content type
application/json
{
  • "error": "Unauthorized"
}

Metrics

System metrics and monitoring

Metrics - Prometheus metrics endpoint

Proxy to Prometheus metrics for system monitoring.

Metrics Overview

Exposes system metrics via Prometheus format:

  • Gateway metrics: Request rates, latencies, errors
  • Flow metrics: Processing throughput, queue depths
  • System metrics: Resource usage, health status

Prometheus Format

Returns metrics in Prometheus text exposition format:

# HELP metric_name Description
# TYPE metric_name counter
metric_name{label="value"} 123.45

Available Metrics

Common metrics include:

  • Request count and rates
  • Response times (histograms)
  • Error rates
  • Active connections
  • Queue depths
  • Processing latencies

Integration

Standard Prometheus scraping:

  • Configure Prometheus to scrape /api/metrics
  • Set appropriate scrape interval
  • Use bearer token if authentication enabled

Path Parameter

The {path} parameter allows querying specific Prometheus endpoints or metrics if the backend Prometheus supports it.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "error": "Unauthorized"
}

Metrics - Prometheus metrics with path

Proxy to Prometheus metrics with optional path parameter.

Authorizations:
bearerAuth
path Parameters
path
required
string
Example: query

Path to specific metrics endpoint

Responses

Response samples

Content type
application/json
{
  • "error": "Unauthorized"
}