โ† Glean-ia-acs ยท Day 47 of 56
Level 400 โ€” Builder ยท APIs30 minNIST MAP

Client API vs. Indexing API

The split, and what each half is for

You'll be able to

Read first

Day 5 Lab

  1. List read tasks: search, chat, autocomplete, recommendations โ€” these are Client API.
  2. List write tasks: register a datasource, push documents, push people and permissions โ€” these are Indexing API.
  3. Note the auth difference: Client calls are typically user-scoped; Indexing calls are admin/global-scoped.
  4. For each task on your roadmap, label it CLIENT or INDEXING before you write any code.

Working Example: Two Clients, Two Jobs

The Client API reads what is already indexed, scoped to a user. The Indexing API writes new content and its permissions, scoped to an admin token. Verified against developer_platform.

import os
from glean import Glean

# CLIENT API: read the graph as a specific user (honors their permissions).
read_client = Glean(
    instance=os.environ["GLEAN_INSTANCE"],
    api_token=os.environ["GLEAN_API_TOKEN"],
    actas_user=os.environ["END_USER_EMAIL"],
)
hits = read_client.client.search.query(query="release notes", page_size=5)

# INDEXING API: write into the graph with an admin-scoped token.
index_client = Glean(
    instance=os.environ["GLEAN_INSTANCE"],
    api_token=os.environ["GLEAN_INDEXING_TOKEN"],
)
# index_client.indexing.documents.index(...)  # covered on Day 6

If the task is "make something searchable," it is Indexing. If the task is "find or answer over what exists," it is Client. Verified against developer_platform.

Check for understanding

You need to push 10k support tickets into Glean so they're searchable. Which API, and why not the other?

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

โ€œTwo APIs, one boundary. The Client API reads the graph โ€” search, chat, recommendations. The Indexing API writes to it โ€” datasources, documents, people. Reading is user-scoped; writing is admin-scoped.โ€

Next ยท Week 7 Day 6
The Indexing API