> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Content Types Overview

> Define content structure and layout through reusable content type definitions

A ContentType defines a specific kind of content (e.g., "Article", "BlogPost") and specifies its layout structure through a layout component. ContentTypes follow the same versioning pattern as other resources, with draft and published status, while maintaining references to specific package versions for component stability.

## Key Concepts

<CardGroup cols={2}>
  <Card title="Content Structure" icon="sitemap">
    Define expected content structure through a layout component and specify which components can be used via an allow list.
  </Card>

  <Card title="Status Management" icon="toggle-on">
    Support draft and published status with iterative development and version history.
  </Card>

  <Card title="Version Control" icon="code-branch">
    Independent versioning from packages with complete version history and rollback support.
  </Card>

  <Card title="Package Binding" icon="link">
    Reference specific package versions to ensure component stability across content.
  </Card>
</CardGroup>

## The ContentType Object

<ResponseField name="id" type="string">
  Unique identifier (UUID)
</ResponseField>

<ResponseField name="name" type="string">
  Display name of the type (e.g., "Article")
</ResponseField>

<ResponseField name="description" type="string">
  Structured markdown description for semantic search and LLM understanding
</ResponseField>

<ResponseField name="status" type="string">
  Current status: `draft`, `modified`, `published`, `unpublished`, or `deleted`
</ResponseField>

<ResponseField name="version" type="number">
  Current version number (increments on publish)
</ResponseField>

<ResponseField name="lastPublishedVersion" type="number">
  Last published version number (null if never published)
</ResponseField>

<ResponseField name="layoutComponentId" type="string">
  Reference to the layout Component that defines the structure
</ResponseField>

<ResponseField name="componentIdsAllowList" type="array">
  Array of component IDs or component groups that can be used within this content type
</ResponseField>

<ResponseField name="packageVersion" type="string">
  Version of package to use for component resolution
</ResponseField>

<ResponseField name="schema" type="object">
  JSON Schema auto-generated from layout and allowed components (system-managed)
</ResponseField>

<ResponseField name="templateContentIds" type="string[]">
  Array of pre-built content example IDs
</ResponseField>

<ResponseField name="permissions" type="object">
  Access control settings

  <Expandable title="properties">
    <ResponseField name="roles" type="string[]">Roles that can create content</ResponseField>
    <ResponseField name="users" type="string[]">Specific users that can create content</ResponseField>
    <ResponseField name="publish" type="object">Publishing permission settings</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="metadata" type="object">
  Additional type metadata

  <Expandable title="properties">
    <ResponseField name="author" type="string">Creator of the type</ResponseField>
    <ResponseField name="tags" type="string[]">Type categories</ResponseField>
    <ResponseField name="locales" type="string[]">Supported locales</ResponseField>
    <ResponseField name="publishedAt" type="string">Last publish timestamp</ResponseField>
    <ResponseField name="publishedBy" type="string">Last publisher</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="createdAt" type="string">
  Creation timestamp (ISO format)
</ResponseField>

<ResponseField name="updatedAt" type="string">
  Last update timestamp (ISO format)
</ResponseField>

### Example ContentType

```json theme={null}
{
  "id": "ct123",
  "name": "Article",
  "description": "Standard article content type for long-form written content...",
  "status": "published",
  "version": 3,
  "lastPublishedVersion": 3,
  "layoutComponentId": "c123",
  "componentIdsAllowList": [
    "c124",
    {
      "id": "questions",
      "name": "Question Components",
      "componentIds": ["c125", "c126"]
    }
  ],
  "packageVersion": "1.0.0",
  "schema": { ... },
  "templateContentIds": ["cont123", "cont124"],
  "permissions": {
    "roles": ["editor", "journalist"],
    "users": ["jane.doe@metabind.ai"],
    "publish": {
      "roles": ["editor"],
      "users": []
    }
  },
  "metadata": {
    "author": "admin@metabind.ai",
    "tags": ["article", "content"],
    "locales": ["en-US", "es-ES", "fr-FR"]
  },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-20T15:00:00Z"
}
```

## Component Allow List

The `componentIdsAllowList` field supports two formats:

### Simple Component IDs

```json theme={null}
{
  "componentIdsAllowList": ["c124", "c125", "c126"]
}
```

### Grouped Components

Group related components with optional display names:

```json theme={null}
{
  "componentIdsAllowList": [
    "c124",
    {
      "id": "questions",
      "name": "Question Components",
      "componentIds": ["c125", "c126"]
    },
    {
      "id": "answers",
      "name": "Answer Components",
      "componentIds": ["c127", "c128"]
    }
  ]
}
```

| Field          | Type      | Required | Description                     |
| -------------- | --------- | -------- | ------------------------------- |
| `id`           | string    | Yes      | Unique identifier for the group |
| `name`         | string    | No       | Display name for the group      |
| `componentIds` | string\[] | Yes      | Component IDs within this group |

<Note>
  Group IDs must be unique within the content type. Component IDs can appear in multiple groups. Both formats can be mixed in the same array.
</Note>

## Schema Generation

ContentTypes automatically generate a comprehensive JSON Schema that:

1. **Includes complete component definitions** using the `oneOf` pattern
2. **Provides full property schemas** for each allowed component
3. **Enables LLM understanding** with complete structural information

When a ContentType is saved, the system:

1. Fetches the layout component schema
2. Fetches schemas for all allowed components
3. Generates a `oneOf` array for component options
4. Uses the schema to validate content on creation *and* update

## Description Best Practices

The description field follows a structured markdown format optimized for semantic search:

```markdown theme={null}
[Purpose and content structure summary]. [Target audience or use case].

**Content structure:**
- [Main content areas/sections]
- [Supported media types]

**Best for:**
- [Use case 1]
- [Use case 2]

**Typical length:** [Expected content volume]
**Supported platforms:** [Platform list]
```

<Note>
  Aim for 400-600 characters. Maximum is 800 characters.
</Note>
