Create a data-side empty knowledge base

Create a Resource Center knowledge base and its data domain without data sources. Resource Center uses this endpoint for creation; add files or data tables afterward.

POST https://api.moi.matrixorigin.cn/v5/semantic-models/create-empty

Preparation before calling

Prepare a personal access token and workspace ID that has permission to create a knowledge base for the target workspace. Examples use $AI_STUDIO_API_KEY and $WORKSPACE_ID.

Request example

curl -X POST "https://api.moi.matrixorigin.cn/v5/semantic-models/create-empty" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "product_docs",
    "description": "产品资料",
    "image_index_enabled": false
  }'

Request body

Field

Type

Required

Description

name

string

Yes

Nonempty knowledge base name, up to 255 Unicode characters, with no leading or trailing whitespace. Character rules are listed below.

description

string

No

Knowledge base description.

image_index_enabled

boolean

No

Whether to enable image indexing; when not uploaded, it is false.

Names follow Catalog naming rules: start with a lowercase letter, digit, underscore, or Han character; subsequent characters may also contain hyphens (-) and periods (.). Examples include product_docs and 产品资料. Uppercase letters, spaces, and slashes (/) are not allowed. The name cannot be changed after creation.

Successful response

Returns 201 on success. Save data.model.id and use it as model_id in subsequent interfaces.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "model": {
      "id": 401,
      "name": "product_docs",
      "tables": []
    },
    "data_domain": {
      "model_id": 401,
      "ensure_status": "ready"
    }
  }
}

Field

Type

Description

data.model

object

New knowledge base.

data.model.id

integer

Knowledge base ID.

data.data_domain

object

The data domain information of this knowledge base.

data.data_domain.ensure_status

string

Data field preparation status.

Common mistakes

HTTP Status Codes

Error Codes

Common Causes

Recommended Actions

400

ErrParamInvalid

name is missing or the request body is invalid.

Provide a non-empty name and check the JSON.

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

No workspace creation permission.

Check workspace authorization.

Follow-up operations

Use data.model.id to upload the local file or add data source].

Last updated on