Indexing API Quickstart
Create a datasource and index one document. This is the shortest end-to-end path to making custom content available to Glean; use the Indexing API overview to explore other content types and workflows.
Before you begin
- Find your Glean backend URL, such as
https://your-instance-be.glean.com. - Create an Indexing API token by following the Indexing API authentication guide.
- Choose a stable datasource name and a URL pattern that matches the documents you plan to index.
1. Create a datasource
Replace the backend URL, token, and example datasource values, then run:
curl -X POST https://customer-be.glean.com/api/index/v1/adddatasource \
-H 'Authorization: Bearer <your_indexing_token>' \
-d '{
"name": "internal-docs",
"displayName": "Internal Documentation",
"datasourceCategory": "PUBLISHED_CONTENT",
"urlRegex": "^https://internal.company.com/docs.*",
"isUserReferencedByEmail": true
}'
For field selection, admin-console setup, and an API-client example, see Set Up a Datasource.
2. Index a document
Use the same datasource name in your first document request:
curl -X POST https://customer-be.glean.com/api/index/v1/indexdocument \
-H 'Authorization: Bearer <your_indexing_token>' \
-d '{
"document": {
"datasource": "internal-docs",
"objectType": "Document",
"id": "getting-started-guide",
"title": "Getting Started Guide",
"body": {
"mimeType": "text/plain",
"textContent": "This guide helps new employees get up to speed quickly..."
},
"permissions": {
"allowAnonymousAccess": false,
"allowedUsers": [{ "email": "employee@company.com" }]
},
"viewURL": "https://internal.company.com/docs/getting-started"
}
}'
For document fields, permissions, bulk indexing, and API-client examples, see Index Documents.
3. Enable and verify the datasource
In the Glean Admin Console, open the custom datasource and enable its content for a test group or all teammates. Indexing is asynchronous, so the document can take a few minutes to appear in search. Verify it as a user allowed by the document permissions.