Reference

Complete reference documentation for Stategraph configuration and APIs.

Reference Documentation

Document Description
Architecture Component overview: the local CLI, the Server, and your cloud
API Reference REST API endpoints and usage
Environment Variables Configuration options
SQL Syntax Complete query language reference
Releases & Downloads Docker images and binary downloads
Terraform CLI Compatibility Mapping of Terraform CLI commands to Stategraph equivalents
Glossary Definitions of key Stategraph terms and their Terraform mappings
Health Checks Liveness and readiness endpoints for monitoring and orchestration
Troubleshooting Common issues and solutions for deployment, authentication, and performance

API Endpoints

  • GET /api/v1/whoami - Current user information
  • GET /api/v1/mql - Execute SQL query
  • GET /api/v1/tenants/{id}/states - List states
  • POST /api/v1/states/backend/{group_id} - Store state (Terraform)
  • GET /api/v1/states/{id}/instances - List resource instances
  • GET /api/v1/states/{id}/costs - Cost snapshot for a state
  • GET /api/v1/openapi - OpenAPI schema

Full API Reference

Common Environment Variables

# Required
STATEGRAPH_UI_BASE=https://stategraph.example.com
DB_HOST=postgres
DB_USER=stategraph
DB_PASS=password
DB_NAME=stategraph

# Optional
STATEGRAPH_PORT=8180
STATEGRAPH_OAUTH_TYPE=google

Full Environment Variables Reference

SQL Quick Reference

-- Basic query
SELECT * FROM resources WHERE type = 'aws_instance'

-- Aggregation
SELECT type, count(*) FROM resources GROUP BY type ORDER BY type

-- JSON access
SELECT attributes->>'instance_type' FROM instances

Full SQL Reference