
## File fields

`GET /v1/files/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/files/fields" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth app

```bash
curl "https://vibecode.bitrix24.com/v1/files/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/files/fields', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

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

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/files/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 | Object identifier |
| `name` | `NAME` | string | | File or folder name |
| `size` | `SIZE` | number | yes | File size in bytes. Returned for file records |
| `folderId` | `PARENT_ID` | number | | Parent folder ID. Folder list: `GET /v1/folders` |
| `storageId` | `STORAGE_ID` | number | yes | Storage ID. List: `GET /v1/storages` |
| `type` | `TYPE` | string | yes | Object type: `"file"` or `"folder"` |
| `code` | `CODE` | string | | Symbolic object code |
| `fileId` | `FILE_ID` | number | yes | Internal file ID. Returned for file records |
| `downloadUrl` | `DOWNLOAD_URL` | string | yes | Temporary download link. Returned for file records. For programmatic download — `GET /v1/files/:id/download` |
| `detailUrl` | `DETAIL_URL` | string | yes | Link to the object in the interface |
| `contentProvider` | `CONTENT_PROVIDER` | string | yes | Content provider. Returned only for files from external content providers — not returned for files on the Bitrix24 Drive |
| `globalContentVersion` | `GLOBAL_CONTENT_VERSION` | number | yes | File version counter. Returned for file records |
| `deletedType` | `DELETED_TYPE` | number | yes | Deletion status: `0` — not deleted, `3` — in trash, `4` — deleted together with the folder |
| `realObjectId` | `REAL_OBJECT_ID` | number | yes | Internal object ID |
| `createdBy` | `CREATED_BY` | number | yes | Creator user ID. Search: `GET /v1/users` |
| `updatedBy` | `UPDATED_BY` | number | yes | ID of the last editor. Search: `GET /v1/users` |
| `deletedBy` | `DELETED_BY` | number | yes | ID of the user who deleted the object. Search: `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` — object not deleted |

The `name`, `folderId`, and `code` fields are available when creating and updating an object. Via `PATCH /v1/files/:id` only the `name` field is updated.

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "ID", "description": "Identifier of the file or folder on the Drive." },
      "name": { "type": "string", "readonly": false, "label": "Name", "description": "File or folder name." },
      "size": { "type": "number", "readonly": true, "label": "Size", "description": "File size in bytes. Set only for file records." },
      "folderId": { "type": "number", "readonly": false, "label": "Folder ID", "description": "Identifier of the parent folder the object belongs to." },
      "storageId": { "type": "number", "readonly": true, "label": "Storage ID", "description": "Identifier of the Drive storage the object belongs to." },
      "type": { "type": "string", "readonly": true, "label": "Object type", "description": "Object type — file or folder." },
      "code": { "type": "string", "readonly": false, "label": "Symbolic code", "description": "Symbolic object code set on creation or update." },
      "fileId": { "type": "number", "readonly": true, "label": "File ID", "description": "Internal file identifier. Set only for file records." },
      "downloadUrl": { "type": "string", "readonly": true, "label": "Download link", "description": "Temporary link for downloading the file." },
      "detailUrl": { "type": "string", "readonly": true, "label": "Object link", "description": "Link to view the object in the Bitrix24 interface." },
      "contentProvider": { "type": "string", "readonly": true, "label": "Content provider", "description": "External content provider — not returned for files on the Bitrix24 Drive." },
      "globalContentVersion": { "type": "number", "readonly": true, "label": "Content version", "description": "File content version counter." },
      "deletedType": { "type": "number", "readonly": true, "label": "Deletion status", "description": "Whether the object is deleted and how — not deleted, in the trash, or deleted together with the folder." },
      "createdBy": { "type": "number", "readonly": true, "label": "Creator", "description": "Identifier of the user who created the object." },
      "updatedBy": { "type": "number", "readonly": true, "label": "Editor", "description": "Identifier of the user who last changed the object." },
      "createdAt": { "type": "datetime", "readonly": true, "label": "Creation date", "description": "Date and time the object was created." },
      "updatedAt": { "type": "datetime", "readonly": true, "label": "Change date", "description": "Date and time of the last change to the object." },
      "deletedAt": { "type": "datetime", "readonly": true, "label": "Deletion date", "description": "Date and time the object was deleted — null if the object is not deleted." },
      "realObjectId": { "type": "number", "readonly": true, "label": "Internal ID", "description": "Internal object identifier on the Drive." },
      "deletedBy": { "type": "number", "readonly": true, "label": "Deleted by", "description": "Identifier of the user who deleted the object — null if the object is not deleted." }
    }
  }
}
```

## 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 lacks the `disk` scope |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |
| 401 | `INVALID_API_KEY` | Invalid or expired API key |

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

## See also

- [List files](/docs/entities/files/list)
- [Get file](/docs/entities/files/get)
- [Update file](/docs/entities/files/update)
- [Files](/docs/entities/files)
- [Filtering syntax](/docs/filtering)
