Loading...
Loading...
Compare original and translation side by side
undefinedundefined
---
---Create Task → Get task_id → Poll Status → Extract Results → Donetask_idstatus"running"output[].content[].text创建任务 → 获取task_id → 轮询状态 → 提取结果 → 完成task_idstatus"running"output[].content[].texthttps://api.manus.ai/v1https://api.manus.ai/v1API_KEY: $MANUS_API_KEY (header)API_KEY: $MANUS_API_KEY (请求头)POST /v1/tasks
Content-Type: application/json
API_KEY: $MANUS_API_KEY
{
"prompt": "Your task description",
"agentProfile": "manus-1.6", # manus-1.6-lite | manus-1.6 | manus-1.6-max
"taskMode": "agent", # agent | chat | adaptive (optional)
"projectId": "proj_xxx", # optional - use project context
"connectors": ["uuid1"], # optional - gmail, calendar, notion
"attachments": [], # optional - files, URLs, file_ids
"hideInTaskList": false, # optional - hide from task list
"createShareableLink": false, # optional - public accessibility
"taskId": "existing_task_id", # optional - continue multi-turn conversation
"locale": "en-US", # optional - user locale (e.g. "en-US", "zh-CN")
"interactiveMode": false # optional - enable follow-up questions
}{
"task_id": "TeBim6FDQf9peS52xHtAyh",
"task_title": "Generated Title",
"task_url": "https://manus.im/app/TeBim6FDQf9peS52xHtAyh",
"share_url": "https://manus.im/share/xxx"
}POST /v1/tasks
Content-Type: application/json
API_KEY: $MANUS_API_KEY
{
"prompt": "你的任务描述",
"agentProfile": "manus-1.6", # manus-1.6-lite | manus-1.6 | manus-1.6-max
"taskMode": "agent", # agent | chat | adaptive(可选)
"projectId": "proj_xxx", # 可选 - 使用项目上下文
"connectors": ["uuid1"], # 可选 - gmail, calendar, notion
"attachments": [], # 可选 - 文件、URL、file_ids
"hideInTaskList": false, # 可选 - 在任务列表中隐藏
"createShareableLink": false, # 可选 - 设为公开可访问
"taskId": "existing_task_id", # 可选 - 继续多轮对话
"locale": "en-US", # 可选 - 用户区域(例如"en-US", "zh-CN")
"interactiveMode": false # 可选 - 启用后续提问
}{
"task_id": "TeBim6FDQf9peS52xHtAyh",
"task_title": "生成的标题",
"task_url": "https://manus.im/app/TeBim6FDQf9peS52xHtAyh",
"share_url": "https://manus.im/share/xxx"
}GET /v1/tasks/{task_id}
API_KEY: $MANUS_API_KEY{
"id": "task_id",
"status": "running", # running | completed | failed | stopped
"model": "manus-1.6-adaptive",
"metadata": {
"task_title": "Task Title",
"task_url": "https://manus.im/app/xxx"
},
"output": [
{
"role": "assistant",
"status": "completed",
"content": [
{"type": "output_text", "text": "The result text..."}
]
}
],
"credit_usage": 42
}GET /v1/tasks/{task_id}
API_KEY: $MANUS_API_KEY{
"id": "task_id",
"status": "running", # running | completed | failed | stopped
"model": "manus-1.6-adaptive",
"metadata": {
"task_title": "任务标题",
"task_url": "https://manus.im/app/xxx"
},
"output": [
{
"role": "assistant",
"status": "completed",
"content": [
{"type": "output_text", "text": "结果文本..."}
]
}
],
"credit_usage": 42
}GET /v1/tasks
API_KEY: $MANUS_API_KEYGET /v1/tasks
API_KEY: $MANUS_API_KEYDELETE /v1/tasks/{task_id}
API_KEY: $MANUS_API_KEYDELETE /v1/tasks/{task_id}
API_KEY: $MANUS_API_KEYPOST /v1/projects
API_KEY: $MANUS_API_KEY
{
"name": "Project Name",
"instruction": "Default instruction for all tasks in this project"
}POST /v1/projects
API_KEY: $MANUS_API_KEY
{
"name": "项目名称",
"instruction": "此项目中所有任务的默认指令"
}GET /v1/projects
API_KEY: $MANUS_API_KEYGET /v1/projects
API_KEY: $MANUS_API_KEYPOST /v1/files/upload
API_KEY: $MANUS_API_KEY
Content-Type: multipart/form-data
file: <binary file data>file_idPOST /v1/files/upload
API_KEY: $MANUS_API_KEY
Content-Type: multipart/form-data
file: <二进制文件数据>file_idPOST /v1/webhooks
API_KEY: $MANUS_API_KEY
{
"url": "https://your-server.com/webhook"
}task_createdtask_progresstask_stoppedstop_reasonPOST /v1/webhooks
API_KEY: $MANUS_API_KEY
{
"url": "https://your-server.com/webhook"
}task_createdtask_progresstask_stoppedstop_reason| Profile | Best For | Speed |
|---|---|---|
| Quick lookups, fact checks | Fast |
| Most research tasks (balanced) | Medium |
| Complex analysis, multi-source deep dives | Slow (~complex) |
| 配置文件 | 最适合场景 | 速度 |
|---|---|---|
| 快速查询、事实核查 | 快 |
| 大多数调研任务(平衡型) | 中等 |
| 复杂分析、多源深度调研 | 慢(~复杂任务) |
curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Analyze Bitcoin price trends this week",
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "分析本周比特币价格走势",
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Deep analysis of AI market 2024-2026: market size, top 10 players, M&A trends, funding landscape",
"agentProfile": "manus-1.6-max",
"locale": "en-US"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "深度分析2024-2026年AI市场:市场规模、Top10玩家、并购趋势、融资格局",
"agentProfile": "manus-1.6-max",
"locale": "en-US"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Analyze this financial report and create a summary",
"attachments": [
{"type": "url", "url": "https://example.com/report.pdf"},
{"type": "file_id", "file_id": "file_xxx"},
{"type": "base64", "data": "base64....", "mimeType": "text/csv", "fileName": "data.csv"}
],
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "分析这份财务报告并生成摘要",
"attachments": [
{"type": "url", "url": "https://example.com/report.pdf"},
{"type": "file_id", "file_id": "file_xxx"},
{"type": "base64", "data": "base64....", "mimeType": "text/csv", "fileName": "data.csv"}
],
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Based on your previous analysis, what are the investment implications?",
"taskId": "abc123",
"interactiveMode": true
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "基于你之前的分析,有哪些投资启示?",
"taskId": "abc123",
"interactiveMode": true
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Analyze our Q1 competitor landscape",
"projectId": "proj_xxx",
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "分析我们Q1的竞品格局",
"projectId": "proj_xxx",
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Check my calendar for the next 3 months and suggest the best time for a team offsite",
"connectors": ["google-calendar-uuid"],
"agentProfile": "manus-1.6"
}'curl -X POST "https://api.manus.ai/v1/tasks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "查看我未来3个月的日历,建议团队外出团建的最佳时间",
"connectors": ["google-calendar-uuid"],
"agentProfile": "manus-1.6"
}'| Template | Description |
|---|---|
| Competitive analysis, market sizing |
| Professional presentations (PPT/PDF) |
| AI-generated videos |
| Full website generation |
| Professional resumes |
| Business SWOT analysis |
| Browser extension development |
| Travel itineraries |
| YouTube creator discovery |
| Claim verification |
| Document translation |
| Room/space design |
| Custom workout plans |
| Proof of concept prototypes |
| Research profiles on people/companies |
| Reddit sentiment analysis |
| YouTube viral content analysis |
| Business model canvas |
| 模板 | 描述 |
|---|---|
| 竞品分析、市场规模测算 |
| 专业演示文稿(PPT/PDF) |
| AI生成视频 |
| 完整网站生成 |
| 专业简历制作 |
| 企业SWOT分析 |
| 浏览器扩展开发 |
| 旅行行程规划 |
| YouTube创作者挖掘 |
| 主张验证 |
| 文档翻译 |
| 空间/室内设计 |
| 定制健身计划 |
| 原型概念验证 |
| 人物/企业调研档案 |
| Reddit情感分析 |
| YouTube爆款内容分析 |
| 商业模式画布 |
Task: [Clear objective]
Scope: [Research scope/timeframe]
Sources: [Prefer specific sources if known]
Output Format: [Structured report, bullet points, CSV, etc.]{
"prompt": "Analyze competitors to ChatGPT in the enterprise AI space (2024-2026).
Scope: Market share, pricing, key features, customer segments.
Sources: G2, Gartner, official docs, recent news.
Output: Structured comparison table + strategic positioning analysis.",
"agentProfile": "manus-1.6-max",
"locale": "en-US"
}任务:[清晰的目标]
范围:[调研范围/时间框架]
来源:[如果有指定偏好的来源]
输出格式:[结构化报告、项目符号、CSV等]{
"prompt": "分析2024-2026年企业AI领域中ChatGPT的竞品。
范围:市场份额、定价、核心功能、客户群体。
来源:G2、Gartner、官方文档、近期新闻。
输出:结构化对比表格 + 战略定位分析。",
"agentProfile": "manus-1.6-max",
"locale": "en-US"
}locale: "zh-CN""en-US"credit_usagelocale: "zh-CN""en-US"credit_usageimport requests
import time
import json
API_KEY = "your-manus-api-key"
BASE_URL = "https://api.manus.ai/v1"import requests
import time
import json
API_KEY = "your-manus-api-key"
BASE_URL = "https://api.manus.ai/v1"status = result.get("status")
print(f"Status: {status}")
if status == "completed":
# 3. Extract results
outputs = result.get("output", [])
for output in outputs:
if output.get("role") == "assistant":
for content in output.get("content", []):
if content.get("type") == "output_text":
print("\n=== RESULT ===")
print(content["text"])
break
elif status in ["failed", "stopped"]:
print(f"Task {status}")
break
time.sleep(5)
retry += 1
---status = result.get("status")
print(f"Status: {status}")
if status == "completed":
# 3. 提取结果
outputs = result.get("output", [])
for output in outputs:
if output.get("role") == "assistant":
for content in output.get("content", []):
if content.get("type") == "output_text":
print("\n=== 结果 ===")
print(content["text"])
break
elif status in ["failed", "stopped"]:
print(f"任务{status}")
break
time.sleep(5)
retry += 1
---from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def handle_webhook():
event = request.json
event_type = event.get('event_type')
if event_type == 'task_created':
print(f"✅ Task started: {event['task_detail']['task_id']}")
elif event_type == 'task_progress':
print(f"⏳ Progress: {event['progress_detail']['message']}")
elif event_type == 'task_stopped':
detail = event['task_detail']
if detail['stop_reason'] == 'finish':
print(f"✓ Completed: {detail['message']}")
for att in detail.get('attachments', []):
print(f" 📎 {att['file_name']} ({att['size_bytes']} bytes)")
print(f" URL: {att['url']}")
else:
print(f"❓ Needs input: {detail['message']}")
return jsonify({"status": "ok"})
if __name__ == '__main__':
app.run(port=8080)curl -X POST "https://api.manus.ai/v1/webhooks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook"
}'from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def handle_webhook():
event = request.json
event_type = event.get('event_type')
if event_type == 'task_created':
print(f"✅ 任务已启动:{event['task_detail']['task_id']}")
elif event_type == 'task_progress':
print(f"⏳ 进度:{event['progress_detail']['message']}")
elif event_type == 'task_stopped':
detail = event['task_detail']
if detail['stop_reason'] == 'finish':
print(f"✓ 任务完成:{detail['message']}")
for att in detail.get('attachments', []):
print(f" 📎 {att['file_name']} ({att['size_bytes']} 字节)")
print(f" URL: {att['url']}")
else:
print(f"❓ 需要输入:{detail['message']}")
return jsonify({"status": "ok"})
if __name__ == '__main__':
app.run(port=8080)curl -X POST "https://api.manus.ai/v1/webhooks" \
-H "API_KEY: $MANUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-server.com/webhook"
}'| Code | Message | Fix |
|---|---|---|
| 8 | Credit limit exceeded | Add credits at manus.im |
| 401 | Unauthorized | Check API_KEY in header |
| 400 | Bad request | Validate JSON payload, check agentProfile |
| 404 | Task not found | Verify task_id is correct |
| 429 | Rate limited | Wait before retrying |
| 500 | Server error | Retry after a few seconds |
| 错误码 | 提示信息 | 解决方法 |
|---|---|---|
| 8 | 积分额度已用完 | 在manus.im充值积分 |
| 401 | 未授权 | 检查请求头中的API_KEY |
| 400 | 请求无效 | 验证JSON payload,检查agentProfile是否正确 |
| 404 | 任务未找到 | 确认task_id正确 |
| 429 | 请求频率受限 | 等待后重试 |
| 500 | 服务器错误 | 几秒后重试 |