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

# Update Content Type

> Update an existing content type

## Path Parameters

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

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

<ParamField path="id" type="string" required>
  Content Type ID
</ParamField>

## Request Body

All fields are optional. Only provided fields will be updated.

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

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

<ParamField body="layoutComponentId" type="string">
  ID of the layout component
</ParamField>

<ParamField body="componentIdsAllowList" type="array">
  Array of component IDs or component groups
</ParamField>

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

<ParamField body="permissions" type="object">
  Access control settings
</ParamField>

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

### Example Request

```json theme={null}
{
  "description": "Updated description for blog posts",
  "componentIdsAllowList": [
    {
      "id": "content",
      "name": "Content Components",
      "componentIds": ["c126", "c127"]
    },
    {
      "id": "media",
      "name": "Media Components",
      "componentIds": ["c128", "c129"]
    }
  ],
  "templateContentIds": ["cont125", "cont126"]
}
```

<Note>
  Updating a published content type changes its status to `modified`. The changes will not affect published content until the content type is published again.
</Note>

## Response

Returns the updated ContentType object.

```json theme={null}
{
  "id": "ct123",
  "name": "Article",
  "description": "Updated description for blog posts",
  "status": "modified",
  "version": 3,
  "lastPublishedVersion": 3,
  "layoutComponentId": "c123",
  "componentIdsAllowList": [
    {
      "id": "content",
      "name": "Content Components",
      "componentIds": ["c126", "c127"]
    },
    {
      "id": "media",
      "name": "Media Components",
      "componentIds": ["c128", "c129"]
    }
  ],
  "packageVersion": "1.0.0",
  "schema": { ... },
  "templateContentIds": ["cont125", "cont126"],
  "permissions": { ... },
  "metadata": { ... },
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-21T14:30:00Z"
}
```

## Error Responses

### Content Type Not Found

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Content type not found"
  }
}
```

### Invalid Component Allow List

```json theme={null}
{
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "componentIdsAllowList validation failed",
    "details": {
      "duplicateGroupIds": ["questions"],
      "invalidComponentIds": ["c999"],
      "emptyGroups": ["media"],
      "missingFields": [
        {
          "groupIndex": 2,
          "missingFields": ["id"]
        }
      ]
    }
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content-types/ct123" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "description": "Updated description",
      "componentIdsAllowList": ["c126", "c127", "c128"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/content-types/ct123',
    {
      method: 'PUT',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        description: 'Updated description',
        componentIdsAllowList: ['c126', 'c127', 'c128']
      })
    }
  );

  const contentType = await response.json();
  console.log(`Updated content type, new status: ${contentType.status}`);
  ```
</CodeGroup>
