---
title: "GraphDefinition"
description: "The `GraphDefinition` entity."
section: "Reference"
group: "Types"
order: 113
---

## Definition

```ts
interface GraphDefinition {
  id: string;
  workspaceId: string;
  name: string;
  slug: string;
  description: string | null;
  createdBy: string;
  deletedAt: string | null;
  retentionTier: "short" | "medium" | "long" | "none" | null;
  createdAt: string;
  updatedAt: string;
  nodeDefinitions?:
    | Array<{
        id: string;
        graphDefinitionId: string;
        schemaId: string;
        description: string | null;
        createdAt: string;
        updatedAt: string;
      }>
    | undefined;
  edgeDefinitions?:
    | Array<{
        id: string;
        graphDefinitionId: string;
        fromSchemaId: string;
        toSchemaId: string;
        schemaId: string | null;
        description: string | null;
        createdAt: string;
        updatedAt: string;
      }>
    | undefined;
  graphCount?: number | undefined;
}
```

## Fields

| Field             | Type                                                                                                                                                                                                    | Notes                                                                                                                                        |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`              | `string`                                                                                                                                                                                                | `readonly` `required`                                                                                                                        |
| `workspaceId`     | `string`                                                                                                                                                                                                | `required` — Workspace that owns this graph definition.                                                                                      |
| `name`            | `string`                                                                                                                                                                                                | `required` — Human-readable definition name.                                                                                                 |
| `slug`            | `string`                                                                                                                                                                                                | `required` — URL-friendly identifier scoped to the workspace.                                                                                |
| `description`     | `string \| null`                                                                                                                                                                                        | `required` — Optional longer-form description.                                                                                               |
| `createdBy`       | `string`                                                                                                                                                                                                | `required` — User who created the graph definition.                                                                                          |
| `deletedAt`       | `string \| null`                                                                                                                                                                                        | `required` — ISO-8601 timestamp of soft-delete; null while active. Cleanup worker hard-deletes once `deletedAt + retentionTier.days` passes. |
| `retentionTier`   | `"short" \| "medium" \| "long" \| "none" \| null`                                                                                                                                                       | `required` — Retention tier snapshotted at delete time. `short`=7d, `medium`=30d, `long`=90d, `none`=never. Null while active.               |
| `createdAt`       | `string`                                                                                                                                                                                                | `readonly` `required` — ISO-8601 timestamp of creation.                                                                                      |
| `updatedAt`       | `string`                                                                                                                                                                                                | `readonly` `required` — ISO-8601 timestamp of the last update.                                                                               |
| `nodeDefinitions` | `Array<{ id: string; graphDefinitionId: string; schemaId: string; description: string \| null; createdAt: string; updatedAt: string; }> \| undefined`                                                   | `optional` — Declared node types, included when requested.                                                                                   |
| `edgeDefinitions` | `Array<{ id: string; graphDefinitionId: string; fromSchemaId: string; toSchemaId: string; schemaId: string \| null; description: string \| null; createdAt: string; updatedAt: string; }> \| undefined` | `optional` — Declared edge types, included when requested.                                                                                   |
| `graphCount`      | `number \| undefined`                                                                                                                                                                                   | `optional` — Number of graph instances extracted against this definition, when included.                                                     |
