# Create a data-side empty knowledge base

Create a knowledge base without data sources. After successful creation, upload and add files or data tables.

```text
POST https://moi.matrixorigin.cn/newmoi/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

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/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 | The name of the knowledge base. |
| `description` | string | No | Knowledge base description. |
| `image_index_enabled` | boolean | No | Whether to enable image indexing; when not uploaded, it is `false`. |

## Successful response

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

```json
{
  "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](upload-local-file.md) or [add data source](add-data-sources.md)].
