## Folder fields

`GET /v1/folders/fields`

Returns the schema of available entity fields: data types and whether each field is writable.

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

The response contains the folder field schema and available operations.

The `label` and `description` values are returned in English. Request headers do not switch the language.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Folder schema and available operations |
| `data.fields` | object | Dictionary of folder fields: each key is a field name, and each value is a metadata object. The dictionary fields are listed below |
| `data.fields.<field>` | object | Metadata object for one field: `type`, `readonly`, `label`, and `description` |
| `data.relations` | object | Folder relations. The `storage` relation describes the storage and can be included in the response |
| `data.batch` | array | Write operations available in [batch calls](/docs/batch): `create`, `update`, `delete` |
| `data.include` | array | Relation names accepted by the `include` parameter: `storage` |

### Folder field schema

The table lists the value types of the fields described in `data.fields`.

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

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

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "ID", "description": "Unique identifier of the folder." },
      "name": { "type": "string", "readonly": false, "label": "Name", "description": "Folder name; required on create and the only field editable via rename." },
      "parentId": { "type": "number", "readonly": false, "createOnly": true, "label": "Parent folder", "description": "ID of the parent folder; set only on create and cannot be changed afterward." },
      "storageId": { "type": "number", "readonly": true, "label": "Storage", "description": "ID of the Disk storage the folder belongs to." },
      "code": { "type": "string", "readonly": true, "label": "Symbolic code", "description": "Symbolic code of the folder; not persisted on create or rename." },
      "type": { "type": "string", "readonly": true, "label": "Object type", "description": "Type of the Disk object — folder or file." },
      "realObjectId": { "type": "number", "readonly": true, "label": "Internal ID", "description": "Internal identifier of the object in the Disk 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 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": "Last modified by", "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": "Modification 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 }
    },
    "batch": ["create", "update", "delete"],
    "include": ["storage"]
  }
}
```

## 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` | The key is not recognized — no such key exists on the platform |
| 429 | `RATE_LIMITED` | Rate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the `x-ratelimit-limit` header. Retry after the delay in the `Retry-After` header |

For the full list of common API errors, see [Errors](/docs/errors).

## See also

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