介绍
CrewAI AMP API
Section titled “CrewAI AMP API”欢迎来到 CrewAI AMP API 参考文档。这个 API 允许你通过程序与已部署的 crews 交互,从而集成到你的应用、工作流和服务中。
- 获取 API 凭据
进入 CrewAI AMP 仪表盘中你的 crew 详情页,并从 Status 标签页复制你的 Bearer Token。
- 了解所需输入
使用
GET /inputs端点查看你的 crew 需要哪些参数。 - 启动一次 Crew 执行
使用你的输入调用
POST /kickoff,启动 crew 执行并获得一个kickoff_id。 - 监控进度
使用
GET /status/{kickoff_id}检查执行状态并获取结果。
所有 API 请求都需要使用 Bearer token 进行认证。在 Authorization header 中包含你的 token:
curl -H "Authorization: Bearer YOUR_CREW_TOKEN" \ https://your-crew-url.crewai.com/inputsToken 类型
Section titled “Token 类型”| Token Type | Scope | Use Case |
|---|---|---|
| Bearer Token | Organization-level access | Full crew operations, ideal for server-to-server integration |
| User Bearer Token | User-scoped access | Limited permissions, suitable for user-specific operations |
基础 URL
Section titled “基础 URL”每个已部署的 crew 都有自己唯一的 API endpoint:
https://your-crew-name.crewai.com将 your-crew-name 替换为你在仪表盘中看到的实际 crew URL。
- 发现:调用
GET /inputs了解你的 crew 需要什么 - 执行:通过
POST /kickoff提交输入并开始处理 - 监控:轮询
GET /status/{kickoff_id},直到完成 - 结果:从完成后的响应中提取最终输出
API 使用标准 HTTP 状态码:
| Code | Meaning |
|---|---|
200 | Success |
400 | Bad Request - Invalid input format |
401 | Unauthorized - Invalid bearer token |
404 | Not Found - Resource doesn’t exist |
422 | Validation Error - Missing required inputs |
500 | Server Error - Contact support |
每个 endpoint 页面都会向你展示:
- ✅ 准确的请求格式,包含所有参数
- ✅ 响应示例,包括成功和错误场景
- ✅ 多语言代码样例(cURL、Python、JavaScript 等)
- ✅ 认证示例,使用正确的 Bearer token 格式
测试你的真实 API:
Section titled “测试你的真实 API:”复制 cURL 示例
复制 cURL 示例,并将 URL + token 替换为你的真实值
使用 Postman/Insomnia
将示例导入你偏好的 API 测试工具
示例工作流:
- 复制这个 cURL 示例,从任意 endpoint 页面获取
- 将
your-actual-crew-name.crewai.com替换为你的真实 crew URL - 将 Bearer token 替换为你在仪表盘中获得的真实 token
- 在终端或 API 客户端中运行请求