---
title: "Quản lý tệp | Tajo"
description: "Tải lên và quản lý tệp đính kèm trong Brevo CRM cho tài liệu thương vụ của Tajo"
url: https://tajo.io/vi/docs/sales-crm/files/
markdown: https://tajo.io/vi/docs/sales-crm/files.md
lang: vi-VN
author: "Set Noa"
author_url: https://tajo.io/vi/set-noa/
robots: noindex
---

Đăng ký quyền truy cập sớm

Nhập tên và địa chỉ email công việc của bạn. Chúng tôi sẽ gửi liên kết để xác nhận yêu cầu truy cập Tajo.

# Quản lý tệp

[Set Noa](https://tajo.io/vi/set-noa/)

Files API của Brevo CRM cho phép bạn tải lên và quản lý tệp đính kèm gắn với liên hệ, công ty và thương vụ trong nền tảng Tajo.

## Tổng quan

Quản lý tệp là yếu tố thiết yếu cho:

- **Tài liệu thương vụ** lưu trữ đề xuất, hợp đồng và thỏa thuận
- **Hồ sơ khách hàng** đính kèm hóa đơn, biên nhận và thư từ trao đổi
- **Tài liệu chương trình khách hàng thân thiết** chia sẻ chi tiết chương trình và bản tóm tắt quyền lợi
- **Tuân thủ** duy trì dấu vết kiểm toán tài liệu cho tài khoản doanh nghiệp
- **Cộng tác nhóm** chia sẻ tài nguyên giữa các thành viên đội ngũ bán hàng

## Bắt đầu nhanh

### Tải tệp lên

```http
POST https://api.brevo.com/v3/crm/files
Content-Type: multipart/form-data
api-key: YOUR_API_KEY

--boundary
Content-Disposition: form-data; name="file"; filename="enterprise-proposal.pdf"
Content-Type: application/pdf

[file content]
--boundary
Content-Disposition: form-data; name="dealIds"

deal_abc123def456
--boundary
Content-Disposition: form-data; name="companyIds"

comp_123456789
--boundary
Content-Disposition: form-data; name="contactIds"

12345
--boundary--
```

### Phản hồi

```json
{
  "id": "file_001",
  "name": "enterprise-proposal.pdf",
  "size": 245760,
  "contentType": "application/pdf",
  "dealIds": ["deal_abc123def456"],
  "companyIds": ["comp_123456789"],
  "contactIds": [12345],
  "created_at": "2026-01-25T14:30:00Z"
}
```

## Lấy danh sách tệp

### Liệt kê tất cả tệp

```http
GET https://api.brevo.com/v3/crm/files?limit=50&offset=0&sort=desc
Content-Type: application/json
api-key: YOUR_API_KEY
```

### Phản hồi

```json
{
  "items": [
    {
      "id": "file_001",
      "name": "enterprise-proposal.pdf",
      "size": 245760,
      "contentType": "application/pdf",
      "dealIds": ["deal_abc123def456"],
      "companyIds": ["comp_123456789"],
      "created_at": "2026-01-25T14:30:00Z"
    }
  ],
  "total": 1
}
```

### Lọc tệp

```http
GET https://api.brevo.com/v3/crm/files?filters[dealIds]=deal_abc123def456&sort=created_at:desc
```

### Lấy một tệp

```http
GET https://api.brevo.com/v3/crm/files/{file_id}
Content-Type: application/json
api-key: YOUR_API_KEY
```

### Tải tệp xuống

```http
GET https://api.brevo.com/v3/crm/files/{file_id}/data
api-key: YOUR_API_KEY
```

## Tự động hóa quản lý tệp

### Quy trình tài liệu thương vụ

Tự động quản lý tài liệu xuyên suốt vòng đời thương vụ:

```javascript
class DealDocumentManager {
  constructor() {
    this.filesApi = new FilesApi();
  }

  async attachProposal(dealId, proposalBuffer, companyName) {
    const fileName = `proposal-${companyName.toLowerCase().replace(/\s+/g, '-')}-${Date.now()}.pdf`;

    const file = await this.filesApi.uploadFile({
      file: proposalBuffer,
      fileName: fileName,
      dealIds: [dealId]
    });

    // Create a note referencing the uploaded proposal
    await this.notesApi.createNote({
      text: `Proposal uploaded: ${fileName}`,
      dealIds: [dealId]
    });

    return file;
  }

  async attachContract(dealId, contractBuffer, companyId) {
    const fileName = `contract-${dealId}-${new Date().toISOString().slice(0, 10)}.pdf`;

    const file = await this.filesApi.uploadFile({
      file: contractBuffer,
      fileName: fileName,
      dealIds: [dealId],
      companyIds: [companyId]
    });

    return file;
  }

  async getDealDocuments(dealId) {
    const files = await this.filesApi.getFiles({
      filters: { dealIds: dealId },
      sort: 'created_at:desc'
    });

    return {
      proposals: files.items.filter(f => f.name.startsWith('proposal-')),
      contracts: files.items.filter(f => f.name.startsWith('contract-')),
      other: files.items.filter(f =>
        !f.name.startsWith('proposal-') && !f.name.startsWith('contract-')
      ),
      totalSize: files.items.reduce((sum, f) => sum + f.size, 0)
    };
  }
}
```

### Tài liệu chương trình khách hàng thân thiết

```javascript
class LoyaltyDocumentManager {
  async generateAndAttachBenefitsSummary(companyId, tier) {
    const company = await this.companiesApi.getCompany(companyId);

    const summary = await this.generateBenefitsPDF({
      companyName: company.name,
      tier: tier,
      benefits: this.getTierBenefits(tier),
      annualSpend: company.attributes.annual_spend,
      pointsBalance: company.attributes.loyalty_points
    });

    return await this.filesApi.uploadFile({
      file: summary,
      fileName: `loyalty-benefits-${tier.toLowerCase().replace(/\s+/g, '-')}.pdf`,
      companyIds: [companyId]
    });
  }

  async attachTierUpgradeDocuments(companyId, oldTier, newTier) {
    const documents = [
      { name: 'tier-upgrade-confirmation', content: this.generateUpgradeConfirmation(oldTier, newTier) },
      { name: 'new-benefits-guide', content: this.generateBenefitsGuide(newTier) }
    ];

    const uploaded = [];
    for (const doc of documents) {
      const file = await this.filesApi.uploadFile({
        file: doc.content,
        fileName: `${doc.name}-${Date.now()}.pdf`,
        companyIds: [companyId]
      });
      uploaded.push(file);
    }

    return uploaded;
  }
}
```

## Các loại tệp được hỗ trợ

| Danh mục | Phần mở rộng | Dung lượng tối đa |
| --- | --- | --- |
| Tài liệu | `.pdf`, `.doc`, `.docx`, `.txt` | 10 MB |
| Bảng tính | `.xls`, `.xlsx`, `.csv` | 10 MB |
| Hình ảnh | `.png`, `.jpg`, `.jpeg`, `.gif` | 5 MB |
| Bản trình bày | `.ppt`, `.pptx` | 10 MB |

## Tham chiếu phương thức API

```javascript
// Upload a file
const file = await filesApi.uploadFile({
  file: fileBuffer,
  fileName: 'proposal.pdf',
  dealIds: ['deal_abc123'],
  companyIds: ['comp_123']
});

// Get file metadata
const file = await filesApi.getFile('file_001');

// Download file data
const fileData = await filesApi.downloadFile('file_001');

// Delete file
await filesApi.deleteFile('file_001');

// List files with filtering
const files = await filesApi.getFiles({
  filters: { dealIds: 'deal_abc123' },
  sort: 'created_at:desc',
  limit: 50
});
```

## Thực hành tốt nhất

1. **Quy ước đặt tên**: Dùng tên tệp mô tả rõ kèm ngày tháng để dễ nhận biết
2. **Liên kết bản ghi**: Gắn tệp với mọi thương vụ, công ty và liên hệ liên quan
3. **Quản lý phiên bản**: Đưa số phiên bản hoặc ngày tháng vào tên tệp
4. **Quản lý dung lượng**: Nén tệp lớn trước khi tải lên
5. **Kiểm soát truy cập**: Rà soát liên kết tệp thường xuyên để bảo đảm quyền truy cập đúng
6. **Dọn dẹp**: Xóa tài liệu lỗi thời để giữ hồ sơ CRM gọn gàng

## Xử lý lỗi

```javascript
try {
  const file = await filesApi.uploadFile(fileData);
  console.log('File uploaded:', file.id);
} catch (error) {
  if (error.status === 400) {
    console.error('Invalid file data:', error.message);
  } else if (error.status === 413) {
    console.error('File size exceeds maximum limit');
  } else if (error.status === 415) {
    console.error('Unsupported file type');
  } else {
    console.error('Unexpected error:', error);
  }
}
```

## Bước tiếp theo

- **[Quản lý công ty](https://tajo.io/vi/docs/sales-crm/companies)** - Quản lý tài khoản doanh nghiệp
- **[Quản lý thương vụ](https://tajo.io/vi/docs/sales-crm/deals)** - Theo dõi quy trình bán hàng
- **[Quản lý công việc](https://tajo.io/vi/docs/sales-crm/tasks)** - Quản lý hoạt động bán hàng
- **[Ghi chú](https://tajo.io/vi/docs/sales-crm/notes)** - Ghi lại các tương tác với khách hàng
