GraphQL API
Moltis exposes a GraphQL API that mirrors gateway RPC methods with typed query and mutation responses where the data shape is known.
Availability
GraphQL is compile-time feature gated:
- Gateway feature:
graphql - CLI feature:
graphql(enabled in default feature set)
If Moltis is built without this feature, /graphql is not registered.
When built with the feature, GraphQL is runtime-toggleable:
- Config:
[graphql] enabled = true|false - UI:
Settings > GraphQLtoggle
Changes apply immediately, without restart.
Endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /graphql | GraphiQL playground and WebSocket subscriptions |
POST | /graphql | Queries and mutations |
WebSocket subprotocols accepted:
graphql-transport-wsgraphql-ws
Authentication and Security
GraphQL is protected by the same auth decisions used elsewhere in the gateway. It is not on the public path allowlist.
- With
web-uibuilds, GraphQL is behind the globalauth_gatemiddleware. - Without
web-ui, GraphQL is explicitly guarded bygraphql_auth_gate.
When auth is required and the request is unauthenticated, GraphQL returns 401
({"error":"not authenticated"} or {"error":"setup required"}).
When GraphQL is runtime-disabled, /graphql returns 503
({"error":"graphql server is disabled"}).
Supported auth methods:
- Valid session cookie (
moltis_session) Authorization: Bearer <api_key>
Schema Layout
The schema is organized by namespaces that map to gateway method groups.
Top-level query fields include:
healthstatussystem,node,chat,sessions,channelsconfig,cron,heartbeat,logstts,stt,voiceskills,models,providers,mcpusage,execApprovals,projects,memory,hooks,agentsvoicewake,device
Top-level mutation fields follow the same namespace pattern (for example:
chat.send, config.set, cron.add, providers.oauthStart, mcp.reauth).
Subscriptions include:
chatEventsessionChangedcronNotificationchannelEventnodeEventticklogEntrymcpStatusChangedapprovalEventconfigChangedpresenceChangedmetricsUpdateupdateAvailablevoiceConfigChangedskillsInstallProgressallEvents
Typed Data and Json Scalar
Most GraphQL return types are concrete structs. The custom Json scalar is
still used where runtime shape is intentionally dynamic (for example: arbitrary
config values, context payloads, or pass-through node payloads).
Examples
Query (health)
curl -sS http://localhost:13131/graphql \
-H 'content-type: application/json' \
-H 'authorization: Bearer mk_your_api_key' \
-d '{"query":"{ health { ok connections } }"}'
Query with namespace fields
query {
status {
hostname
version
connections
}
cron {
list {
id
name
enabled
}
}
}
Mutation
mutation {
chat {
send(message: "Hello from GraphQL") {
ok
sessionKey
}
}
}
Subscription (graphql-transport-ws)
- Connect to
ws://localhost:13131/graphqlwith subprotocolgraphql-transport-ws. - Send:
{ "type": "connection_init" }
- Start a subscription:
{
"id": "1",
"type": "subscribe",
"payload": {
"query": "subscription { tick { ts connections } }"
}
}
GraphiQL in the Web UI
When the binary includes GraphQL, the Settings page includes a GraphQL tab.
At the top of that page you can enable/disable GraphQL immediately; when
enabled it embeds GraphiQL at /graphql.