The Indexing API
Push datasources, documents, people, and permissions
You'll be able to
- Register a datasource and push a document through the Indexing API
- Attach permission metadata so access is enforced after indexing
Read first
Day 6 Lab
- Register a custom datasource so Glean knows the content type and display name.
- Push a document into it with a stable
id,title, andbody. - Attach permission metadata β the allowed users or groups β to the same document.
- Verify: without ACLs, indexed content is unprotected. Permissions must be pushed, not assumed.
Working Example: Push a Document With Permissions
The Indexing API writes a document and its access control together. Glean enforces only the permissions you push β omit them and the content is not properly governed. Verified against developer_platform.
import os
from glean import Glean
index_client = Glean(
instance=os.environ["GLEAN_INSTANCE"],
api_token=os.environ["GLEAN_INDEXING_TOKEN"], # admin-scoped
)
index_client.indexing.documents.index(
datasource="acme-handbook",
document={
"id": "handbook-pto-2026",
"title": "PTO Carryover Policy 2026",
"view_url": "https://handbook.acme.com/pto",
"body": {"mime_type": "text/plain", "text_content": "Up to 5 days carry over..."},
# Permissions ship WITH the document β this is what Glean enforces.
"permissions": {
"allowed_groups": ["all-employees"],
"allowed_users": [{"email": "hr-admin@acme.com"}],
},
},
)
No permissions block means no enforced access boundary. Always push ACLs so Glean filters results by who is allowed to see them. Verified against developer_platform.
Check for understanding
You push documents but omit permission metadata. Who can now see them, and why is that a governance failure?
Check yourself
1. Which set of languages does Glean ship typed Developer Platform clients for?
2. Why does a user-scoped token return different results for two different users running the same query?
3. In a Chat API response, what do the citations tell you?
4. You need to make 10,000 support tickets searchable in Glean. Which API do you use?
5. When pushing documents through the Indexing API, why must you include permission metadata?
In 10 seconds
βThe Indexing API writes your content into Glean β datasources, documents, people. The non-negotiable part is permissions: push the ACLs with the document, or Glean can't enforce who's allowed to see it.β
The Web SDK