HTTP API (REST, GraphQL, admin, health and metrics): implementation reference

How the HTTP API port is built: the server and its TLS handling, the public and protected route groups, how a request is authenticated, every route and what its handler really does, type and error mapping, the OpenAPI file, limits, gaps and tests. For the score and how to connect, see the operator page HTTP/REST and GraphQL. Authentication policy across all wires is in Security. The Prometheus remote write and PromQL wire is a separate listener, described in Prometheus; the /metrics endpoint on this page exports SynergyDB's own metrics.

1. Source layout

File Role
src/protocol/http/mod.rs HttpHandler: listener, optional TLS on the same port, metrics token, rest-api feature gate
src/protocol/http/routes.rs build_router, AppState, SessionStore, the require_auth and track_connection middleware, and every handler
src/protocol/http/models.rs Request and response types (serde)
src/protocol/http/embeddings.rs EmbeddingProvider: OpenAI, HuggingFace or hash-based mock embeddings
src/query/graphql/mod.rs GraphQLAnalyzer, the GraphQL to LogicalPlan translator used by the GraphQL routes
docs/openapi.yaml The OpenAPI 3.1 description served at /openapi.yaml

Third-party crates: axum 0.7 (router, extractors, middleware), hyper 1 and hyper-util (the TLS connection loop), tower and tower-http 0.5 (ServeDir for the Studio files), serde_json, sha2 and subtle (token digests and constant-time compare), uuid (session tokens and ids), reqwest 0.12 (outbound embedding calls), prometheus 0.14 (/metrics text encoding), lazy_static and parking_lot (in-memory stores). The async-graphql crate is an optional dependency behind the graphql feature, but no source file uses it; GraphQL here is the hand-written GraphQLAnalyzer. (source: Cargo.toml, [dependencies], [features]; src/protocol/http/routes.rs, use lines; src/observability/metrics.rs, export_metrics)

2. Transport

  • Port: [server] http_port, default 8080. The listener starts whenever http_port is set. Default bind address is 127.0.0.1. (source: src/config.rs, ServerConfig::default; src/server/mod.rs, HTTP handler start)
  • Feature gate: the routes compile only with the rest-api feature, which is in the default feature set. Without it the handler prints that the REST API is not enabled and waits for shutdown. (source: Cargo.toml, [features]; src/protocol/http/mod.rs, HttpHandler::start)
  • Without TLS the router is served by axum::serve with client addresses attached (into_make_service_with_connect_info), and graceful shutdown. (source: src/protocol/http/mod.rs, HttpHandler::start)
  • With a TLS certificate configured, HTTP and HTTPS share the port: TlsListener::accept_auto wraps a connection that opens with a TLS ClientHello and passes any other connection through as plain HTTP. Each connection is then served by hyper's HTTP/1 connection builder (http1::Builder), so HTTP/2 is not offered on this path. The shutdown signal stops the accept loop; connections already open are not drained. (source: src/protocol/http/mod.rs, HttpHandler::start, with_tls; Security, TLS table) Not verified: no test covers HTTPS on this port.
  • No CORS layer, request timeout or concurrency limit is installed on the router, although tower-http is built with its cors feature. (source: src/protocol/http/routes.rs, build_router; Cargo.toml, tower-http)
  • Body size: no route sets DefaultBodyLimit, so axum's default limit for the Json extractor applies. When the audit log is on, the track_connection middleware buffers the body of POST requests whose path ends in /query or /graph/query up to 16 MiB; a larger body is replaced by an empty one, which the handler then rejects as invalid JSON. (source: src/protocol/http/routes.rs, build_router, track_connection) Not verified: no test sends an oversized body.
  • Static files: when a Studio build directory exists (SYNERGYDB_STATIC_DIR, else /app/static, else ./synergy-studio/dist), unknown paths are served from it with index.html as the single-page-app fallback. Otherwise unknown paths get 404 with a JSON message. Static files are outside the auth middleware. (source: src/protocol/http/routes.rs, get_static_dir, build_router, serve_index, fallback_no_studio)

3. Authentication

build_router merges two groups. The public group has no auth middleware; the protected group runs require_auth on every request. (source: src/protocol/http/routes.rs, build_router)

flowchart TD A["Request to a protected route"] --> B{"SYNERGYDB_DEV_INSECURE_AUTH set?"} B -- "yes" --> OK["Handler runs"] B -- "no" --> C{"Authorization header present?"} C -- "no" --> U1["401 with WWW-Authenticate: Bearer"] C -- "yes" --> D["Token = text after 'Bearer ' or 'ApiKey ', else the whole header"] D --> E{"Live session token?"} E -- "yes" --> F{"Role is superuser now, or path is /api/auth/logout?"} F -- "yes" --> OK F -- "no" --> X["403: the HTTP API requires a superuser"] E -- "no" --> G{"Token equals non-empty SYNERGYDB_API_KEY?"} G -- "yes" --> OK G -- "no" --> U2["401 Invalid or expired authentication token"]

(source: src/protocol/http/routes.rs, require_auth)

  • Session tokens. POST /api/auth/login takes {"username","password"} and checks them with the shared wire verifier verify_credential, so any catalog role with a password can log in. A role with no catalog entry can fall back to SYNERGYDB_SUPERUSER (default postgres) and SYNERGYDB_SUPERUSER_PASSWORD, compared in constant time; once the role exists in the catalog only its catalog password works. A success returns a token of the form synergy_<uuid>_<unix time> and a role label superuser or user. (source: src/protocol/http/routes.rs, studio_login)
  • Superuser only. A session is accepted only if the role is a superuser in the catalog at the time of each request (or, with no catalog role, was labelled superuser at login). Any other role gets 403 on every protected route except logout, because the HTTP API does not apply per-user table privileges. A role that loses superuser loses access at its next request. (source: src/protocol/http/routes.rs, require_auth)
  • Sessions are in memory. SessionStore is a HashMap with a fixed lifetime of 24 hours from creation, not extended by use. Sessions are lost on restart, are local to one node, and expired entries are removed only when someone calls logout. (source: src/protocol/http/routes.rs, SessionStore, studio_logout)
  • API key. SYNERGYDB_API_KEY is read from the environment on each request. An empty key never matches, and the comparison is constant-time over SHA-256 digests. Requests authenticated this way are recorded in the audit log as user api-key. (source: src/protocol/http/routes.rs, require_auth; docs/status/2026-11-29-open-wires-fail-closed.md)
  • Rate limiting applies to login only: per client IP, through the shared global_auth_rate_limiter, whose default allows 100 attempts per 60 s window and then locks the IP out for 60 s. A refused login gets HTTP 200 with success: false and a "Too many login attempts" error. Failed bearer tokens on protected routes are not counted. Behind a reverse proxy every client shares the proxy's address. (source: src/protocol/http/routes.rs, studio_login, check_http_rate_limit; src/protocol/rate_limiter.rs, RateLimiterConfig::default)
  • Development bypass. With SYNERGYDB_DEV_INSECURE_AUTH enabled, every protected route is open. (source: src/protocol/http/routes.rs, require_auth; src/auth/wire_auth.rs, dev_insecure_auth_enabled)
  • Diagnostics gate for /metrics and /api/v1/status: with a metrics token configured the caller must send Authorization: Bearer <token> (SHA-256 digests, constant-time compare; the ApiKey form is not accepted here). Without a token, only loopback callers and in-process callers with no peer address are answered, plus everyone under the development bypass. A refusal is 401 with WWW-Authenticate: Bearer and an empty body. The token comes from SYNERGYDB_METRICS_TOKEN, else [server] metrics_token; an empty value counts as unset. Startup logs a warning when no token is set. (source: src/protocol/http/routes.rs, diagnostics_authorized, diagnostics_denied; src/config.rs, select_metrics_token, effective_metrics_token; src/protocol/http/mod.rs, HttpHandler::start)
  • The HTTP API does not check synergy_wire_* roles; access is decided by superuser status or the API key alone. (source: src/protocol/http/routes.rs, require_auth)

4. Health, probes and cluster endpoints (public)

Route Answer Status codes
GET /health, /api/health, /api/v1/health {status, version, uptime_seconds, checks{storage, query_engine, memory}}. Storage is probed with one get; memory is degraded above 8192 MB allocated Always 200, even when status is unhealthy
GET /livez {"status":"ok"} Always 200
GET /readyz {status, not_ready[]}; checks that storage answers a get and that the query engine exists 200 or 503
GET /cluster/role {role, writable, leader}; role is standalone, leader or replica; leader is the leader's node id when known Always 200
GET /cluster/writable Same body 200 on a leader or standalone node, 503 on a replica
GET /openapi.yaml The spec file, searched at SYNERGYDB_OPENAPI_YAML, ./openapi.yaml, ./docs/openapi.yaml, beside the binary and under /app 200 or 404
GET /openapi.json Same search for openapi.json; none is shipped in docs/ 404 with a hint to use the YAML
POST /api/auth/login See section 3 Always 200; success tells the result

(source: src/protocol/http/routes.rs, health_check, liveness_probe, readiness_probe, cluster_role, cluster_writable, cluster_role_body, openapi_candidates, serve_openapi_yaml, serve_openapi_json; src/distributed/node_role.rs, NodeRole, is_read_only)

The cluster endpoints are meant for a load balancer health check, so that writes follow the leader through a failover. (source: docs/status/2026-11-29-cluster-leader-routing.md) That entry records an HAProxy failover run that lost no acknowledged write, but its writes went over the PostgreSQL wire. The HTTP data routes themselves do not check the node role: only the PostgreSQL, Redis and CouchDB handlers call node_role::is_read_only before a write. Not verified: what a write sent to /api/v1/query on a replica does. (source: src/protocol/postgres/mod.rs; src/protocol/redis/commands.rs; src/protocol/couchdb/api.rs; src/protocol/http/routes.rs, execute_query)

The doc comment on openapi_candidates names SYNERGYDB_OPENAPI_PATH, but the code reads SYNERGYDB_OPENAPI_YAML and SYNERGYDB_OPENAPI_JSON. (source: src/protocol/http/routes.rs, openapi_candidates)

5. Metrics and status (diagnostics gate)

  • GET /metrics returns the prometheus crate's text encoding of the process registry with content type text/plain; version=0.0.4; charset=utf-8. Metric families include synergydb_connections_active, synergydb_queries_total, synergydb_query_duration_seconds, synergydb_rows_returned_total, synergydb_transactions_committed_total, synergydb_auth_attempts_total, synergydb_compactions_total, synergydb_replication_lag_seconds and synergydb_vector_searches_total. (source: src/protocol/http/routes.rs, prometheus_metrics; src/observability/metrics.rs, REGISTRY, export_metrics)
  • GET /api/v1/status returns version, uptime, active and total connections, allocated memory and storage figures. storage.tables is always 0, total_rows is the storage sequence number (a count of operations, not rows), and disk_bytes is the memtable size plus 64 MiB per SSTable, an estimate. (source: src/protocol/http/routes.rs, server_status)
  • The gate exists so that a server on a routable address does not describe itself to strangers, but the public /health still returns the version and uptime, and /cluster/role returns the leader's node id. (source: src/protocol/http/routes.rs, diagnostics_authorized doc comment, health_check, cluster_role_body)

6. Query routes (protected)

All query routes share one QueryEngine per server, held behind a single RwLock and taken for writing on every call. HTTP queries therefore run one at a time, and engine session state (an open transaction, SET values) is shared by every HTTP client. (source: src/protocol/http/routes.rs, AppState::with_storage, execute_query)

Route What the handler does
POST /api/v1/query Body {query, language, params, transaction_id}. language sql or synergyql goes to SqlAnalyzer, cypher to CypherAnalyzer (the src/query/cypher/ parser, not the Bolt executor); mql and anything else are refused with an error. params and transaction_id are accepted and ignored. Answers {success, columns, rows, rows_affected, execution_time_ms, error}
POST /api/v1/graphql, POST /graphql GraphQLAnalyzer::parse, then the shared engine (see below). operationName and variables are ignored
POST /api/query Studio query box: maps a protocol name to a language (postgresql, mysql and other SQL names to SQL, mongodb to MQL after shell-syntax conversion, bolt to Cypher, elasticsearch, dynamodb, http and grpc to a JSON query translated to SQL; redis and memcached are refused with a pointer to the Redis port)
GET /api/schema Tables and columns from information_schema; the protocol parameter is read and ignored
POST /api/nl-query Keyword matching on the text (for example "how many" plus "user" becomes SELECT COUNT(*) ... FROM users) over the Studio sample tables. No language model is called
POST /api/init-sample-data Creates and fills the Studio sample tables
POST /api/v1/graph/query Passes query to QueryEngine::execute, which picks Cypher or SQL by the statement's first words; each result row becomes a node labelled Result with id n<i> and no edges
POST /api/v1/vectors/search Builds SELECT *, vector_distance(<column>, ARRAY[...]) ... ORDER BY distance LIMIT k
POST /api/v1/vectors/search/advanced Vector search with a metadata filter compiled to a SQL WHERE
POST /api/v1/search Builds SELECT <columns> FROM <table> WHERE <first column> LIKE '%term%' LIMIT n; a substring match, not a full-text index

(source: src/protocol/http/routes.rs, execute_query, execute_graphql, execute_query_for_studio, convert_mongo_shell_to_json, get_schema_for_protocol, natural_language_query, init_sample_data, graph_query, vector_search, advanced_vector_search, full_text_search; src/query/engine.rs, detect_language; Neo4j Bolt)

In vector_search and full_text_search the table and column names from the body are put into the SQL text without the is_valid_identifier check that the table and row routes apply; the search term is quote-escaped. Only superusers or the API key reach these routes. (source: src/protocol/http/routes.rs, vector_search, full_text_search, is_valid_identifier)

GraphQL. GraphQLAnalyzer::parse tokenizes the document and turns only the first root field into a plan:

  • query { users(where: {id: "u1"}, limit: 10) { id name } } becomes a scan of table users with an equality filter (several keys are joined with AND), a projection of the selected fields and a limit. Selections are flat column names; nested objects, offset and orderBy arguments are not applied, and only equality is available in where.
  • Mutations createX, updateX and deleteX become INSERT, UPDATE and DELETE on table xs (the name lowercased plus s). The HTTP answer for a mutation is {"data":{"success":true}}; selected fields are not returned.
  • A SELECT result is returned as {"data":{"result":[{column: value}]}} with every value as a JSON string or null. Errors are returned in errors[] with HTTP 200.

(source: src/query/graphql/mod.rs, GraphQLAnalyzer::parse, to_logical_plan, query_to_plan, where_object_to_expr, mutation_to_plan, mutation_name_to_table; src/protocol/http/routes.rs, execute_graphql)

Not wired: GraphQL introspection (__schema, __type) and subscriptions exist in GraphQLAnalyzer::execute and the introspection and subscription modules, but the HTTP route calls parse, which does not use them: a subscription is refused with "Subscriptions cannot be converted to logical plans directly", and __schema is treated as a table name. No route upgrades to WebSocket, and WebSocketHandler is not referenced outside its module. (source: src/query/graphql/mod.rs, GraphQLAnalyzer::execute, to_logical_plan; src/protocol/http/routes.rs, execute_graphql)

7. Tables, rows and transactions (protected)

Route Behaviour
GET /api/v1/tables SHOW TABLES through the engine
POST /api/v1/tables CREATE TABLE from a JSON column list
GET /api/v1/tables/{name} Column list for one table
DELETE /api/v1/tables/{name} DROP TABLE
GET /api/v1/tables/{name}/rows Query string select, filter, limit (default 100, no upper cap), offset
POST /api/v1/tables/{name}/rows {"rows":[{col: value}]}; one INSERT per row
PUT /api/v1/tables/{name}/rows UPDATE with a JSON filter
DELETE /api/v1/tables/{name}/rows DELETE with a JSON filter
POST /api/v1/transactions Runs BEGIN, returns 201 and a new id tx_<uuid>
POST /api/v1/transactions/{id}/commit, /rollback Runs COMMIT or ROLLBACK

(source: src/protocol/http/routes.rs, list_tables, create_table, get_table_schema, drop_table, query_rows, insert_rows, update_rows, delete_rows, begin_transaction, commit_transaction, rollback_transaction, RowsQueryParams)

  • Injection guards. Table names and JSON filter keys must pass is_valid_identifier (ASCII letter or underscore, then letters, digits or underscores, at most 128 characters). A string filter must be one or more identifier op value predicates joined by AND, with op in = <> != < > <= >= IS, a value that is a number, true, false, null or a single-quoted string without quotes or backslashes, no ;, -- or /*, and at most 1024 characters. String values are quote-doubled. A rejected request gets 400. (source: src/protocol/http/routes.rs, is_valid_identifier, is_valid_filter, is_valid_predicate, is_valid_filter_value, json_value_to_where_clause, mutation_bad_request) Tested by test_is_valid_identifier_valid_cases, test_is_valid_identifier_invalid_cases and test_is_valid_identifier_boundary_cases in src/protocol/http/routes.rs; the filter validator has no test.
  • Delete with no filter. A null or empty-object filter produces no WHERE, so DELETE .../rows with such a filter deletes every row. (source: src/protocol/http/routes.rs, json_value_to_where_clause, delete_rows)
  • Inserts ignore failures. Each row is a separate INSERT; a failing row is skipped silently, the answer is always success: true, and rows_affected counts the rows that went in. The batch is not atomic. (source: src/protocol/http/routes.rs, insert_rows)
  • Transactions are not per client. The transaction id is generated but never stored or checked: commit and rollback ignore the {id} in the path and act on whatever transaction the shared engine has open, which may have been started by another HTTP client. transaction_id in a query body is ignored too. (source: src/protocol/http/routes.rs, begin_transaction, commit_transaction, execute_query; src/protocol/http/models.rs, QueryRequest) Not verified: no test exercises these routes.

8. AI-compatible routes (protected)

Route Behaviour
POST /v1/embeddings OpenAI request shape: input as a string, a list of strings or token arrays (tokens are joined as decimal numbers, not decoded), dimensions, encoding_format float or base64 (little-endian f32). usage tokens are estimated as one per 4 characters
GET /v1/models A fixed list of three OpenAI embedding model names
POST /v1/chat/completions If the last user message contains sql, query or select, it is parsed as SQL and run; the reply is the debug text of the result or of the error. Otherwise a fixed reply that echoes the message. No language model is called
POST /api/v1/documents/ingest Chunks documents (size, overlap and strategy configurable), embeds each chunk and inserts rows into the named table
POST /api/v1/documents/delete Deletes by ids, filter, _namespace or delete_all
POST /api/v1/langchain/retrieve Cosine vector search over a collection; with search_type mmr it fetches fetch_k (default 4 times k) candidates and re-ranks them by maximal marginal relevance
POST /vectors/upsert, POST /query, GET /vectors/fetch, POST /vectors/delete Pinecone-shaped calls over a fixed table vectors(id, embedding, metadata, namespace), namespace default default
GET /describe_index_stats Fixed answer: dimension 1536, zero vectors

(source: src/protocol/http/routes.rs, openai_embeddings, generate_embeddings, openai_list_models, openai_chat_completions, ingest_documents, chunk_document, delete_documents, langchain_retrieve, apply_mmr, pinecone_upsert, pinecone_query, pinecone_fetch, pinecone_delete, pinecone_describe_index_stats)

Embedding provider: OPENAI_API_KEY selects OpenAI (model from OPENAI_EMBEDDING_MODEL, base address from OPENAI_BASE_URL), else HUGGINGFACE_API_KEY selects the HuggingFace inference API (HUGGINGFACE_MODEL), else a mock that hashes the text into a unit vector of 1536 dimensions by default. The choice is made once per process. When the configured provider fails, the route logs an error and answers 200 with mock vectors, so a client cannot tell from the response that the embeddings carry no meaning. (source: src/protocol/http/embeddings.rs, EmbeddingProvider::from_env, generate_mock_embeddings, get_embedding_provider; src/protocol/http/routes.rs, generate_embeddings; docs/EMBEDDINGS.md) Tested by test_mock_embeddings and test_default_provider in src/protocol/http/embeddings.rs; the OpenAI and HuggingFace paths and the routes have no test.

Not wired: /describe_index_stats returns constants. (source: src/protocol/http/routes.rs, pinecone_describe_index_stats)

9. Admin routes (protected)

Route What it does
GET /api/v1/databases Not wired: always one entry synergydb; the catalog query is built but not run
POST /api/v1/databases Runs CREATE DATABASE <name> OWNER <owner> CONNECTION LIMIT <n>; returns 201
GET /api/v1/databases/{name} Not wired: a fixed record for any valid name
DELETE /api/v1/databases/{name} Runs DROP DATABASE; refuses postgres, template0, template1 and synergydb with 403
GET /api/v1/databases/{name}/metrics Not wired: server-wide counters for any name; cache_hit_ratio is the constant 0.95 and byte counters are reported as IOPS
GET /api/v1/users Not wired: always one user postgres
POST /api/v1/users Runs CREATE USER ... WITH PASSWORD ... plus options, then GRANT for each listed role (grant errors are ignored)
GET /api/v1/users/{username} Not wired: a fixed record for any valid name
PUT /api/v1/users/{username} Runs ALTER USER ... WITH ... (password, connection limit, valid until)
DELETE /api/v1/users/{username} Runs DROP USER; refuses postgres with 403
POST /api/v1/backups Runs BackupManager::create_backup synchronously (or create_incremental_backup from the newest backup in the destination's parent). Default destination is a backups/<id> directory beside the data directory; the body may name another path
GET /api/v1/backups, GET /api/v1/backups/{id} Backups recorded since this process started
DELETE /api/v1/backups/{id} Removes the entry from the in-memory list; the files stay on disk
POST /api/v1/backups/{id}/restore 501 with the offline synergydb restore command to run instead
/api/v1/backup-schedules (GET, POST) and /{id} (GET, PUT, DELETE) Not wired: schedules are kept in memory and never run; the cron check only counts five fields and next_run is set to the creation time
GET /api/v1/system/metrics Connection counts per protocol and query totals from the metrics registry; CPU, memory and database list are zeros or empty
GET /api/v1/billing/usage, /usage/{user_id}, /summary/{user_id}, /history/{user_id} Reads USAGE_METER; summary defaults to the last 30 days, history to the last 7
/api/connections (GET, POST), /{id} (GET, DELETE), /{id}/test (POST) Migration source connections in an in-memory map; passwords are never echoed
POST /api/migrations Returns 202 with a job id

(source: src/protocol/http/routes.rs, list_databases, create_database, get_database, drop_database, get_database_metrics, list_users, create_user, get_user, update_user, drop_user, create_backup, list_backups, get_backup, delete_backup, restore_backup, create_backup_schedule, BACKUP_SCHEDULES, get_system_metrics, get_usage, get_billing_summary, get_usage_history, ConnectionConfig, CONNECTIONS, start_migration_job)

  • Not wired: migration. /api/connections/{id}/test reports success for eight known database type names without connecting, and /api/migrations returns a "started" job for tables users, products and orders (when none or * is given) without connecting, copying or tracking anything. (source: src/protocol/http/routes.rs, test_migration_connection, start_migration_job)
  • In create_database the owner value is put into the SQL text without the identifier check applied to the database name. (source: src/protocol/http/routes.rs, create_database)
  • The backup list, schedules, migration connections and sessions are process memory only; a restart forgets them, though backup files remain. (source: src/protocol/http/routes.rs, BACKUPS, BACKUP_SCHEDULES, CONNECTIONS, SessionStore)
  • Backup and restore behaviour is covered in more depth by docs/status/2026-11-24-backup-restore-drill.md. Not verified: that drill was not checked for whether it used the HTTP route.

10. Type and error mapping

  • Values. QueryResult::Select rows reach these handlers as optional strings, so every value in /api/v1/query, GraphQL, graph and row answers is a JSON string or null: integers, booleans and vectors arrive as text. A typed converter value_to_json exists in routes.rs but nothing calls it. (source: src/protocol/http/routes.rs, execute_query, execute_graphql, value_to_json)
  • rows_affected on a SELECT through /api/v1/query is the number of rows returned. Statements other than SELECT, INSERT, UPDATE and DELETE answer success: true with no detail. (source: src/protocol/http/routes.rs, execute_query)
  • Errors in the body, not the status. /api/v1/query, both GraphQL routes, /api/query, /api/auth/login, commit and rollback answer HTTP 200 with success: false (or errors[]) and the engine's error text. There are no SQLSTATE codes. (source: src/protocol/http/routes.rs, execute_query, execute_graphql, execute_query_for_studio, studio_login, commit_transaction)
  • Status codes that are used: 400 for invalid identifiers and filters, 401 and 403 from the auth layer, 404 for unknown backups, schedules and connections, 500 for failed admin SQL and failed backups, 501 for restore, 503 from /readyz, /cluster/writable and admin routes when the query engine is missing. A body that is not valid JSON for the route is rejected by axum's Json extractor before the handler runs. (source: src/protocol/http/routes.rs, handlers named above)

11. Audit

When the audit log is on, track_connection writes one access record per request to a data path (/api/..., /v1/..., /vectors/..., /query, /graphql), excluding health, metrics, OpenAPI and /cluster/* probes. The record holds method and path, client address, user (session username, api-key, the Basic user name or bearer-token), status, and for query paths the statement text up to 8192 characters. Access is classed as read, write or admin from the statement's first word, or from the method. 401 and 403 are recorded as denied, other 4xx and 5xx as failed. (source: src/protocol/http/routes.rs, track_connection, AuditUser) Not verified: no test checks HTTP audit records.

12. docs/openapi.yaml compared with the router

The file is OpenAPI 3.1 and lists 35 paths. Differences from the code:

Topic docs/openapi.yaml Code
Routes not described none of /health, /api/health, /cluster/role, /cluster/writable, /openapi.*, /graphql, /api/schema, /api/query, /api/init-sample-data, databases, users, backups, backup schedules, /api/v1/system/metrics, billing all routed
Auth on probes one global bearerAuth requirement with no per-route override, so health and probe routes read as protected public
Token format bearerFormat: JWT opaque synergy_<uuid>_<time> session token or the API key
POST /api/v1/query 400 on an invalid query; language enum includes mql and graphql 200 with success: false; only sql, synergyql and cypher run
POST /api/auth/login 401 on failure 200 with success: false
POST /api/nl-query required field question field query

(source: docs/openapi.yaml, paths, components.securitySchemes, QueryRequest, NaturalLanguageQueryRequest; src/protocol/http/routes.rs, build_router, execute_query, studio_login, NaturalLanguageQueryRequest)

13. Limits and unsupported features

  • One shared query engine: HTTP requests are serialized and share transaction and session state (section 6).
  • No HTTP/2 on the TLS path, no CORS headers, no request timeout, no streaming of large results; GET .../rows has no maximum limit.
  • No per-user privileges: only superusers or the API key may use protected routes.
  • Login rate limit only; failed bearer tokens are not limited.
  • Not wired: GraphQL introspection and subscriptions; migration jobs; backup schedules; online restore; database and user listing and detail; Pinecone index stats.
  • /v1/chat/completions and /api/nl-query contain no language model.

(source: sections above)

14. Tests and proof evidence

  • Unit tests in src/protocol/http/routes.rs: metrics_without_configured_token_are_public, metrics_with_token_reject_missing_header, metrics_with_token_reject_wrong_token, metrics_with_token_accept_correct_token, metrics_token_keeps_health_routes_public, test_health_paths_are_routed_without_auth, test_app_state_creation and the three is_valid_identifier tests. These drive build_router in process with tower::ServiceExt::oneshot; no peer address is attached, so the loopback rule of the diagnostics gate is not exercised.
  • src/protocol/http/mod.rs: test_handler_creation. src/protocol/http/embeddings.rs: test_mock_embeddings, test_default_provider.
  • tests/protocol_http.rs (19 tests): four construct HttpHandler; the other fifteen run SQL directly on a QueryEngine (create, select, update, delete, join, aggregates, persistence across restart, error cases). None sends an HTTP request or calls a route. The 2026-11-29 entry records this file at 19 passed. (source: tests/protocol_http.rs, handler_construction, sql_via_query_engine; docs/status/2026-11-29-open-wires-fail-closed.md)
  • src/query/graphql/mod.rs has 9 unit tests of the analyzer (simple query, where, create mutation, introspection, subscription parsing); they call the analyzer, not the HTTP route.
  • tests/full_protocol_test.sh sends curl requests to /api/v1/health and /api/v1/query without credentials. Against a server with auth on, the query checks are logged as skipped rather than failed, because the 401 body matches none of the script's patterns; they can pass only under the development bypass. Not verified: no recorded run of this script was found. (source: tests/full_protocol_test.sh, REST Endpoints section)
  • Proof pack docs/proof/2026-11-30/proof-pack-a3232c9/: report.md lists HTTP/REST and GraphQL among the wires not scored ("SynergyDB's own APIs; covered by unit and integration tests, no reference to diff against"). There is no HTTP log in the pack. (source: docs/proof/2026-11-30/proof-pack-a3232c9/report.md) This matches the Preview status on HTTP/REST and GraphQL.
  • Not verified: every protected route. No test in the repository sends a request to a route behind require_auth, checks the session or API-key paths, the 403 for non-superusers, the login rate limit, the cluster endpoints, TLS on this port, or any admin, AI-compatible or GraphQL route.