Knowledge bases must be created in the Profound app. The API cannot create a knowledge base. Replace
your_api_key, your_knowledge_base_id, and your_organization_id with your actual values.Syncing documents walkthrough
Use this flow to mirror documents and folders from an external system:- Use List Knowledge Bases to find the knowledge base ID.
- Use Add Folder to mirror source folders when needed.
- Use Add Document to upload each source document.
- Use Update Document for idempotent re-syncs.
- Use Delete Document or Delete Folder when content is removed from the source system.
1. List Knowledge Bases
First, get the ID of the knowledge base you want to sync. Theid returned here is required as the knowledge_base_id path parameter for every other Knowledge Base request.
organization_id on the request:
2. Add a Folder
Folders are empty when created. A document’s folder must already exist, so create the source hierarchy before uploading documents, and use folder paths such asEngineering/API to mirror the hierarchy in Guru. Create parent folders before their nested folders. Creating a folder that already exists returns 409 Conflict.
3. Add a Document
Add a document as JSON by sending its text in thetext field. folder is optional; when provided, it is the folder path containing the document.
409 Conflict. Use update instead when the path already exists.
4. Update a Document
Update overwrites an existing document at the target path. The JSON request has the samename, text, and optional folder fields as add:
name and optional folder fields, with file replacing text:
404 Not Found.
5. Delete a Document
Delete a document by sending its name in a JSON request body. Includefolder in the name when deleting a nested document:
6. Delete a Folder
Delete an empty folder by settingrecursive to false (the default):
409 Conflict and nothing is deleted. To delete the folder and all of its contents, set recursive to true:
7. Search a Knowledge Base
Search with a requiredquery and top_k between 1 and 100. Set return_full_page to true to request full page content instead of snippets.
filters.tags matches documents with any of the supplied tags. filters.folders limits the search to folder paths and currently accepts exactly one folder.
Each result includes an id, relevance score, metadata, and matched content: