📄 Summarizer API

Transform any content into intelligent summaries with AI-powered document analysis and URL processing

📄 File Upload 🌐 URL Processing 🤖 AI-Powered ⚡ Real-time

Quick Start

Start summarizing content from files, URLs, or direct text input with intelligent AI processing

# Summarize text content ✨
curl -X POST "http://localhost:3001/api/summarizer/text" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "content": "Your long document content here...",
    "summaryLength": "medium",
    "includeKeyPoints": true,
    "tone": "professional"
  }'

# Summarize from URL 🌐
curl -X POST "http://localhost:3001/api/summarizer/url" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "url": "https://example.com/article",
    "summaryLength": "short",
    "focusAreas": ["main points", "conclusions"]
  }'
🎯

Smart Content Analysis

Automatically extracts key points, adjusts tone, and provides compression analytics

🔗

API Endpoints

POST /api/summarizer/text
Text Input

Summarize direct text content with customizable length and focus areas

Perfect for documents, articles, and content analysis
POST /api/summarizer/url
Web Content

Fetch and summarize content from any web URL with smart HTML parsing

Ideal for news articles, blog posts, and web research
POST /api/summarizer/file
File Upload

Upload and summarize documents (TXT, MD, PDF, Word) with multipart form support

Supports multiple file formats with automatic processing
GET /api/summarizer/stats
Analytics

Get usage statistics, compression ratios, and summarization insights

Track performance and usage patterns
📋

Request Parameters

Common Parameters

Parameter Type Default Description
summaryLength enum 'medium' 'short' (2-3 sentences), 'medium' (1-2 paragraphs), 'long' (3-4 paragraphs)
focusAreas string[] [] Specific topics to focus on (e.g., ["conclusions", "methodology"])
includeKeyPoints boolean true Extract 3-5 key points as bullet points
tone enum 'professional' 'professional', 'casual', 'academic'

Endpoint-Specific Parameters

Text Endpoint

  • content - Text content to summarize (required, max 50,000 chars)

URL Endpoint

  • url - Valid web URL to fetch and summarize (required)

File Endpoint

  • file - File upload (multipart/form-data, max 10MB)
  • Supported: TXT, MD, HTML, PDF, Word documents
💻

Code Examples

JavaScript / Node.js

// Text summarization
async function summarizeText(content) {
  const response = await fetch('/api/summarizer/text', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${YOUR_JWT_TOKEN}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      content: content,
      summaryLength: 'medium',
      focusAreas: ['key findings', 'conclusions'],
      includeKeyPoints: true,
      tone: 'professional'
    })
  });
  
  const result = await response.json();
  console.log('Summary:', result.summary);
  console.log('Key Points:', result.metadata.keyPoints);
}

// URL summarization
async function summarizeUrl(url) {
  const response = await fetch('/api/summarizer/url', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${YOUR_JWT_TOKEN}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      url: url,
      summaryLength: 'short',
      tone: 'casual'
    })
  });
  
  const result = await response.json();
  return result;
}

// File upload summarization
async function summarizeFile(fileInput) {
  const formData = new FormData();
  formData.append('file', fileInput.files[0]);
  formData.append('summaryLength', 'long');
  formData.append('includeKeyPoints', 'true');
  
  const response = await fetch('/api/summarizer/file', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${YOUR_JWT_TOKEN}`
    },
    body: formData
  });
  
  return await response.json();
}

Python (requests)

import requests
import json

def summarize_text(content, token, summary_length='medium'):
    """Summarize text content using VecTrail Summarizer API"""
    url = "http://localhost:3001/api/summarizer/text"
    
    headers = {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json"
    }
    
    payload = {
        "content": content,
        "summaryLength": summary_length,
        "focusAreas": ["main points", "conclusions"],
        "includeKeyPoints": True,
        "tone": "academic"
    }
    
    response = requests.post(url, json=payload, headers=headers)
    
    if response.status_code == 200:
        result = response.json()
        print(f"Summary: {result['summary']}")
        print(f"Compression Ratio: {result['metadata']['compressionRatio']}")
        return result
    else:
        print(f"Error: {response.status_code} - {response.text}")
        return None

def summarize_file(file_path, token):
    """Summarize uploaded file"""
    url = "http://localhost:3001/api/summarizer/file"
    
    headers = {
        "Authorization": f"Bearer {token}"
    }
    
    with open(file_path, 'rb') as f:
        files = {'file': f}
        data = {
            'summaryLength': 'medium',
            'includeKeyPoints': 'true',
            'tone': 'professional'
        }
        
        response = requests.post(url, files=files, data=data, headers=headers)
        
        if response.status_code == 200:
            return response.json()
        else:
            print(f"Error: {response.status_code} - {response.text}")
            return None

# Example usage
content = "Your long document content here..."
result = summarize_text(content, "your-jwt-token", "short")
print(f"Processing time: {result['metadata']['processingTime']}ms")
📊

Response Format

{
  "success": true,
  "summary": "This article discusses the implementation of artificial intelligence in modern healthcare systems. The integration of AI technologies has shown significant improvements in diagnostic accuracy, treatment personalization, and operational efficiency across medical institutions.",
  "metadata": {
    "originalLength": 15420,
    "summaryLength": 234,
    "compressionRatio": 0.15,
    "processingTime": 1250,
    "keyPoints": [
      "AI improves diagnostic accuracy by 23% compared to traditional methods",
      "Machine learning algorithms personalize treatment plans for individual patients", 
      "Operational costs reduced by 18% through automated administrative processes",
      "Integration challenges include data privacy and staff training requirements",
      "Future developments focus on real-time patient monitoring systems"
    ],
    "sourceType": "url",
    "sourceInfo": "https://example.com/ai-healthcare-article"
  }
}

📝 Summary

AI-generated concise summary of the content based on specified parameters

📊 Metadata

Processing statistics including compression ratio and performance metrics

🔑 Key Points

Extracted bullet points highlighting main themes and conclusions

🎮

Interactive Demo

Try Text Summarization

Response

Response will appear here...

💡 Tip: Try different summary lengths and content types to see how the AI adapts its summarization approach.

🎯

Use Cases

📰

News & Articles

Quickly summarize news articles, blog posts, and research papers for content curation and analysis.

📋

Document Processing

Extract key insights from reports, contracts, and technical documentation for faster decision-making.

🔬

Research Analysis

Summarize academic papers and research findings to accelerate literature reviews and knowledge synthesis.

💼

Business Intelligence

Transform lengthy business reports and market analysis into actionable executive summaries.

📚

Educational Content

Create study guides and course summaries from textbooks and educational materials.

🤖

AI Applications

Power chatbots, content management systems, and knowledge bases with intelligent summarization.

🔐

Authentication

All Summarizer API endpoints require JWT authentication:

Authorization: Bearer YOUR_JWT_TOKEN

🔒 Security Note: Always use HTTPS in production and keep your JWT tokens secure. The API processes content through OpenAI's services with appropriate privacy measures.

🚀 Ready to transform your content with intelligent summarization?
Made with ❤️ for developers who value efficient content processing