> ## 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.

# Create Content

> Create a new content item

## Path Parameters

<ParamField path="organizationId" type="string" required>
  Organization ID
</ParamField>

<ParamField path="projectId" type="string" required>
  Project ID
</ParamField>

## Request Body

<ParamField body="typeId" type="string" required>
  ID of the ContentType to use
</ParamField>

<ParamField body="name" type="string" required>
  Display name for the content
</ParamField>

<ParamField body="description" type="string">
  Structured markdown description for semantic search
</ParamField>

<ParamField body="isTemplate" type="boolean" default="false">
  Whether this content should serve as a template
</ParamField>

<ParamField body="content" type="object" required>
  The content data following the ContentType's schema
</ParamField>

<ParamField body="tags" type="string[]">
  Tags for categorization and filtering
</ParamField>

<ParamField body="folderId" type="string">
  Folder ID for organization
</ParamField>

<ParamField body="metadata" type="object">
  Additional metadata

  <Expandable title="properties">
    <ParamField body="metadata.locale" type="string">
      Content locale (e.g., "en-US")
    </ParamField>
  </Expandable>
</ParamField>

### Example Request

```json theme={null}
{
  "typeId": "ct123",
  "name": "Getting Started Guide",
  "description": "Getting Started with Metabind. A comprehensive guide for new users.\n\n**Topics:** Technology, Platform Overview\n**Key points:** Platform basics, core features\n**Length:** ~1500 words\n**Language:** English",
  "isTemplate": false,
  "content": {
    "title": "Getting Started with Metabind",
    "subtitle": "Your journey begins here",
    "author": "Documentation Team",
    "heroImage": "asset999",
    "components": [
      {
        "type": "ArticleParagraph",
        "text": "Welcome to Metabind! This guide will help you get started..."
      },
      {
        "type": "ArticleHeading",
        "text": "First Steps",
        "level": 2
      }
    ]
  },
  "tags": ["Tutorial"],
  "metadata": {
    "locale": "en-US"
  }
}
```

## Response

Returns the created Content object with derived fields like `packageVersion` from the latest ContentType version.

```json theme={null}
{
  "id": "cont125",
  "typeId": "ct123",
  "typeVersion": 2,
  "version": null,
  "lastPublishedVersion": null,
  "packageVersion": "1.0.0",
  "name": "Getting Started Guide",
  "description": "Getting Started with Metabind...",
  "status": "draft",
  "isTemplate": false,
  "content": {
    "title": "Getting Started with Metabind",
    "subtitle": "Your journey begins here",
    "author": "Documentation Team",
    "heroImage": "asset999",
    "components": [...]
  },
  "compiled": "const body = () => { ... }",
  "tags": ["Tutorial"],
  "metadata": {
    "author": "user123",
    "locale": "en-US"
  },
  "createdAt": "2024-03-21T10:00:00Z",
  "updatedAt": "2024-03-21T10:00:00Z"
}
```

<Note>
  New content is created with `draft` status and `null` version. The `typeVersion` and `packageVersion` are automatically set from the latest published ContentType version.
</Note>

## Error Responses

### ContentType Not Found

```json theme={null}
{
  "error": {
    "code": "CONTENT_TYPE_NOT_FOUND",
    "message": "Content type not found",
    "details": {
      "typeId": "ct123"
    }
  }
}
```

### Validation Failed

```json theme={null}
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "Content does not match schema",
    "details": {
      "errors": [
        {
          "path": "/content/title",
          "message": "Required field missing"
        }
      ]
    }
  }
}
```

### Invalid Component

```json theme={null}
{
  "error": {
    "code": "INVALID_COMPONENT",
    "message": "Component type not allowed",
    "details": {
      "componentType": "VideoPlayer",
      "allowedTypes": ["ArticleParagraph", "ArticleHeading", "ArticleImage"]
    }
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "typeId": "ct123",
      "name": "Getting Started Guide",
      "content": {
        "title": "Getting Started with Metabind",
        "components": [
          {
            "type": "ArticleParagraph",
            "text": "Welcome to Metabind!"
          }
        ]
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        typeId: 'ct123',
        name: 'Getting Started Guide',
        content: {
          title: 'Getting Started with Metabind',
          components: [
            {
              type: 'ArticleParagraph',
              text: 'Welcome to Metabind!'
            }
          ]
        }
      })
    }
  );

  const content = await response.json();
  console.log(`Created content: ${content.id}`);
  ```
</CodeGroup>
