CreateKnowledgeBase

Updated at:

Creates a knowledge base and returns the knowledge base ID, name, ownership, and the access role of the current caller. The creation process does not automatically add sources, build knowledge, or generate retrieval results. You can continue to configure knowledge sources and build tasks. The tenant and owner of the knowledge base are determined by the current caller identity. You do not need to specify a workspace or resource group.

Operation description

Creates a knowledge base. The tenant and caller identity are determined by the POP authentication context.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:CreateKnowledgeBase

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Name

string

Yes

The name of the knowledge base. This parameter cannot be empty. The server limits the length to a maximum of 128 characters.

Sales knowledge base

Description

string

No

The description of the knowledge base. This parameter is optional. The server limits the length to a maximum of 1024 characters.

Sales metrics and business policy knowledge

Type

string

No

The type of the knowledge base. Valid values: PERSONAL: personal knowledge base. ENTERPRISE: enterprise knowledge base. If you omit this parameter, the default value is PERSONAL. Creating an enterprise knowledge base requires the corresponding enterprise knowledge base capabilities.

Valid values:

  • PERSONAL :

    Personal knowledge base.

  • ENTERPRISE :

    Enterprise knowledge base.

PERSONAL

ClientToken

string

No

The idempotency token for the creation request. This parameter is optional. The maximum length is 64 characters, and it cannot be a blank string. Use the same value when the same caller retries the same creation request in the same region. If the same value is used but the request content is different, a conflict is returned. If you omit this parameter, duplicate requests are not guaranteed to create only one knowledge base.

kb-create-sales-001

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The unique identifier of the request. You can use this ID to troubleshoot issues.

00000000-0000-4000-8000-000000000001

Success

boolean

Indicates whether the request is successful.

Data

object

The knowledge base information returned after the knowledge base is created.

KnowledgeBaseId

string

The stable knowledge base ID generated by the server. You can use this ID to read the knowledge base, register sources, and create build tasks.

12345678-1234-4234-8234-123456789abc

Name

string

The name of the knowledge base.

Sales knowledge base

Description

string

The description of the knowledge base. This field may not be returned if it is not set.

Sales metrics and business policy knowledge

Type

string

The type of the knowledge base. A value of PERSONAL indicates a personal knowledge base, and a value of ENTERPRISE indicates an enterprise knowledge base.

PERSONAL

Owner

string

The DataWorks user ID of the knowledge base owner. The server determines this value based on the caller identity.

1000000000000000

AccessRole

string

The access role of the current caller for the knowledge base. If the knowledge base is created, the value is OWNER, which indicates the owner.

OWNER

Status

string

The status of the knowledge base. If the knowledge base is created, the value is ACTIVE, which indicates that the knowledge base is available for normal use.

ACTIVE

CreateTime

integer

The time when the knowledge base was created. The value is a UNIX timestamp in milliseconds.

1790200000000

ModifyTime

integer

The time when the knowledge base was last modified. The value is a UNIX timestamp in milliseconds.

1790200000000

Code

string

The business error code returned when the request fails. This field is not returned if the request is successful.

InvalidParameter

Message

string

The error message returned when the request fails. This field is not returned if the request is successful.

The request parameters are invalid

Examples

Success response

JSON format

{
  "RequestId": "00000000-0000-4000-8000-000000000001",
  "Success": false,
  "Data": {
    "KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
    "Name": "Sales knowledge base",
    "Description": "Sales metrics and business policy knowledge",
    "Type": "PERSONAL",
    "Owner": "1000000000000000",
    "AccessRole": "OWNER",
    "Status": "ACTIVE",
    "CreateTime": 1790200000000,
    "ModifyTime": 1790200000000
  },
  "Code": "InvalidParameter",
  "Message": "The request parameters are invalid"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The request parameters are invalid.
500 InternalError The knowledge base operation failed. Use RequestId to contact support.
403 Forbidden You are not authorized to perform this operation.
404 ResourceNotFound The requested resource does not exist or is not visible.
409 Conflict The resource state conflicts with this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.