Pipeline at a Glance
Publisher setup (Studio)
Create the publisher that owns your content — Part 1.
Ingest content with metadata
Upload files and enrich them — Part 1.
Verify indexing
Poll item status until your content is searchable — Part 1.
Semantic search
Query your content — deep dive: Building Custom Search.
Grounded completions with sources
Answer questions from your content with citations — deep dive: Grounded Completions with RAG.
Verification, errors & resilience
Error handling and retry patterns — Part 3.
Prerequisites
Before starting, ensure you have:- A Gloo AI Studio account
- Your Client ID and Client Secret from the API Credentials page
- A publisher with credentials — see Part 1 to create one
- Familiarity with uploading and indexing content from Part 1
This recipe seeds its own sample content, so it runs standalone — you don’t need to have completed Part 1 first. It reuses Part 1’s upload and indexing patterns for that seeding step.
How Scoping Keeps This Safe
A publisher can hold content from many sources. Bulk edits and deletes are powerful, so this recipe never operates publisher-wide. Instead it follows one rule:Keep the item ID the API returns when you upload each item, and scope every bulk edit and delete to that exact list of item IDs.The upload response gives you each item’s ID directly (Part 1, Step 2). Those IDs are authoritative handles for content you own, so building your bulk operations from them guarantees you only ever touch your own items.
There’s also a lookup endpoint, POST
/engine/v2/publisher/{publisher_id}/items/by-producer, that resolves your producer IDs back to item IDs — handy when a separate process only has the producer IDs it assigned. Be aware it’s cached (~5 minutes) and isn’t invalidated when items change, so right after an upload or delete it can return stale or already-deleted item IDs. Treat the upload response (or a GET on the item) as the source of truth; don’t rely on by-producer immediately after a write.Step 1: Set Up Sample Content
This recipe manages three short articles, each uploaded under a stable producer ID. The upload response returns each item’s ID — capture it; that’s the handle every later step uses.| Producer ID | Initial title |
|---|---|
rag-pipeline-part2-volunteer-onboarding | Onboarding New Volunteers |
rag-pipeline-part2-measuring-impact | Measuring Community Impact |
rag-pipeline-part2-sustaining-engagement | Sustaining Long-Term Engagement |
sample_files/. Upload each one, set its initial metadata, and keep the returned item_id in a map keyed by producer ID:
What You’ll See
Ingestion is asynchronous — wait until every item reaches
COMPLETED (the polling loop from Part 1, Step 4) before editing it. The complete cookbook program includes this wait.token, PUBLISHER_ID, mapping, and item_ids from here.
Step 2: Update a Single Item
Correct one item’s metadata with PATCH/engine/v2/item. Identify the target by item_id (or by producer_id — either works for a single item). Only the fields you send change; everything else is left as-is.
Step 3: Bulk-Edit Multiple Items
Apply changes to several items at once with PATCH/engine/v2/items?publisher_id=.... The request has two parts: a filter selecting which items to touch, and a list of ops describing the changes. Here the filter is the exact item_ids you captured in Step 1 — that’s what keeps the operation scoped to your content.
Each op has an op (append, replace, or remove), a field, and a value. Below, every item gets a reviewed-q2-2026 tag appended and its author replaced.
What You’ll See
Step 4: Verify Your Changes
Re-fetch each item with GET/engine/v2/items/{item_id} to confirm the edits.
Edits succeed immediately, but the read path is eventually consistent: a freshly patched item can take a few seconds to reflect the change on a subsequent GET. Verify by re-fetching until the change appears, rather than reading once.
What You’ll See
Step 5: Delete Items
Remove items with DELETE/engine/v2/items, passing the item_ids to delete. This both demonstrates deletion and cleans up the content this recipe created.
What You’ll See
Run the Complete Example
The cookbook runs the whole lifecycle — seed, update, bulk-edit, verify, and delete — as one program in all six languages. From the cookbook repository, install dependencies, copy.env.example to .env and add your credentials, then run it:
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 and the sample content files.
Troubleshooting
Error: 400 Invalid request — Item ID or Producer ID with Publisher ID required
A single-itemPATCH /engine/v2/item needs publisher_id plus either item_id or producer_id. Include one of the identifiers.
Bulk patch reports fewer matched than expected
Thefilter didn’t match all your items. Confirm your item_ids are the ones returned by the uploads and that the items still exist (a prior run may have deleted them).
Verification shows stale metadata
Reads are eventually consistent. Re-fetch until the change appears (as shown in Step 4) rather than reading once immediately after an edit.Editing right after upload returns 404 item_not_found
If you looked the item up withby-producer, its result may be stale (it’s cached ~5 minutes and not invalidated on writes). Use the item_id from the upload response instead — that’s authoritative.
Next Steps
You can now manage content through its full lifecycle, safely scoped to the items you own. To round out the pipeline:- Part 3: Verification, Error Handling & Resilience — interpret API error responses and add retry patterns for production
- Building Custom Search — surface your updated content to users
- Grounded Completions with RAG — answer questions from your content with citations

