Skip to main content
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. Want the concepts first? Read the Concepts guide. 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.

What you’ll build

A small upload workflow that walks through the API one step at a time:
  1. Upload a single file
  2. Upload several files in one request
  3. Attach your own producer_id to an upload
  4. Add metadata to uploaded content
  5. Verify your upload in Gloo AI Studio

Prerequisites

Before starting, ensure you have:

The Upload Files API at a glance

Uploaded documents are processed and made available for search and AI interaction. The primary endpoint is POST /ingestion/v2/files. It takes two required form fields: What the API handles for you: Supported file types: PDF documents, Microsoft Word (.doc, .docx), plain text (.txt), Markdown (.md), and more.

Step 1: Basic Single File Upload

Start with a single file. This shows the core authenticated API call.
Optional: set the chunk size. Gloo splits each document into chunks for search. To change the defaults for this upload, add form fields such as -F "chunk_size=600" -F "chunk_overlap=100". For the allowed values, see Set Chunk Size and Overlap.

Step 2: Multi-File Upload

Upload multiple files in a single request for better efficiency.
You can mix file types freely - the endpoint automatically detects and processes each format.

Step 3: Using Producer ID

The producer_id query parameter lets you associate your internal ID with an uploaded file. This is useful for tracking content from your system and editing its metadata without storing Gloo’s item_id. It doesn’t replace content: uploading changed content under an existing producer_id creates a second item. To change an item’s content, replace it with the update parameter.
A multi-file upload that includes producer_id is rejected with a 400 too_many_files error. Producer IDs must have a one-to-one relationship with a file.

Step 4: Add metadata

After uploading files, you can add or update metadata using the Update Item Metadata endpoint. Identify content by either Gloo’s item_id (returned from the upload) or your producer_id.
Only the fields you include are updated; omitted fields remain unchanged.

Available Metadata Fields

If you provide both item_id and producer_id, the service will prefer item_id when loading the target item. The producer_id itself can’t be changed with this endpoint.

Step 5: Verify your upload

To verify your upload in Gloo AI Studio:
1

Open Studio

Log in to Gloo AI Studio
2

Go to Data Engine

Navigate to the Data Engine section from the main sidebar
3

Open Your Data

Click on Your Data
You’ll see your uploaded files with their processing status and metadata.

Complete code

View Complete Code

Clone or browse the complete working examples for all 6 languages (JavaScript, TypeScript, Python, PHP, Go, Java) with setup instructions.
Here’s a complete example that combines authentication, file upload, and metadata update:

Troubleshooting

Cause: API key is incorrect or has been revoked.Solution: Verify your API key is correct and has not been revoked.
Cause: Insufficient permissions for the publisher.Solution: Verify you have access to the specified publisher in Gloo AI Studio.
Cause: File size exceeds the limit.Solution: Check the API limits and consider splitting large files.
Cause: A file with identical content already exists.Solution: This is informational - the file won’t be processed again. Check the duplicates array in the response.

Next steps

Now that you can upload files to the Data Engine, explore:

Search API

Query your uploaded content.

Answer from your content with Grounded Responses

Use uploaded content in AI answers.

Manage Content

Manage and update your content.

Upload Files API

For additional API information.