Update data source management settings

Updates a source’s label, expiration date, and activation status. The Catalog table source only supports updating the expiration time and activation status, and does not support labels or forced activation after expiration. Before updating the file source to enabled, confirm that the process has been created and that the vector table is visible to the current caller; otherwise the request will fail.

PATCH https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}/sources/{source_row_id}/governance

Preparation before calling

First query the data source list to obtain the source record ID. Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

  • $AI_STUDIO_API_KEY: The actual personal access token, passed through the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $MODEL_ID: Knowledge Base ID.

  • $SOURCE_ROW_ID: Source record ID to update.

Request example

curl -X PATCH "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID/sources/$SOURCE_ROW_ID/governance" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "tags": ["product"]
  }'

Path parameters

Parameters

Type

Description

model_id

integer

Knowledge base ID.

source_row_id

string

Source record ID.

Request body

Governance settings such as label, expiration time, enabled, and forced activation after expiration can be submitted. You can set the label for the file source first; when you need to change the enabled status, wait for the processing to be completed before submitting.

Field

Type

Required

Description

tags

string[]

No

Override source tag.

expires_at

integer or null

No

Unix timestamp; passing in null clears the expiration time.

enabled

boolean

No

The enabled status of the configuration.

force_enabled_after_expiry

boolean

No

Whether to force activation after the source expires.

[] after a type means an array. For example, string[] is an array of strings.

Successful response

Returns 200 and the updated source on success. Read effective_enabled to determine actual availability, do not rely solely on submitted enabled.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "source": {
      "row_id": "src_01",
      "source_type": "file",
      "model_id": 401,
      "resource_id": "file_01",
      "tags": ["product"],
      "enabled": false,
      "effective_enabled": false,
      "governance_status": "managed"
    }
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.source

object

The updated source record.

data.source.row_id

string

Source record ID.

data.source.source_type

string

Source type.

data.source.tags

string[]

Updated label; may be omitted if not set.

data.source.expires_at

integer

Unix timestamp of expiration time; null if not set.

data.source.enabled

boolean

The enabled state of the configuration; null when not set.

data.source.effective_enabled

boolean

Current actual effective status.

data.source.force_enabled_after_expiry

boolean

Whether to force enable after expiration.

data.source.governance_status

string

Current governance status.

Error response

{
  "code": "ErrParamInvalid",
  "msg": "invalid governance parameters",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

The path ID, label, expiration, or enable field is invalid; the vector table for the file source has not been created or is not currently visible; or the label, force_enabled_after_expiry, was submitted to the Catalog table.

For the file source, first query the processing status and document details, and then update enabled after confirming that the processing is completed; for the Catalog table, only update the supported fields.

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

The caller does not have permission to update origin governance settings.

Check workspace and object authorization.

404

ErrNotFound

The knowledge base or source does not exist or is not visible to the current caller.

Reconfirm the path ID.

500

ErrServer

The service failed to update governance settings.

Keep the desensitized response information and try again.

Follow-up operations

Query data source list Confirm that the governance settings have taken effect.

Last updated on