Skip to main content
POST
/
v1
/
graphs
/
supermodel
Supermodel graph
curl --request POST \
  --url https://api.supermodeltools.com/v1/graphs/supermodel \
  --header 'Content-Type: multipart/form-data' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --header 'X-Api-Key: <api-key>' \
  --form file='@example-file'
{
  "repo": "supermodel/supermodel-public-api",
  "version": "sir-2025-02-05",
  "schemaVersion": "1.2.0",
  "generatedAt": "2025-02-05T15:42:10.000Z",
  "summary": {
    "repoSizeBytes": 123456,
    "filesProcessed": 42,
    "classes": 8,
    "functions": 156,
    "types": 12,
    "primaryLanguage": "typescript",
    "domains": 5
  },
  "graph": {
    "nodes": [
      {
        "id": "src/index.ts",
        "labels": [
          "File"
        ],
        "properties": {
          "path": "src/index.ts",
          "name": "index.ts",
          "language": "typescript"
        }
      },
      {
        "id": "fn:src/index.ts:main",
        "labels": [
          "Function"
        ],
        "properties": {
          "name": "main",
          "filePath": "src/index.ts",
          "startLine": 10,
          "endLine": 25
        }
      },
      {
        "id": "fn:src/utils.ts:helper",
        "labels": [
          "Function"
        ],
        "properties": {
          "name": "helper",
          "filePath": "src/utils.ts"
        }
      },
      {
        "id": "domain:Core",
        "labels": [
          "Domain"
        ],
        "properties": {
          "name": "Core",
          "description": "Core application logic"
        }
      },
      {
        "id": "subdomain:Core:Initialization",
        "labels": [
          "Subdomain"
        ],
        "properties": {
          "name": "Initialization",
          "parentDomain": "Core"
        }
      }
    ],
    "relationships": [
      {
        "id": "src/index.ts_contains_fn:src/index.ts:main",
        "type": "contains",
        "startNode": "src/index.ts",
        "endNode": "fn:src/index.ts:main"
      },
      {
        "id": "src/index.ts_imports_src/utils.ts",
        "type": "imports",
        "startNode": "src/index.ts",
        "endNode": "src/utils.ts"
      },
      {
        "id": "fn:src/index.ts:main_calls_fn:src/utils.ts:helper",
        "type": "calls",
        "startNode": "fn:src/index.ts:main",
        "endNode": "fn:src/utils.ts:helper"
      },
      {
        "id": "fn:src/index.ts:main_belongsTo_subdomain:Core:Initialization",
        "type": "belongsTo",
        "startNode": "fn:src/index.ts:main",
        "endNode": "subdomain:Core:Initialization"
      }
    ]
  },
  "artifacts": [
    {
      "id": "artifact-usage-summary",
      "kind": "summary",
      "label": "Usage Insights",
      "metadata": {
        "repoSizeBytes": 123456,
        "filesProcessed": 42,
        "functions": 156,
        "classes": 8
      }
    },
    {
      "id": "parse-graph",
      "kind": "graph",
      "label": "Parse Graph",
      "metadata": {
        "nodeCount": 150,
        "relationshipCount": 280
      }
    },
    {
      "id": "call-graph",
      "kind": "graph",
      "label": "Call Graph",
      "metadata": {
        "totalFunctions": 156,
        "totalCalls": 423
      }
    },
    {
      "id": "domain-classification",
      "kind": "classification",
      "label": "Domain Classification",
      "metadata": {
        "domainCount": 5,
        "relationshipCount": 8,
        "fileAssignments": 42,
        "functionAssignments": 120
      }
    }
  ]
}

Authorizations

X-Api-Key
string
header
required

API key issued by the control plane for accessing data plane resources.

Headers

Idempotency-Key
string
required

Unique identifier for this request for idempotency and tracing.

Body

multipart/form-data
file
file
required

Zipped repository archive containing the code to analyze.

Response

200 - application/json

Supermodel IR document

repo
string
required

Repository slug the IR was generated from.

version
string
required

Version identifier for the IR content.

schemaVersion
string
required

Version of the IR schema.

generatedAt
string<date-time>
required

Timestamp when the IR was generated.

graph
object
required

Unified code graph containing all nodes and relationships.

summary
object

High-level metadata and summary insights including filesProcessed, classes, functions, types, primaryLanguage, and domains count.

artifacts
object[]

Per-source statistics and metadata for parse graph, call graph, and domain classification.