REST API

Last modified by Michael Hamann on 2026/03/18 15:40

Content

Reference

The REST API provides a convenient way to manage both collections and documents inside collections from external tools. This can be used in other applications to add, update and delete content that is indexed in the LLM application whenever content is added, changed or deleted the application.

Collections Resource

GET /wikis/{wikiName}/aiLLM/collections

Returns a list of all collection IDs that the current user can access as an array of strings.

Collection Resource

A collection object has the following properties:

Name Type Description
id String id of the collection
title Stringpretty name of the collection
embedding_modelStringthe embedding model as reference of the page that defines the model
chunking_methodStringthe chunking method, should be maxChars
chunking_max_sizeint the maximum size of a chunk
chunking_overlap_offsetintthe overlap of chunks
document_spacesList of stringsthe list of XWiki spaces indexed by this collection, currently not used
allow_guestsbooleanif guests can query this collection (as part of a chat completion)
query_groupsList of stringsthe list of groups that are allowed to query this collection (as part of a chat completion). This is only used when guests aren't allowed to query the collection.
rights_check_methodStringthe method used for checking access rights of individual documents during queries. Supported values: public, external. See also the Authorization section of the Index for the LLM Application.
rights_check_method_configurationObjectoptions of the rights check method, values depend on the selected rights check method. The "external" rights check method supports the url parameter which is the URL that is used to check rights for all found documents.

GET /wikis/{wikiName}/aiLLM/collections/{collectionName}

Returns the collection of the given name.

PUT /wikis/{wikiName}/aiLLM/collections/{collectionName}

Creates or updates the collection of the given name. The body of the request is a collection, if not all properties are specified, only the specified properties are updated.

DELETE /wikis/{wikiName}/aiLLM/collections/{collectionName}

Deletes the collection of the given name

GET /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents

Returns a list of document IDs that are contained in the collection of the given name. This resource supports the following query parameters:

NameDescription
startthe index of the first document to retrieve (default: 0)
numberthe number of documents to retrieve (default: -1)

Document Resource

A document object has the following properties, all properties are strings:

NameDescription
idid of the document
titlepretty name of the document
languagethe language of the document (currently not used)
urlthe URL of the document, used to display a link to the original resource when the document is used as context in a chat
collectionthe name of the collection the document is part of
mimetypethe mime type of the document, currently not used, could be used in the future to use a chunking method that is specific to the mime type
contentthe content of the document that is indexed

GET /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents/{documentID}

Returns the document of the given name in the collection of the given name.

PUT /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents/{documentID}

Creates or updates the document of the given name in the collection of the given name. The body of the request is a document, if not all properties are specified, only the specified properties are updated.

DELETE /wikis/{wikiName}/aiLLM/collections/{collectionName}/documents/{documentID}

Deletes the document of the given name in the collection of the given name.

LLM 0.8+

Search Resource

The search resource allows searching in indexed content. In contrast to the previous APIs, rights aren't checked based on standard XWiki rights but based on the allow_guests flag and the query groups. This API is basically the same as the search_wiki tool in the MCP Server.

POST /wikis/{wikiName}/aiLLM/search

Supported parameters:

NameTypeDescription
queryStringThe query to search for
collectionString (can be specified several times)The IDs of the collections to search in, when omitted, all accessible collections are searched
limitKeywordResultsintThe maximum number of results to return based on keyword search (default: 10)
limitSemanticResultsintThe maximum number of results to return based on semantic search (default: 10)

Search Collections Resource

The search collections resource returns all collections that the current user can access for search. This allows presenting users a list of collections they can select for search.

GET /wikis/{wikiName}/aiLLM/search/collections

Supported parameters: none.

Result: A list of collection resources with only id and title properties.

Get Connected