Set the current skill version

Set the existing skill version as the current version. Request to use the current version number for concurrent verification to avoid overwriting the updates just completed by other callers.

POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/skills/{skill_id}/versions/{version}/current

Before you call

First query skill version to get the target version number, and query skill details to get the current version number]. Prepare the personal access token, target workspace ID, and skill ID that have 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.

  • $SKILL_ID: Skill ID.

Request example

curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/skills/$SKILL_ID/versions/2/current" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "expected_current_version": 1
  }'

Path parameters

Parameters

Type

Is it required

Description

workspace_id

string

Yes

The current workspace ID.

skill_id

string

Yes

Skill ID.

version

integer

Yes

Positive integer version number to be set to the current version.

Query parameters

Parameters

Type

Is it required

Description

skill_workspace_id

string

No

The workspace to which the skill belongs; can only be the current workspace or system. System skills are read-only.

Request body

Field

Type

Is it required

Description

expected_current_version

integer

Yes

The current version number read must be a positive integer. When the target version is not yet the current version, the service will use it for concurrent verification.

Successful response

On success, 200 and the switched skill definition are returned.

{
  "code": 0,
  "data": {
    "id": "skill_01",
    "workspace_id": "ws_01",
    "name": "摘要技能",
    "status": "active",
    "version": 2,
    "updated_at": "2026-01-03T10:00:00Z"
  }
}

The response fields are as follows.

Field

Type

Description

code

integer

0 on success.

data.id

string

Skill ID and workspace.

data.workspace_id

string

Skill ID and workspace.

data.name

string

Basic information about current skills.

data.status

string

Basic information about current skills.

data.version

integer

The current version number after switching.

data.updated_at

string

Switching time, using RFC 3339 format.

Error response

{
  "code": 4,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

2INVALID_ARGUMENT

The version number or expected_current_version is not a positive integer, or the path/workspace range is invalid.

Use a valid version number after reading the version list.

401

6UNAUTHENTICATED

Lack of valid identity credentials.

Check API Key.

403

5PERMISSION_DENIED

The current identity does not have permission to update skills.

Check workspace authorization.

403

7FORBIDDEN

Specify system skills as read-only.

Create a manageable copy of the skill in the current workspace.

404

3NOT_FOUND

Skill or target version does not exist.

Check skill ID, version number and skill_workspace_id.

409

4ALREADY_EXISTS

The current version has changed and expected_current_version no longer matches.

Reread the skill details or version list before submitting.

503

15UNAVAILABLE

Skill services or authorized dependencies are temporarily unavailable.

Try again later.

Follow-up operations

After setting, Query skill version or Query skill details to confirm the current version.

Last updated on