Infrastructure as data. API-first.
Query, diff, and transact on Terraform state over HTTP. Build internal tooling without scraping state files.
Integrate in 10 minutes
Three composable calls that cover the full Stategraph API surface.
$ curl -X POST https://stategraph.example.com/api/v1/api-users \ -H "Authorization: Bearer $ADMIN_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "ci-pipeline"}' # Response { "id": "sa_01j8k9x2p3q4r5s6t7u8v9w0", "name": "ci-pipeline", "token": "sg_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" } $ export SG_TOKEN="sg_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
$ curl "https://stategraph.example.com/api/v1/mql" \ -H "Authorization: Bearer $SG_TOKEN" \ --data-urlencode "q=SELECT type, COUNT(*) as count FROM instances GROUP BY type ORDER BY count DESC" # Your state, as structured data { "rows": [ { "type": "aws_instance", "count": 47 }, { "type": "aws_security_group", "count": 31 }, { "type": "aws_s3_bucket", "count": 18 }, { "type": "aws_iam_role", "count": 14 } ], "total": 4, "elapsed_ms": 12 }
$ curl \ "$SG_URL/api/v1/states/$STATE_ID/instances/aws_vpc.main/blast-radius" \ -H "Authorization: Bearer $SG_TOKEN" # Dependency tree with distance metrics { "address": "aws_vpc.main", "dependents": [ { "address": "aws_subnet.public_a", "distance": 1, "type": "aws_subnet" }, { "address": "aws_subnet.public_b", "distance": 1, "type": "aws_subnet" }, { "address": "aws_instance.web", "distance": 2, "type": "aws_instance" }, { "address": "aws_lb.app", "distance": 2, "type": "aws_lb" }, { "address": "aws_ecs_service.api", "distance": 3, "type": "aws_ecs_service" } ], "total_dependents": 23 }
API Endpoints
Concrete paths. Structured JSON responses. Full OpenAPI spec for every endpoint.
MQL Query API
Execute SQL-like queries against infrastructure state. Returns structured JSON. Use in dashboards, reports, and compliance tools.
States
List, create, and import states. Each state maps to a Terraform workspace and becomes queryable via MQL.
Transactions
GET /api/v1/tx/{tx_id}/logs
List transactions, fetch logs, and view audit trail. Full history of every terraform apply with tags and timestamps.
Blast Radius
Returns dependency tree with distance metrics for any resource. Use in pre-apply workflows to quantify change impact.
Gap Analysis
GET /api/v1/tenants/{tenant_id}/gaps
Detect drift between Terraform state and live cloud resources. AWS, GCP, and Azure. Results are cached for performance.
Terraform HTTP Backend
Implements the Terraform HTTP backend protocol. State locking, workspace support, drop-in replacement for S3 or GCS.
Integration Examples
Real workflows. Real JSON responses. Copy, paste, ship.
OpenAPI 3.0 Schema
Full OpenAPI specification for type-safe client generation in TypeScript, Python, Go, Rust, and any language with OpenAPI tooling.
$ npx openapi-typescript \ https://stategraph.example.com/api/v1/openapi \ --output stategraph.d.ts // Full type safety import { paths } from './stategraph'; type States = paths['/api/v1/tenants/{id}/states']['get'];
Auth & Access
Machine access uses service accounts. Each integration gets its own identity and token.
Build on Infrastructure as Data
Query, diff, and transact on your Terraform state over HTTP. OpenAPI schema for type-safe clients in any language.