WebSocket API for TrustGraph - providing multiplexed, asynchronous access to all services.
The WebSocket API provides access to all TrustGraph services over a single persistent connection:
All messages are JSON with:
id: Client-generated unique identifier for request/response correlationservice: Service identifier (e.g., "config", "agent", "document-rag")flow: Optional flow ID for flow-hosted servicesrequest/response: Service-specific payload (identical to REST API schemas)error: Error information on failureGlobal Services (no flow parameter):
Flow-Hosted Services (require flow parameter):
Request and response payloads use identical schemas to the REST API. See OpenAPI specification for detailed schema documentation.
Local development WebSocket server
Bearer token authentication when GATEWAY_SECRET is configured. Include as query parameter: ws://localhost:8088/api/v1/socket?token=
Request message for any TrustGraph service
Generic request message that can invoke any TrustGraph service.
The request field payload varies by service and matches the REST API request body schema.
Service request envelope with id, service, optional flow, and service-specific request payload
WebSocket request for config service (global service)
Unique request identifier
Service identifier for config service
Configuration service request.
Supports operations: config, list, get, put, delete
Operation to perform:
config: Get complete configurationlist: List all items of a specific typeget: Get specific configuration itemsput: Set/update configuration valuesdelete: Delete configuration itemsConfiguration type (required for list, get, put, delete operations). Common types: flow, prompt, token-cost, parameter-type, interface-description
Keys to retrieve (for get operation) or delete (for delete operation)
Configuration type
Configuration key
Additional properties are allowed.
Values to set/update (for put operation)
Configuration type
Configuration key
Configuration value (structure depends on type)
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for flow service (global service)
Unique request identifier
Service identifier for flow service
Flow service request for managing flow instances and blueprints.
Operations: 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 blueprintstop-flow: Stop a running flow instancelist-flows: List all running flow instancesget-flow: Get details of a running flowlist-blueprints: List available flow blueprintsget-blueprint: Get blueprint definitionput-blueprint: Create/update blueprint definitiondelete-blueprint: Delete blueprint definitionFlow instance ID (required for start-flow, stop-flow, get-flow)
Flow blueprint name (required for start-flow, get-blueprint, put-blueprint, delete-blueprint)
Flow blueprint definition (required for put-blueprint)
Additional properties are allowed.
Flow description (optional for start-flow)
Flow parameters (for start-flow). All values are stored as strings, regardless of input type.
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for librarian service (global service)
Unique request identifier
Service identifier for librarian service
Librarian service request for document library management.
Operations: add-document, remove-document, list-documents, start-processing, stop-processing, list-processing
Library operation:
add-document: Add document to libraryremove-document: Remove document from librarylist-documents: List documents in librarystart-processing: Start processing library documentsstop-processing: Stop library processinglist-processing: List processing statusFlow ID
Collection identifier
User identifier
Document identifier
Processing task identifier
Document metadata for library management
Document URL or identifier
Document title
Document author
Document date
Additional metadata fields
Additional properties are allowed.
Additional properties are allowed.
Processing metadata for library document processing
Flow ID
Collection identifier
Processing status
Processing timestamp
Error message if processing failed
Additional properties are allowed.
Document content (for add-document with inline content)
Search criteria for filtering documents
Metadata field name
Value to match
Comparison operator
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for knowledge service (global service)
Unique request identifier
Service identifier for knowledge service
Knowledge graph core management request.
Operations: 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 userget-kg-core: Get knowledge core by IDput-kg-core: Store triples and/or embeddingsdelete-kg-core: Delete knowledge core by IDload-kg-core: Load knowledge core into flowunload-kg-core: Unload knowledge core from flowUser identifier (for list-kg-cores, put-kg-core, delete-kg-core)
Knowledge core ID (for get, put, delete, load, unload)
Flow ID (for load-kg-core)
Collection identifier (for load-kg-core)
Triples to store (for put-kg-core)
Knowledge core ID
User identifier
Collection identifier
Metadata triples
RDF triple (subject-predicate-object)
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Knowledge triples
RDF triple (subject-predicate-object)
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Graph embeddings to store (for put-kg-core)
Knowledge core ID
User identifier
Collection identifier
Metadata triples
RDF triple (subject-predicate-object)
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Entity embeddings
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Embedding vectors
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for collection-management service (global service)
Unique request identifier
Service identifier for collection-management service
Collection management request.
Operations: list-collections, update-collection, delete-collection
Collection operation:
list-collections: List collections for userupdate-collection: Create or update collection metadatadelete-collection: Delete collectionUser identifier
Collection identifier (for update, delete)
ISO timestamp
Human-readable collection name (for update)
Collection description (for update)
Collection tags for organization (for update)
Filter collections by tags (for list)
Maximum number of results (for list)
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for agent service (flow-hosted service)
Unique request identifier
Service identifier for agent service
Flow ID
Agent service request - conversational AI agent that can reason and take actions.
User question or prompt for the agent
Agent state for continuation (optional, for multi-turn)
Group identifiers for collaborative agents (optional)
Conversation history (optional, list of previous agent steps)
Agent's reasoning
Action taken
Action arguments
Result of the action
User context for this step
Additional properties are allowed.
User identifier for multi-tenancy
Enable streaming response delivery
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for document-rag service (flow-hosted service)
Unique request identifier
Service identifier for document-rag service
Flow ID
Document RAG (Retrieval-Augmented Generation) query request. Searches document embeddings and generates answer using retrieved context.
User query or question
User identifier for multi-tenancy
Collection to search within
Maximum number of documents to retrieve
Enable streaming response delivery
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for graph-rag service (flow-hosted service)
Unique request identifier
Service identifier for graph-rag service
Flow ID
Graph RAG (Retrieval-Augmented Generation) query request. Searches knowledge graph and generates answer using retrieved subgraph.
User query or question
User identifier for multi-tenancy
Collection to search within
Maximum number of entities to retrieve
Maximum number of triples to retrieve per entity
Maximum total subgraph size (triples)
Maximum path length for graph traversal
Enable streaming response delivery
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for text-completion service (flow-hosted service)
Unique request identifier
Service identifier for text-completion service
Flow ID
Text completion request - direct LLM completion without RAG.
System prompt that sets behavior and context for the LLM
User prompt or question
Enable streaming response delivery
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for prompt service (flow-hosted service)
Unique request identifier
Service identifier for prompt service
Flow ID
Prompt service request - template-based text generation.
Execute a stored prompt template with variable substitution.
Prompt template ID (stored in config)
Template variables as key-value pairs (values are JSON strings)
Alternative to terms - variables as native JSON values (auto-converted)
Enable streaming response delivery
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for embeddings service (flow-hosted service)
Unique request identifier
Service identifier for embeddings service
Flow ID
Embeddings request - convert text to vector embedding.
Text to convert to embedding vector
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for mcp-tool service (flow-hosted service)
Unique request identifier
Service identifier for mcp-tool service
Flow ID
MCP tool request - execute Model Context Protocol tool.
Tool name to execute
Tool parameters (JSON object, auto-converted to string internally)
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for triples service (flow-hosted service)
Unique request identifier
Service identifier for triples service
Flow ID
Triples query request - query knowledge graph by subject/predicate/object pattern.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Maximum number of triples to return
User identifier
Collection to query
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for objects service (flow-hosted service)
Unique request identifier
Service identifier for objects service
Flow ID
Objects query request - GraphQL query over knowledge graph.
GraphQL query string
GraphQL query variables
Operation name (for multi-operation documents)
User identifier
Collection to query
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for nlp-query service (flow-hosted service)
Unique request identifier
Service identifier for nlp-query service
Flow ID
NLP query request - convert natural language question to structured query.
Natural language question
Maximum results to return when query is executed
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for structured-query service (flow-hosted service)
Unique request identifier
Service identifier for structured-query service
Flow ID
Structured query request - natural language question with automatic execution.
Combines NLP query generation and execution in one call.
Natural language question
User identifier
Collection to query
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for structured-diag service (flow-hosted service)
Unique request identifier
Service identifier for structured-diag service
Flow ID
Structured data diagnosis request - analyze and understand structured data formats.
Operations: detect-type, generate-descriptor, diagnose, schema-selection
Diagnosis operation:
detect-type: Identify data format (CSV, JSON, XML)generate-descriptor: Create schema descriptor for datadiagnose: Full analysis (detect + generate descriptor)schema-selection: Find matching schemas for dataData sample to analyze (text content)
Data type (required for generate-descriptor)
Target schema name for descriptor generation (optional)
Format-specific options (e.g., CSV delimiter)
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for graph-embeddings service (flow-hosted service)
Unique request identifier
Service identifier for graph-embeddings service
Flow ID
Graph embeddings query request - find similar entities by vector similarity.
Query embedding vector
Maximum number of entities to return
User identifier
Collection to search
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for document-embeddings service (flow-hosted service)
Unique request identifier
Service identifier for document-embeddings service
Flow ID
Document embeddings query request - find similar documents by vector similarity.
Query embedding vector
Maximum number of document chunks to return
User identifier
Collection to search
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for text-load service (flow-hosted service)
Unique request identifier
Service identifier for text-load service
Flow ID
Text load request - load text document into processing pipeline.
Fire-and-forget operation (no response).
Text content (base64 encoded)
Document identifier
User identifier
Collection for document
Text character encoding
Document metadata as RDF triples
RDF triple (subject-predicate-object)
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
WebSocket request for document-load service (flow-hosted service)
Unique request identifier
Service identifier for document-load service
Flow ID
Document load request - load binary document (PDF, etc.) into processing pipeline.
Fire-and-forget operation (no response).
Document data (base64 encoded)
Document identifier
User identifier
Collection for document
Document metadata as RDF triples
RDF triple (subject-predicate-object)
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
RDF value - can be entity/URI or literal
Value (URI or literal text)
True if entity/URI, false if literal
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Additional properties are allowed.
Successful response from any TrustGraph service
Generic response message from any TrustGraph service.
The response field payload varies by service and matches the REST API response body schema.
For streaming services, multiple messages with the same id may be sent.
WebSocket response message envelope for successful responses.
Contains the request ID for correlation and the service-specific response payload.
Request identifier from the original request. Client uses this to match responses to requests in multiplexed communication.
Service-specific response payload. Structure is identical to the response body in the corresponding REST API endpoint.
For streaming services, multiple response messages may be sent with the same id.
Look for end-of-stream or service-specific completion flags to detect the final message.
See OpenAPI specification for detailed schemas per service.
Additional properties are allowed.
Additional properties are allowed.
Error response from any TrustGraph service
Error message sent when a service request fails.
Contains the request ID and error details.
WebSocket error message envelope.
Sent when a request fails. Contains the request ID and error details.
Request identifier from the original request that failed.
Error information
Error type/category
Human-readable error message
Additional properties are allowed.
Additional properties are allowed.
WebSocket request message envelope.
Wraps service-specific request payloads with routing and correlation metadata.
Client-generated unique identifier for this request within the WebSocket session. Used to correlate responses with requests in multiplexed async communication. Can be any string, but must be unique per active request.
Service identifier. Same as {kind} in REST API URLs.
Global services: config, flow, librarian, knowledge, collection-management Flow-hosted services: agent, text-completion, prompt, document-rag, graph-rag, embeddings, graph-embeddings, document-embeddings, triples, objects, nlp-query, structured-query, structured-diag, text-load, document-load, mcp-tool
Flow ID for flow-hosted services. Required for services accessed via /api/v1/flow/{flow}/service/{kind} in REST API.
Omit this field for global services (config, flow, librarian, knowledge, collection-management).
Service-specific request payload. Structure is identical to the request body in the corresponding REST API endpoint.
See OpenAPI specification for detailed schemas per service.
Additional properties are allowed.
Additional properties are allowed.
WebSocket response message envelope for successful responses.
Contains the request ID for correlation and the service-specific response payload.
Request identifier from the original request. Client uses this to match responses to requests in multiplexed communication.
Service-specific response payload. Structure is identical to the response body in the corresponding REST API endpoint.
For streaming services, multiple response messages may be sent with the same id.
Look for end-of-stream or service-specific completion flags to detect the final message.
See OpenAPI specification for detailed schemas per service.
Additional properties are allowed.
Additional properties are allowed.
WebSocket error message envelope.
Sent when a request fails. Contains the request ID and error details.
Request identifier from the original request that failed.
Error information
Error type/category
Human-readable error message
Additional properties are allowed.
Additional properties are allowed.