
## File metadata

`GET /v1/chats/files/:fileId`

Returns file metadata: name, size, type, download link, and a link to the file page. Use the `fileId` from the `POST /v1/chats/:chatId/files` response.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `fileId` (path) | number | yes | File ID. Get it: `POST /v1/chats/:chatId/files` → `data.fileId` |

## Examples

### curl — personal key

```bash
curl https://vibecode.bitrix24.com/v1/chats/files/9265 \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

const { success, data } = await res.json()
console.log('Download URL:', data.downloadUrl)
```

### JavaScript — OAuth application

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

const { success, data } = await res.json()
console.log('Download URL:', data.downloadUrl)
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.id` | string | File ID |
| `data.name` | string | File name |
| `data.size` | string | File size in bytes |
| `data.type` | string | Object type (`file`) |
| `data.downloadUrl` | string | File download link |
| `data.detailUrl` | string | Link to the file page in Bitrix24 |
| `data.createdBy` | string | ID of the user who uploaded the file |
| `data.createdAt` | string | Upload date (ISO 8601) |
| `data.updatedAt` | string | Last modification date (ISO 8601) |

## Response example

```json
{
  "success": true,
  "data": {
    "id": "9265",
    "name": "report.pdf",
    "size": "24576",
    "type": "file",
    "downloadUrl": "https://YOUR_PORTAL.bitrix24.com/rest/download/?token=...",
    "detailUrl": "https://YOUR_PORTAL.bitrix24.com/file/chat1001/report.pdf",
    "createdBy": "1",
    "createdAt": "2026-06-05T13:48:24+00:00",
    "updatedAt": "2026-06-05T13:48:24+00:00"
  }
}
```

## Error response example

404 — file not found:

```json
{
  "success": false,
  "error": {
    "code": "FILE_NOT_FOUND",
    "message": "File not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `FILE_NOT_FOUND` | A file with the specified `fileId` was not found |
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned a NOT_FOUND error — the file does not exist or is not accessible |
| 422 | `BITRIX_ERROR` | Bitrix24 error while retrieving metadata |
| 403 | `SCOPE_DENIED` | The key lacks the `im` scope |
| 401 | `TOKEN_MISSING` | The key has no configured Bitrix24 tokens |

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

## See also

- [Chat files](/docs/chats/files)
- [Upload a file to a chat](/docs/chats/files/upload)
- [Chat folder on Drive](/docs/chats/files/folder)
