Auto-Tagging

Learn how Archivus automatically tags and categorizes your documents using AI.


Overview

Archivus automatically analyzes documents and suggests tags and categories. This helps organize documents without manual effort.


How It Works

When you upload a document with enable_ai=true (default), Archivus:

  1. Analyzes content - Reads and understands the document
  2. Suggests tags - Identifies relevant tags (e.g., “contract”, “legal”, “Q4-2025”)
  3. Categorizes - Assigns categories (e.g., “legal”, “business”, “financial”)
  4. Extracts entities - Finds people, organizations, dates, amounts

Enable Auto-Tagging

Auto-tagging is enabled by default:

curl -X POST https://api.archivus.app/api/v1/documents/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Subdomain: your-tenant" \
  -F "file=@document.pdf" \
  -F "enable_ai=true"

After processing, check AI-suggested tags:

curl https://api.archivus.app/api/v1/documents/doc_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Subdomain: your-tenant"

Response includes:

{
  "id": "doc_abc123",
  "filename": "contract.pdf",
  "ai_tags": ["contract", "legal", "service-agreement", "Q4-2025"],
  "ai_categories": ["legal", "business"],
  "entities": {
    "people": ["John Doe", "Jane Smith"],
    "organizations": ["Acme Corp"],
    "dates": ["2025-12-31"],
    "amounts": ["$50,000"]
  }
}

Apply AI Tags

Automatic Application

Tags are automatically applied when processing completes (configurable).

Manual Application

Review and apply tags manually:

curl -X POST https://api.archivus.app/api/v1/documents/doc_abc123/apply-ai-tags \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Subdomain: your-tenant"

Selective Application

Apply only specific tags:

curl -X PUT https://api.archivus.app/api/v1/documents/doc_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Subdomain: your-tenant" \
  -H "Content-Type: application/json" \
  -d '{
    "tags": ["contract", "legal", "Q4-2025"]
  }'

Code Examples

Python - Auto-Tagging

import requests

class ArchivusAutoTagging:
    def __init__(self, api_key, tenant):
        self.api_key = api_key
        self.tenant = tenant
        self.base_url = "https://api.archivus.app/api/v1"
        self.headers = {
            "Authorization": f"Bearer {api_key}",
            "X-Tenant-Subdomain": tenant
        }
    
    def get_ai_tags(self, document_id):
        url = f"{self.base_url}/documents/{document_id}"
        response = requests.get(url, headers=self.headers)
        doc = response.json()
        return {
            "tags": doc.get("ai_tags", []),
            "categories": doc.get("ai_categories", []),
            "entities": doc.get("entities", {})
        }
    
    def apply_ai_tags(self, document_id):
        url = f"{self.base_url}/documents/{document_id}/apply-ai-tags"
        response = requests.post(url, headers=self.headers)
        return response.json()
    
    def update_tags(self, document_id, tags):
        url = f"{self.base_url}/documents/{document_id}"
        data = {"tags": tags}
        response = requests.put(url, headers=self.headers, json=data)
        return response.json()

# Usage
tagging = ArchivusAutoTagging("YOUR_API_KEY", "your-tenant")

# Get AI-suggested tags
ai_data = tagging.get_ai_tags("doc_abc123")
print("AI Tags:", ai_data["tags"])
print("Categories:", ai_data["categories"])
print("Entities:", ai_data["entities"])

# Apply all AI tags
tagging.apply_ai_tags("doc_abc123")

# Apply selective tags
tagging.update_tags("doc_abc123", ["contract", "legal", "Q4-2025"])

JavaScript - Auto-Tagging

class ArchivusAutoTagging {
  constructor(apiKey, tenant) {
    this.apiKey = apiKey;
    this.tenant = tenant;
    this.baseURL = 'https://api.archivus.app/api/v1';
    this.headers = {
      'Authorization': `Bearer ${apiKey}`,
      'X-Tenant-Subdomain': tenant
    };
  }
  
  async getAITags(documentId) {
    const response = await fetch(`${this.baseURL}/documents/${documentId}`, {
      headers: this.headers
    });
    const doc = await response.json();
    return {
      tags: doc.ai_tags || [],
      categories: doc.ai_categories || [],
      entities: doc.entities || {}
    };
  }
  
  async applyAITags(documentId) {
    const response = await fetch(`${this.baseURL}/documents/${documentId}/apply-ai-tags`, {
      method: 'POST',
      headers: this.headers
    });
    return response.json();
  }
  
  async updateTags(documentId, tags) {
    const response = await fetch(`${this.baseURL}/documents/${documentId}`, {
      method: 'PUT',
      headers: { ...this.headers, 'Content-Type': 'application/json' },
      body: JSON.stringify({ tags })
    });
    return response.json();
  }
}

// Usage
const tagging = new ArchivusAutoTagging('YOUR_API_KEY', 'your-tenant');

// Get AI-suggested tags
const aiData = await tagging.getAITags('doc_abc123');
console.log('AI Tags:', aiData.tags);
console.log('Categories:', aiData.categories);
console.log('Entities:', aiData.entities);

// Apply all AI tags
await tagging.applyAITags('doc_abc123');

// Apply selective tags
await tagging.updateTags('doc_abc123', ['contract', 'legal', 'Q4-2025']);

Tag Types

Content-Based Tags

Tags derived from document content:

  • Document type: “contract”, “invoice”, “report”
  • Topic: “legal”, “financial”, “hr”
  • Time period: “Q4-2025”, “2025”, “January”

Entity Tags

Tags from extracted entities:

  • People: Names mentioned in document
  • Organizations: Companies, institutions
  • Dates: Important dates, deadlines
  • Amounts: Financial figures, prices

Category Tags

High-level categories:

  • “legal”, “business”, “financial”, “hr”, “compliance”

Best Practices

Review AI Tags

Always review AI-suggested tags before applying:

  • Check accuracy
  • Remove irrelevant tags
  • Add missing tags manually

Consistent Tagging

Establish tag standards:

  • Use consistent naming (e.g., “Q4-2025” not “Q4 2025”)
  • Create tag hierarchy if needed
  • Document tag meanings

Combine with Manual Tags

Use both AI and manual tags:

  • AI tags: Content-based, automatic
  • Manual tags: Business-specific, workflow-related

Filtering by Tags

Filter Documents by Tag

curl "https://api.archivus.app/api/v1/documents?tag_id=tag_contract" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Subdomain: your-tenant"

Search with Tag Filter

curl "https://api.archivus.app/api/v1/search?q=contract&tag_id=tag_legal" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Subdomain: your-tenant"

Cost

  • Auto-tagging: Included in document processing (1 AI credit)
  • Tag application: Free (no additional cost)
  • Tag updates: Free

Next Steps


Questions? Check the FAQ or contact support@ubiship.com