Create a knowledge base

Updated at:

Creates a Qoder CN knowledge base.

Important

The new Qoder CN documentation site is now available. Content on this site may not reflect the latest product features and changes. Visit docs.qoder.cn for the latest product documentation.

Supported editions

Enterprise Dedicated Edition, Enterprise Standard Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint.

Authorization

Product

Resource

Required permissions

Qoder CN

knowledge base

Read and write

Request syntax

POST https://{domain}/oapi/v1/lingma/organizations/{organizationId}/knowledgeBases

Request

Enterprise standard edition

Create knowledge base

curl -X 'POST' \
  'https://openapi-rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "accessLevel": 0,
        "creatorId": "66a6f60e368d88cff5a5****",
        "description": "this is a kb",
        "name": "Qoder CN knowledge base",
        "organizationId": "6826e1d0516a9f85a08c****",
        "sceneType": "answer"
    }'

Enterprise dedicated edition

Create knowledge base

curl -X 'POST' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "accessLevel": 0,
        "creatorId": "66a6f60e368d88cff5a5****",
        "description": "this is a kb",
        "name": "Qoder CN knowledge base",
        "organizationId": "6826e1d0516a9f85a08c****",
        "sceneType": "answer"
    }'

Request headers

x-yunxiao-token string (Required)

Your personal access token. For more information, see personal access token.

Example: pt-0fh3****0fbG_35af****0484.

Request parameters

organizationId string (Required)

The ID of the organization. This is a path parameter. To get the ID, go to the Organization Management Backend, open the Basic Information page, and get your organization ID.

name string (Required)

The name of the knowledge base. The name must be no longer than 100 characters.

sceneType string (Required)

The use case for the knowledge base. Valid values:

  • chat: For Q&A scenarios.

  • complement: For code completion scenarios.

accessLevel integer (Required)

The visibility of the knowledge base. Valid values:

  • 0: private knowledge base.

  • 10: public knowledge base.

creatorId string (Required)

The creator's ID. To get this ID, see Query member list.

organizationId string (Required)

The ID of the organization. This is a body parameter, and its value must match the ID in the request path. To get the ID, go to the Organization Management Backend, open the Basic Information page, and get your organization ID.

description string (Optional)

A description of the knowledge base. The description must be no longer than 200 characters.

Response parameters

Response example

{
    "kbId": "b15aef8442c0fc45492b****"
}

kbId string

The ID of the created knowledge base.

Error codes

For more information, see Error code center.