← Glean-ia-acs Β· Day 48 of 56
Level 400 β€” Builder Β· APIs30 minNIST GOVERN

The Indexing API

Push datasources, documents, people, and permissions

You'll be able to

Read first

Day 6 Lab

  1. Register a custom datasource so Glean knows the content type and display name.
  2. Push a document into it with a stable id, title, and body.
  3. Attach permission metadata β€” the allowed users or groups β€” to the same document.
  4. 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

Pick an answer β€” you'll see if it's right and why.

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?

Pass threshold 80% Β· week 7 quiz

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.”

Next Β· Week 7 Day 7
The Web SDK