技能
上傳技能
POST /api/v1/skills/upload/
程式碼範例
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/skills/upload/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-F "file=@example_file.pdf" \
-F "attached_tool_ids=範例字串"
# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。const axios = require('axios');
const FormData = require('form-data');
// 建立FormData對象
const formData = new FormData();
// 請用實際檔案替換
formData.append('file', /* 實際檔案物件 */, 'example_file.pdf');
formData.append('attached_tool_ids', '範例字串');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
...formData.getHeaders()
}
};
axios.post("https://api.maiagent.ai/api/v1/skills/upload/", formData, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});回應內容
狀態碼: 201
回應結構範例
{
"id"?: string (uuid) // 非必填
"name"?: string // 非必填
"description"?: string // 非必填
"attached_tools"?: [ // 已依技能包 frontmatter 自動綁定的工具名稱 (非必填)
string
]
"missing_tools"?: [ // 技能包宣告但本組織查無同名工具、需手動補綁的工具名稱 (非必填)
string
]
"message"?: string // 非必填
}回應範例值
狀態碼: 400
回應結構範例
回應範例值
建立技能
POST /api/v1/skills/
請求內容
請求參數
name
string
是
description
string
是
whenToUse
string
否
Describe when the LLM should trigger this skill. Max 200 characters recommended.
instructions
string
否
Markdown text with instructions for the skill
attachedToolIds
array[string]
否
groups
array[IdName]
否
Groups this skill is assigned to. Non-owner members must pick at least one group they belong to.
files
array[object]
否
Optional resource files to create with the skill. Each item must include path and content. content_encoding may be "text" or "base64".
請求結構範例
請求範例值
程式碼範例
回應內容
狀態碼: 201
回應結構範例
回應範例值
列出技能
GET /api/v1/skills/
參數
isActive
❌
boolean
page
❌
integer
A page number within the paginated result set.
pageSize
❌
integer
Number of results to return per page.
search
❌
string
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
取得特定技能
GET /api/v1/skills/{id}/
參數
id
✅
string
A UUID string identifying this Skill.
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
更新技能
PUT /api/v1/skills/{id}/
參數
id
✅
string
A UUID string identifying this Skill.
請求內容
請求參數
name
string
是
description
string
是
whenToUse
string
否
Describe when the LLM should trigger this skill. Max 200 characters recommended.
instructions
string
否
Markdown text with instructions for the skill
attachedToolIds
array[string]
否
groups
array[IdName]
否
Groups this skill is assigned to. Non-owner members must pick at least one group they belong to.
請求結構範例
請求範例值
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
部分更新技能
PATCH /api/v1/skills/{id}/
參數
id
✅
string
A UUID string identifying this Skill.
請求內容
請求參數
name
string
否
description
string
否
whenToUse
string
否
Describe when the LLM should trigger this skill. Max 200 characters recommended.
instructions
string
否
Markdown text with instructions for the skill
attachedToolIds
array[string]
否
groups
array[IdName]
否
Groups this skill is assigned to. Non-owner members must pick at least one group they belong to.
請求結構範例
請求範例值
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
刪除技能
DELETE /api/v1/skills/{id}/
參數
id
✅
string
A UUID string identifying this Skill.
程式碼範例
回應內容
204
No response body
匯出技能
GET /api/v1/skills/{id}/export/
參數
id
✅
string
A UUID string identifying this Skill.
程式碼範例
回應內容
200
.skill 檔案下載
瀏覽技能包目錄結構
GET /api/v1/skills/{id}/package-structure/
參數
id
✅
string
A UUID string identifying this Skill.
path
❌
string
要瀏覽的目錄路徑(預設為根目錄)
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
狀態碼: 400
回應結構範例
回應範例值
重新上傳技能
POST /api/v1/skills/{id}/reupload/
參數
id
✅
string
A UUID string identifying this Skill.
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
狀態碼: 400
回應結構範例
回應範例值
列出技能資源
GET /api/v1/skills/{skillPk}/resources/
參數
skillPk
✅
string
程式碼範例
回應內容
狀態碼: 200
回應結構範例
回應範例值
上傳技能資源
POST /api/v1/skills/{skillPk}/resources/
參數
skillPk
✅
string
程式碼範例
回應內容
狀態碼: 201
回應結構範例
回應範例值
狀態碼: 400
回應結構範例
回應範例值
刪除技能資源
DELETE /api/v1/skills/{skillPk}/resources/{id}/
參數
id
✅
string
skillPk
✅
string
程式碼範例
回應內容
204
No response body
下載技能資源
GET /api/v1/skills/{skillPk}/resources/{id}/download/
參數
id
✅
string
skillPk
✅
string
程式碼範例
回應內容
200
檔案下載
最後更新於
這有幫助嗎?