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

> Update an existing folder

## 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>
  Folder ID
</ParamField>

## Request Body

<ParamField body="name" type="string">
  Updated display name
</ParamField>

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

<ParamField body="order" type="number">
  Updated order position
</ParamField>

### Example Request

```json theme={null}
{
  "name": "Updated Name",
  "order": 1.5
}
```

<Note>
  The folder `type` cannot be changed after creation.
</Note>

## Response

Returns the updated Folder object.

```json theme={null}
{
  "id": "folder123",
  "name": "Updated Name",
  "parentId": null,
  "type": "content",
  "order": 1.5,
  "createdAt": "2024-03-20T10:00:00Z",
  "updatedAt": "2024-03-22T10:00:00Z"
}
```

## Error Responses

### Folder Not Found

```json theme={null}
{
  "error": {
    "code": "FOLDER_NOT_FOUND",
    "message": "Folder with ID folder123 not found"
  }
}
```

### Parent Not Found

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

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.metabind.ai/app/v1/organizations/org123/projects/proj456/folders/folder123" \
    -H "Authorization: Bearer YOUR_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Updated Name",
      "order": 1.5
    }'
  ```

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

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