## Folder fields

`GET /v1/folders/fields`

Returns the schema of available entity fields: data types and the writability flag.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/folders/fields" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/folders/fields" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/folders/fields', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Fields:', Object.keys(data.fields).length)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/folders/fields', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Bitrix24 | Type | RO | Description |
|------|----------|-----|:--:|---------|
| `id` | `ID` | number | yes | Folder identifier |
| `name` | `NAME` | string | | Folder name. Required on creation |
| `parentId` | `PARENT_ID` | number | | Parent folder ID. Available only on creation, cannot be changed. List: `GET /v1/folders`, root folder: `GET /v1/storages` |
| `storageId` | `STORAGE_ID` | number | yes | Storage ID. List: `GET /v1/storages` |
| `code` | `CODE` | string | yes | Symbolic code. Not saved on creation and renaming |
| `type` | `TYPE` | string | yes | Object type: `"folder"` or `"file"` |
| `realObjectId` | `REAL_OBJECT_ID` | number | yes | Internal object ID |
| `detailUrl` | `DETAIL_URL` | string | yes | Link to the folder in the Bitrix24 interface |
| `deletedType` | `DELETED_TYPE` | number | yes | Deletion status: `0` — not deleted, `3` — in the trash, `4` — deleted together with the parent folder |
| `createdBy` | `CREATED_BY` | number | yes | Creator user ID. Lookup: `GET /v1/users` |
| `updatedBy` | `UPDATED_BY` | number | yes | ID of the author of the last change. Lookup: `GET /v1/users` |
| `deletedBy` | `DELETED_BY` | number | yes | ID of the user who deleted the folder. Lookup: `GET /v1/users` |
| `createdAt` | `CREATE_TIME` | datetime | yes | Creation date and time (ISO 8601 UTC) |
| `updatedAt` | `UPDATE_TIME` | datetime | yes | Date and time of the last change |
| `deletedAt` | `DELETE_TIME` | datetime | yes | Deletion date and time. `null` — folder is not deleted |

The `name` field is available on creation and renaming, `parentId` — only on creation. Via `PATCH /v1/folders/:id` only the `name` field is updated.

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "ID", "description": "Unique folder identifier." },
      "name": { "type": "string", "readonly": false, "label": "Name", "description": "Folder name. Required on creation and the only field available on renaming." },
      "parentId": { "type": "number", "readonly": false, "createOnly": true, "label": "Parent folder", "description": "Parent folder ID. Set only on creation and cannot be changed afterwards." },
      "storageId": { "type": "number", "readonly": true, "label": "Storage", "description": "ID of the Drive storage the folder belongs to." },
      "code": { "type": "string", "readonly": true, "label": "Symbolic code", "description": "Symbolic code of the folder. Not saved on creation or renaming." },
      "type": { "type": "string", "readonly": true, "label": "Object type", "description": "Drive object type — folder or file." },
      "realObjectId": { "type": "number", "readonly": true, "label": "Internal ID", "description": "Internal object identifier in the Drive storage system." },
      "detailUrl": { "type": "string", "readonly": true, "label": "Folder link", "description": "URL of the folder in the Bitrix24 web interface." },
      "deletedType": { "type": "number", "readonly": true, "label": "Deletion status", "description": "Deletion status: 0 — not deleted, 3 — in the trash, 4 — deleted together with the parent folder." },
      "createdBy": { "type": "number", "readonly": true, "label": "Creator", "description": "ID of the user who created the folder." },
      "updatedBy": { "type": "number", "readonly": true, "label": "Editor", "description": "ID of the user who made the last change." },
      "deletedBy": { "type": "number", "readonly": true, "label": "Deleted by", "description": "ID of the user who deleted the folder — null if the folder is not deleted." },
      "createdAt": { "type": "datetime", "readonly": true, "label": "Creation date", "description": "Date and time the folder was created." },
      "updatedAt": { "type": "datetime", "readonly": true, "label": "Change date", "description": "Date and time of the last change to the folder." },
      "deletedAt": { "type": "datetime", "readonly": true, "label": "Deletion date", "description": "Date and time the folder was deleted — null if the folder is not deleted." }
    },
    "relations": {
      "storage": { "type": "one", "entity": "storages", "includable": true }
    }
  }
}
```

## Error response example

403 — no `disk` scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'disk' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | API key does not have the `disk` scope |
| 401 | `TOKEN_MISSING` | API key has no configured portal tokens |
| 401 | `INVALID_API_KEY` | Invalid or expired API key |

Full list of common API errors — [Errors](/docs/errors).

## See also

- [Folder contents list](/docs/entities/folders/list)
- [Create folder](/docs/entities/folders/create)
- [Folders](/docs/entities/folders)
- [Files](/docs/entities/files)
- [Filtering syntax](/docs/filtering)
