API Reference and CLI Manual

Complete reference for Geode CLI commands and GQL language surface.

CLI Overview

Geode ships a unified geode binary. Compatibility symlinks (geoded, geodec) are provided for legacy workflows.

CommandPurposeUsage
geode serveServer daemongeode serve --listen 0.0.0.0:3141
geode queryOne-shot query executiongeode query --dsn quic://localhost:3141/social "RETURN 1 AS x"
geode shell / gqlInteractive REPLgeode shell --server 127.0.0.1:3141
geode authLogin, session, and offline auth integrity workflowsgeode auth login -U geode --save-session
geode user / role / policyLocal auth-store admin commandsgeode user create alice [email protected] --password 'secret'
geode grant / revokePermission changesgeode grant read:users --to alice
geode apikeyAPI key managementgeode apikey create --user alice --name prod-app --scope query:execute
geode backup / restore / migrateData operationsgeode backup --output /backups/geode.tar.gz
geode lsp / mcpTooling integrationsgeode mcp

Current limitation (main, 2026-03-30)

geode user, role, policy, grant, revoke, apikey, and CLI MFA flows still operate on the local auth store instead of delegating to a running server. Use them for on-host/offline administration until GAP-0270 is closed.

Server Commands (geode serve)

Start Server

# Default (0.0.0.0:3141)
geode serve

# Custom listen address
geode serve --listen 0.0.0.0:3141

# With configuration file
geode serve --config /etc/geode/geode.yaml

# With TLS certificates
geode serve \
  --cert /etc/geode/certs/server-cert.pem \
  --key /etc/geode/certs/server-key.pem

# With data directory
geode serve --data-dir /var/lib/geode

Server Flags

FlagDescriptionDefault
--data-dir <path>Data directory./data
--listen <addr:port>Listen address0.0.0.0:3141
--cert <path>TLS certificate pathauto-generated if missing
--key <path>TLS private key pathauto-generated if missing
--log-level <level>debug|info|warn|errorinfo
--idle-timeout <ms>QUIC idle timeout300000
--persist-interval <ms>Background persistence interval100
--helpShow help-

Client Commands (geode query)

Execute Query

# Single query
geode query "RETURN 1 AS x" --server 127.0.0.1:3141

# Query from file
geode query -f query.gql --server 127.0.0.1:3141

# Query from stdin
echo "RETURN 1 AS x" | geode query -

# With output format
geode query --format json "MATCH (n) RETURN n LIMIT 10" --server 127.0.0.1:3141
geode query --format table "MATCH (n) RETURN n LIMIT 10" --server 127.0.0.1:3141
geode query --format csv "MATCH (n) RETURN n LIMIT 10" --server 127.0.0.1:3141
geode query --format dot "MATCH (a)-[r]->(b) RETURN a, r, b" | dot -Tpng -o graph.png

# Show execution time
geode query --timeout 5 --retry 3 "MATCH (p:Person) RETURN p.name" --server 127.0.0.1:3141

# Connect with a DSN and bind to a graph
geode query --dsn quic://geode:[email protected]:3141/social "MATCH (n) RETURN count(n)"

Client Flags

FlagDescriptionDefault
--dsn <dsn>Connection DSN-
-f, --file <path>Read query from file-
-g, --graph <name>Graph name (prepends USE GRAPH)-
--format <fmt>Output format (json|table|csv|dot)json
--page-size <n>Results page size1000
--timeout <seconds>Connection timeout in seconds30
--retry <count>Retry attempts on failure0
--server <addr:port>Server address127.0.0.1:3141
--grpcUse gRPC instead of QUICfalse
--insecure-tls-skip-verifySkip TLS verificationfalse
--ca-cert <path>CA certificate for server verification-
--client-cert <path>Client certificate for mTLS-
--client-key <path>Client private key for mTLS-
-U, --user <username>Authenticate as user-
-P, --password [pass]Password (prompts if omitted)-
--no-saved-sessionDo not auto-load saved credentialsfalse
--helpShow help-

DSN Notes

  • quic:// is still the default and recommended transport
  • grpc:// uses port 50051 by default
  • DSNs can now bind a session to a graph at connect time: quic://host:3141/graph
  • Graph-bound sessions reject USE GRAPH for the lifetime of that connection
  • DSN credentials override -U / -P

Interactive Shell (geode shell)

Start REPL

# Start shell
geode shell

# Or alternative entrypoint
gql

# Start shell with DSN graph binding
geode shell --dsn quic://geode:secret@localhost:3141/social

Meta Commands

From REPL_USAGE.md:

CommandDescriptionExample
\connect <uri>Connect to server\connect quic://localhost:3141
\beginStart transaction\begin
\commitCommit transaction\commit
\rollbackRollback transaction\rollback
\format <fmt>Set output format\format json
\timing on|offToggle execution timing\timing on
\helpShow help\help
\quitExit shell\quit

Shell Example Session

-- Connect
\connect quic://localhost:3141/social

-- Set format
\format json

-- Run query
MATCH (p:Person) RETURN p.name;

-- Start transaction
\begin

CREATE (:Person {name: "Alice", age: 30});

-- Commit
\commit

-- Exit
\quit

Authentication Commands (geode auth)

# Login and save a reusable session
geode auth login -U geode --save-session

# View or clear saved credentials
geode auth token
geode auth logout

# Offline auth-store integrity operations
geode auth init --data-dir /var/lib/geode
geode auth reseal --data-dir /var/lib/geode
geode auth verify --data-dir /var/lib/geode

geode auth Command Set

CommandPurpose
loginAuthenticate and optionally save session credentials
logoutClear saved credentials
tokenPrint saved credentials JSON
initBootstrap admin user into the local auth graph (offline)
resealRecompute HMAC chain for the local auth graph (offline)
verifyCheck HMAC chain integrity for the local auth graph (offline)

Admin and Ops Commands

Backup

# Local backup
geode backup --output /backups/geode-$(date +%Y%m%d).tar.gz

# S3 backup
geode backup --dest s3://my-bucket/backups/geode-$(date +%Y%m%d).tar.gz

# With credentials
AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... \
geode backup --dest s3://my-bucket/backups/backup.tar.gz

Restore

# Restore from local
geode restore \
  --input /backups/geode-20240115.tar.gz \
  --data-dir /var/lib/geode

# Restore from S3
geode restore \
  --source s3://my-bucket/backups/geode-20240115.tar.gz \
  --data-dir /var/lib/geode

# Point-in-time recovery
geode restore \
  --source s3://my-bucket/backups/geode-20240115.tar.gz \
  --wal-dir /var/lib/geode/wal \
  --until "2024-01-15T14:30:00Z"

GQL Language Reference

Keywords

From API_REFERENCE_GENERATED.md, key GQL keywords:

Query Keywords:

  • MATCH - Pattern matching
  • WHERE - Filter predicates
  • RETURN - Projection
  • WITH - Pipeline chaining
  • ORDER BY - Sorting
  • LIMIT - Limit results
  • OFFSET - Skip results
  • DISTINCT - Remove duplicates

Write Keywords:

  • CREATE - Create nodes/relationships
  • DELETE - Delete nodes/relationships
  • DETACH DELETE - Delete node and relationships
  • SET - Update properties
  • MERGE - Upsert pattern
  • ON CREATE - Merge onCreate clause
  • ON MATCH - Merge onMatch clause

Transaction Keywords:

  • START TRANSACTION - Begin transaction
  • COMMIT - Commit changes
  • ROLLBACK - Rollback changes
  • SAVEPOINT - Create savepoint (extension)
  • ROLLBACK TO SAVEPOINT - Partial rollback (extension)

Set Operations:

  • UNION - Combine results (remove duplicates)
  • UNION ALL - Combine results (keep duplicates)
  • INTERSECT - Common results
  • EXCEPT - Set difference

Graph Operations:

  • CREATE GRAPH - Create graph
  • USE - Select graph
  • DROP GRAPH - Delete graph

Built-in Functions

Aggregation Functions
FunctionDescriptionExample
COUNT()Count rowsRETURN COUNT(p)
SUM()Sum valuesRETURN SUM(p.age)
AVG()Average valuesRETURN AVG(p.age)
MIN()Minimum valueRETURN MIN(p.age)
MAX()Maximum valueRETURN MAX(p.age)
String Functions
FunctionDescriptionExample
upper()UppercaseRETURN upper("hello")"HELLO"
lower()LowercaseRETURN lower("HELLO")"hello"
substring()Extract substringRETURN substring("hello", 0, 3)"hel"
length()String lengthRETURN length("hello")5
Temporal Functions
FunctionDescriptionExample
timestamp()Current timestampRETURN timestamp()
date()Create dateRETURN date('2024-01-15')
time()Create timeRETURN time('14:30:00')
Type Conversion
FunctionDescriptionExample
toInteger()Convert to integerRETURN toInteger("42")42
toFloat()Convert to floatRETURN toFloat("3.14")3.14
toString()Convert to stringRETURN toString(42)"42"
toBoolean()Convert to booleanRETURN toBoolean("true")true
Vector Functions
FunctionDescriptionExample
vector_distance_l2()Euclidean distanceRETURN vector_distance_l2($a, $b)
vector_distance_cosine()Cosine distanceRETURN vector_distance_cosine($a, $b)
vector_distance_dot()Dot productRETURN vector_distance_dot($a, $b)

Data Types

From TYPES_AND_FUNCTIONS.md:

Core Types:

  • Null - Null value
  • Boolean - true/false
  • Integer - Signed integer (Int8/16/32/64)
  • Float - Floating point (Float32/64)
  • String - UTF-8 text
  • Decimal - Arbitrary precision decimal

Advanced Types:

  • Date - Calendar date
  • Time - Time of day
  • Timestamp - Date + time with timezone
  • Interval - Duration
  • JSON / JSONB - JSON data
  • Bytea - Binary data
  • VectorF32 / VectorI32 - Vector embeddings
  • LatLon / GeoPoint - Geographic coordinates
  • IpAddr / Subnet / MacAddr - Network addresses
  • UUID - Universally unique identifier
  • Hash - Cryptographic hash

See Data Model and Types for details.

Procedures

From API_REFERENCE_GENERATED.md:

Graph Algorithms:

  • graph.pageRank() - PageRank centrality
  • graph.betweenness() - Betweenness centrality
  • graph.closeness() - Closeness centrality
  • graph.louvain() - Community detection
  • graph.labelPropagation() - Label propagation
  • graph.node2vec() - Node2Vec embeddings
  • graph.graphSAGE() - GraphSAGE embeddings
  • graph.deepWalk() - DeepWalk embeddings

See Graph Algorithms for usage.

Next Steps