---
title: "Upravljanje datotekama | Tajo"
description: "Prenesite privitke i upravljajte njima u Brevo CRM-u za dokumentaciju poslova u Taju"
url: https://tajo.io/hr/docs/sales-crm/files/
markdown: https://tajo.io/hr/docs/sales-crm/files.md
lang: hr-HR
author: "Set Noa"
author_url: https://tajo.io/hr/set-noa/
robots: noindex
---

Zatražite rani pristup

Unesite ime i poslovnu adresu e-pošte. Poslat ćemo vam poveznicu za potvrdu zahtjeva za pristup Taju.

# Upravljanje datotekama

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

Brevo CRM Files API omogućuje vam prijenos privitaka povezanih s kontaktima, tvrtkama i poslovima unutar platforme Tajo te upravljanje njima.

## Pregled

Upravljanje datotekama ključno je za:

- **Dokumentaciju poslova**, pohranu ponuda, ugovora i sporazuma
- **Evidenciju kupaca**, prilaganje računa, potvrda i prepiske
- **Materijale programa vjernosti**, dijeljenje pojedinosti programa i sažetaka pogodnosti
- **Usklađenost**, vođenje revizijskog traga dokumenata za korporativne račune
- **Timsku suradnju**, dijeljenje resursa među članovima prodajnog tima

## Brzi početak

### Prijenos datoteke

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

### Odgovor

```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"
}
```

## Dohvaćanje datoteka

### Popis svih datoteka

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

### Odgovor

```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
}
```

### Filtriranje datoteka

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

### Dohvaćanje pojedinačne datoteke

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

### Preuzimanje datoteke

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

## Automatizacija upravljanja datotekama

### Tijek rada s dokumentima posla

Automatski upravljajte dokumentima tijekom cijelog životnog ciklusa posla:

```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)
    };
  }
}
```

### Dokumenti programa vjernosti

```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;
  }
}
```

## Podržane vrste datoteka

| Kategorija | Nastavci | Najveća veličina |
| --- | --- | --- |
| Dokumenti | `.pdf`, `.doc`, `.docx`, `.txt` | 10 MB |
| Proračunske tablice | `.xls`, `.xlsx`, `.csv` | 10 MB |
| Slike | `.png`, `.jpg`, `.jpeg`, `.gif` | 5 MB |
| Prezentacije | `.ppt`, `.pptx` | 10 MB |

## Referenca API metoda

```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
});
```

## Najbolje prakse

1. **Konvencije imenovanja**: upotrebljavajte opisne nazive datoteka s datumima radi lakšeg prepoznavanja
2. **Povežite zapise**: pridružite datoteke svim povezanim poslovima, tvrtkama i kontaktima
3. **Upravljanje verzijama**: u nazive datoteka uključite brojeve verzija ili datume
4. **Upravljanje veličinom**: velike datoteke sažmite prije prijenosa
5. **Kontrola pristupa**: redovito pregledavajte pridruživanja datoteka kako biste osigurali ispravan pristup
6. **Čišćenje**: uklonite zastarjele dokumente kako bi CRM zapisi ostali pregledni

## Obrada pogrešaka

```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);
  }
}
```

## Sljedeći koraci

- **[Upravljanje tvrtkama](https://tajo.io/hr/docs/sales-crm/companies)**, upravljajte korporativnim računima
- **[Upravljanje poslovima](https://tajo.io/hr/docs/sales-crm/deals)**, pratite prodajni lijevak
- **[Upravljanje zadacima](https://tajo.io/hr/docs/sales-crm/tasks)**, upravljajte prodajnim aktivnostima
- **[Bilješke](https://tajo.io/hr/docs/sales-crm/notes)**, dokumentirajte interakcije s kupcima
