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:
The /api/v1/socket endpoint uses in-band authentication.
The WebSocket handshake is accepted unconditionally. The client
must authenticate by sending a bearer token as the first message
after connecting. The gateway resolves the token to an
authenticated identity and workspace.
All subsequent requests execute within the workspace context established by the authentication frame.
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-scoped servicesrequest/response: Service-specific payload (identical to REST API schemas)error: Error information on failureGlobal Services (no workspace scoping):
Workspace-Scoped Services (workspace resolved from token):
Flow-Scoped Services (require flow parameter, workspace from token):
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. The /api/v1/socket endpoint
uses in-band authentication: the WebSocket handshake is
accepted unconditionally and the client sends a bearer token
as the first frame after connecting. The token is an opaque
string obtained via the IAM service.
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
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.
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.
WebSocket request message envelope.
Wraps service-specific request payloads with routing and correlation metadata.
WebSocket response message envelope for successful responses.
Contains the request ID for correlation and the service-specific response payload.
WebSocket error message envelope.
Sent when a request fails. Contains the request ID and error details.