list_knowledge_bases

ArtificialIntelligenceApi.list_knowledge_bases(role_id, limit=None, offset=None, sortorder=None, sortby=None, projection_expression=None, filter_expression=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

List accessible knowledge bases

Returns a paginated list of knowledge bases the authenticated user can access (owner, editor, or read-only). Default offset is 1 (1-based), limit 100 (max 1000), sortby LastModifiedTime, sortorder desc. Optional filterExpression (KnowledgebaseName supports wildcards) and projectionExpression. Structured items omit EmbeddingModel and SmartChunking.

Parameters:
  • role_id (str) – Amorphic role ID of the requesting user. Must be a role the authenticated user belongs to. (required)

  • limit (int) – Maximum number of knowledge bases to return per page. Maximum allowed is 1000.

  • offset (str) – 1-based index of the first page to return. Values past the end of the filtered list return an empty page with next_available “no”.

  • sortorder (str) – Sort direction. Use asc or desc. Any value other than desc is treated as ascending.

  • sortby (str) – Field to sort by. The field must exist on every returned item. EmbeddingModel and SmartChunking are present only on unstructured items.

  • projection_expression (str) – Comma-separated list of attributes to include in each item. When omitted, the default field set is returned.

  • filter_expression (str) – Comma-separated field:value pairs applied before pagination (format key:value,key:value). KnowledgebaseName supports wildcard matching; other fields use exact match.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

KnowledgeBaseListResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: GET /ai/knowledgebases

Parameter examples

Name

In

Example

role_id

header

"custom-role-123e4567-e89b-12d3-a456-426614174000"

projectionExpression

query

"KnowledgebaseId,KnowledgebaseName,KnowledgebaseStatus,AccessType"

filterExpression

query

"KnowledgebaseType:unstructured"

Success (HTTP 200)

Paginated list of accessible knowledge bases. Stop requesting further pages when next_available is “no”.

Request / response example

{
  "knowledgebases": [
    {
      "KnowledgebaseId": "ABCDEFGHIJ",
      "KnowledgebaseName": "sales_docs_kb",
      "KnowledgebaseType": "unstructured",
      "Description": "Product and sales documentation",
      "KnowledgebaseStatus": "ACTIVE",
      "EmbeddingModel": "amazon.titan-embed-text-v2:0",
      "LastModifiedTime": "2026-08-01 10:15:00",
      "AccessType": "owner",
      "SmartChunking": false
    }
  ],
  "next_available": "no",
  "count": 1,
  "total_count": 1
}

Errors

Documented error codes: IPV-1045, AI-1004, AUTH-1001, AUTH-1011, GE-1085, DB-1002.

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1045 (limit over maximum), AI-1004 (AICore disabled), AUTH-1001 (missing role_id), AUTH-1011 (caller not authorized).

Missing role_id header

{
  "Message": "AUTH-1001 - Missing role information in event header"
}

Caller not authorized

{
  "Message": "AUTH-1011 - User does not have sufficient permission to perform this action"
}

Limit exceeds maximum

{
  "Message": "IPV-1045 - Pagination limit 1001 exceeds maximum allowed 1000"
}

HTTP 500

Backend failure. Body is {“Message”: “<CODE> - <text>”}. Codes: GE-1085 (unexpected backend failure), DB-1002 (persistence failure).

Unexpected backend failure

{
  "Message": "GE-1085 - An unexpected error occurred"
}