Skip to main content
This API is deprecated. Follow the Upload Files to Data Engine tutorial instead.
This recipe shows how to build an automated content ingestion pipeline using the Realtime API. You’ll learn to set up real-time content monitoring, process various content types, and create production-ready ingestion workflows that automatically make content available for search and AI interaction. We’ll build a complete content pipeline that watches for new files, extracts metadata, and uploads content to the Gloo AI platform with proper error handling and monitoring.

Prerequisites

Before starting, ensure you have:
The Realtime Ingestion API requires an API key for authentication. If you haven’t set up authentication yet, follow the Authentication Tutorial.

V1 Realtime Upload [Deprecated]

Key Features

  • Real-time Processing: Content is processed upon upload
  • Rich Metadata: Support for comprehensive content categorization
  • Flexible Content Types: Articles, documents, media, and structured content
  • Automatic Indexing: Content becomes searchable instantly

Step 1: Understanding the Realtime API

The Realtime Ingestion API allows you to upload content that gets processed and made available for search and AI interaction. The primary endpoint is: POST /ingestion/v1/real_time_upload

Key Features

  • Real-time Processing: Content is processed upon upload
  • Rich Metadata: Support for comprehensive content categorization
  • Flexible Content Types: Articles, documents, media, and structured content
  • Automatic Indexing: Content becomes searchable instantly upon file process completion.

Required Fields

Optional Metadata Fields

  • Content Details: author, publication_date, item_title, item_subtitle, item_summary
  • Categorization: type, pub_type, denomination, item_tags
  • Media: item_image, item_url, hosted_url
  • Access Control: drm, evergreen
  • Hierarchical Structure: h2_title, h3_title for document sections

Step 2: Basic Content Upload

Let’s start with a simple content upload example. This demonstrates the core API call with proper authentication and error handling.

API Request Structure

The kallm DRM value shown in the examples below is deprecated and no longer supported. Use aspen only.

Expected Response


Step 3: Verifying Content Upload

After uploading content, you can check on progress through Gloo AI Studio.
  1. Log in to Gloo AI Studio.
  2. Navigate to the Data Engine section from the main Studio sidebar.
  3. Click on Your Data.
Your Data in Studio

Step 4: Setting Up File Monitoring

For automated content ingestion, you’ll want to monitor directories for new files and automatically process them. This creates a real-time content pipeline.

File Watching Strategy

  1. Monitor Target Directory: Watch for new files or changes
  2. Extract Metadata: Parse filename and content for metadata
  3. Validate Content: Ensure required fields are present
  4. Upload with Retry: Handle failures gracefully
  5. Log Results: Track successful and failed uploads

Step 5: Batch Processing Pipeline

For processing multiple files or handling large volumes of content, batch processing provides better performance and resource management.

Batch Processing Benefits

  • Rate Limiting: Control API call frequency
  • Progress Tracking: Monitor processing status
  • Error Recovery: Retry failed uploads
  • Resource Management: Efficient memory and network usage

Step 6: Production Considerations

Error Handling

  • Authentication Failures: API key validation and retry
  • Rate Limiting: Exponential backoff
  • Network Issues: Connection retry logic
  • Validation Errors: Content preprocessing

Monitoring and Logging

  • Success Metrics: Upload counts and timing
  • Error Tracking: Failed uploads with reasons
  • Performance Monitoring: API response times
  • Health Checks: System status monitoring

Complete Examples

The following examples combine authentication, file processing, and error handling into complete, production-ready solutions for each language. First, set up your environment variables in a .env file:
Or export them in your shell for Go and Java:

Testing Your Implementation

To test any of the complete examples:

1. Environment Setup

Create a .env file with your Gloo AI credentials:

2. Install Dependencies

Each language has specific setup requirements - check the README files in the sandbox examples.

3. Test Single File Upload

4. Test Directory Monitoring

5. Test Batch Processing

The system will:
  • Authenticate using your API key
  • Extract metadata from filenames and content
  • Upload content with proper error handling
  • Display success/failure status for each operation
  • Provide structured JSON responses from the API

Production Deployment Considerations

Error Handling

  • Authentication: API key validation with proper error reporting
  • Rate Limiting: Built-in delays between API calls
  • Network Issues: Retry logic with configurable timeouts
  • File Processing: Validation and error recovery

Monitoring

  • Logging: Structured logs for all operations
  • Metrics: Success rates, processing times, error counts
  • Alerting: Failed upload notifications
  • Health Checks: System status monitoring

Scaling

  • Concurrent Processing: Parallel file processing capabilities
  • Queue Management: Async processing for high-volume scenarios
  • Resource Management: Memory and CPU optimization
  • Load Balancing: Multiple instance coordination

Working Code Sample

View Complete Code

Clone or browse the complete working examples for all 6 languages (JavaScript, TypeScript, Python, PHP, Go, Java) with setup instructions.

Next Steps

Now that you have a working content ingestion pipeline, consider exploring:
  1. Search API - Query your ingested content
  2. Chat Integration - Use ingested content in conversations
  3. Content Management - Organize and categorize content
  4. Advanced Metadata - Rich content classification and tagging
  5. Custom Pipelines - The source-agnostic pattern for integrating with a CMS, API, database, file library, or RSS feed
This tutorial provides the foundation for building sophisticated content ingestion workflows that can scale from simple file uploads to enterprise-grade automated pipelines.