This recipe shows how to upload files directly to the Gloo AI Data Engine using the Upload Files API. You’ll learn to upload single files, batch multiple files, associate custom IDs, and add metadata to your content. Upload once. Search instantly. Build faster. The Upload Files API lets you send any file directly to Gloo for real-time processing and indexing. Within minutes, your content becomes searchable, context-aware, and ready for AI-driven interactions.Documentation Index
Fetch the complete documentation index at: https://docs.gloo.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before starting, ensure you have:- A Gloo AI Studio account
- Your Client ID and Client Secret from the API Credentials page
- Your Publisher ID from your Gloo AI Studio account
- Authentication setup - Complete the Authentication Tutorial first
The Upload Files API requires Bearer token authentication. If you haven’t set up authentication yet, follow the Authentication Tutorial to learn how to exchange your credentials for access tokens and manage token expiration.
Understanding the Upload Files API
The Upload Files API allows you to upload documents that get processed and made available for search and AI interaction. The primary endpoint is: POST/ingestion/v2/files
Key Features
- Direct File Upload: Send files via multipart/form-data
- Multi-File Support: Upload multiple files in a single request
- Automatic Processing: Files are parsed, indexed, and made searchable
- Format Detection: Automatic detection and processing of various file types
- Duplicate Detection: Identifies and reports duplicate content
Required Fields
The Upload Files API requires two form fields:publisher_id: Your publisher ID from Gloo AI Studiofiles: The file(s) to upload (use the field namefiles, notfile)
Supported File Types
- PDF documents
- Microsoft Word (.doc, .docx)
- Plain text (.txt)
- Markdown (.md)
- And more
Step 1: Basic Single File Upload
Let’s start with uploading a single file. This demonstrates the core API call with proper authentication.Expected Response
Step 2: Multi-File Upload
You can upload multiple files in a single request for better efficiency.Expected Response
Step 3: Using Producer ID
Theproducer_id query parameter lets you associate your internal ID with an uploaded file. This is useful for tracking and updating content from your system.
Step 4: Adding Metadata to Uploaded Content
After uploading files, you can add or update metadata using the Update Item Metadata endpoint. Identify content by either Gloo’sitem_id (returned from the upload) or your producer_id.
Only the fields you include are updated; omitted fields remain unchanged.
Available Metadata Fields
| Field | Type | Description |
|---|---|---|
publisher_id | string | Required. Your publisher ID |
item_id | string | Gloo’s item ID (from upload response) |
producer_id | string | Your internal ID |
item_title | string | Document title |
item_subtitle | string | Document subtitle |
file_name | string | Original filename |
publication_date | string | Publication date (YYYY-MM-DD) |
item_image | string | Image URL |
item_url | string | Source URL |
item_summary | string | Brief summary |
author | string[] | List of authors |
item_tags | string[] | Categorization tags |
Step 5: Verifying Your Upload
After uploading content, you can verify it in Gloo AI Studio:- Log in to Gloo AI Studio
- Navigate to the Data Engine section from the main sidebar
- Click on Your Data
Complete Example
Here’s a complete example that combines authentication, file upload, and metadata update:Troubleshooting
Error: 401 Unauthorized
Cause: Token expired or invalid credentials. Solution: Refresh your access token and verify your Client ID and Secret.Error: 403 Forbidden
Cause: Insufficient permissions for the publisher. Solution: Verify you have access to the specified publisher in Gloo AI Studio.Error: 413 Request Entity Too Large
Cause: File size exceeds the limit. Solution: Check the API limits and consider splitting large files.Error: Duplicate detected
Cause: A file with identical content already exists. Solution: This is informational - the file won’t be processed again. Check theduplicates array in the response.
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 can upload files to the Data Engine, explore:- Search API - Query your uploaded content
- Chat Integration - Use uploaded content in conversations
- Content Controls - Manage and update your content
- Upload Files API - For additional API information
- Update Item Metadata API - For additional API information

