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

> Create a new folder

## Path Parameters

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

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

## Request Body

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

<ParamField body="type" type="string" required>
  Folder type: `content` or `asset`
</ParamField>

<ParamField body="parentId" type="string">
  Parent folder ID (null for root level)
</ParamField>

<ParamField body="order" type="number">
  Order position among siblings (defaults to end)
</ParamField>

### Example Request

```json theme={null}
{
  "name": "Content Search Templates",
  "parentId": null,
  "type": "content",
  "order": 2.0
}
```

## Response

Returns the created Folder object.

```json theme={null}
{
  "id": "folder789",
  "name": "Content Search Templates",
  "parentId": null,
  "type": "content",
  "order": 2.0,
  "createdAt": "2024-03-22T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}
```

## Error Responses

### Parent Not Found

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Parent folder with id folder123 not found"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/folders" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Content Search Templates",
      "type": "content",
      "order": 2.0
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/folders',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_JWT',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'Content Search Templates',
        type: 'content',
        order: 2.0
      })
    }
  );

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