Search Knowledge Base Documents

Searches knowledge base documents with pagination and returns the list of documents that match the search conditions.

Request URL

POST {base_url}/uc-ai/api/v1/knowledge-base/documents/search-page

Request parameters

Headers
Parameter Required Type Description
Authorization Yes String The access token used for authentication.

Format: Bearer {access_token}.

x-tenant-code Yes String The tenant name.
Note: You can obtain tenant name using the Query Tenants interface.
Body parameters
Parameter Required Type Description
pageSize Yes Integer The number of records to retrieve per page.
pageNumber Yes Integer The page number to retrieve.
sorts No Array<Sort_Condition> The sort conditions.
keyword No String The keyword used for fuzzy matching.
name No String The name of the document, used for fuzzy matching as one of the OR targets of the keyword.
type No String

The document type used for exact filtering.

Valid value:

  • FILE: A file.
  • URL: A web page link.
  • TEXT: A text.
Sort_Condition
Parameter Required Type Description
direction No String The sort order.

Valid value:

  • asc: Sort in ascending order.
  • desc: Sort in descending order.
property No String The name of the field to sort by.

Response parameters

Parameter Type Description
requestId String The unique ID of the request, which can be used to quickly locate the request.
code String The HTTP status code of the request.
  • 200: Request succeeded.
  • Non-200 value: Request failed.
message String The status message of the request.
detailMessage String The detailed error information.

When the request is successful, this parameter returns empty.

result Object<Document_Page> The search result of knowledge base documents.
Document_Page
Parameter Type Description
pageSize Integer The number of records per page.
pageNumber Integer The current page number.
total Integer The total number of records that match the search conditions.
totalPages Integer The total number of pages.
empty Boolean Whether the current page is empty.
results Array<Document> The list of records that match the search conditions.
Document
Parameter Type Description
id String The ID of the document.
documentId String The internal document ID of the knowledge base.
name String The name of the document.
type String

The type of the document:

  • FILE: A file.
  • URL: A web page link.
  • TEXT: A text.
fileSize Integer The size of the document file, in bytes. This parameter is returned for URL documents.
ragStatus String The parsing status of the document in the knowledge base, such as PARSING.
createTime String The creation time, in Unix timestamp format (milliseconds).
updateTime String The last update time, in Unix timestamp format (milliseconds).
usedByReceptionists Array<Object> The list of receptionists that use this document.

Example

Request example

POST /uc-ai/api/v1/knowledge-base/documents/search-page HTTP/1.1
Host: api.cn.novoone.com
Authorization: Bearer eyJraWQiOiJjbi0w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AzDIMDHro5XkBgccKJkGF2GXHcGgL6-dLgi9SFjrDw
x-tenant-code: jint
Content-Type: application/json
{
  "pageNumber": 1,
  "pageSize": 10
}

Response example

HTTP/1.1 200 OK
{
  "result": {
    "pageSize": 10,
    "pageNumber": 1,
    "total": 3,
    "results": [
      {
        "id": "2112784500472999938",
        "documentId": "unDKABICdgk7ldGYnDZu",
        "name": "aitdoc-kb",
        "type": "TEXT",
        "createTime": 1792562053208,
        "updateTime": 1792562086616,
        "fileSize": 35,
        "ragStatus": "READY",
        "usedByReceptionists": []
      },
      {
        "id": "2090642366232358913",
        "documentId": "rzbAH2Xhu0Ph9MZHjnDx",
        "name": "123",
        "type": "TEXT",
        "createTime": 1787282957024,
        "updateTime": 1787282966173,
        "fileSize": 4,
        "ragStatus": "READY",
        "usedByReceptionists": []
      },
      {
        "id": "2090641172231450626",
        "documentId": "ql4AywuRmyWeMvMl7rtd",
        "name": "test",
        "type": "TEXT",
        "createTime": 1787282672352,
        "updateTime": 1787282721923,
        "fileSize": 4,
        "ragStatus": "READY",
        "usedByReceptionists": []
      }
    ],
    "totalPages": 1,
    "empty": false
  },
  "requestId": "819b50edefceeafe2cabccdf5d44d72f",
  "code": "200",
  "message": "SUCCESS"
}