> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meoo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API 文档

Meoo Open API 帮助你的产品接入 Meoo 的项目创建、AI 应用生成、云服务管理和应用发布能力。

普通资源接口接受 OAuth Access Token、用户 API Key，或团队 AK/SK 为 Owner/虚拟成员签发的短期 Token；团队系统集成的成员管理接口接受团队 AK/SK HMAC。系统集成统一推荐团队版短期 Token，用户 API Key 仅推荐个人测试和临时调试。

生产环境基础地址：

```text
https://meoo.com/open/v1
```

除 OAuth 授权相关端点外，所有请求都需要携带 OAuth Access Token 或用户 API Key：

```text
Authorization: Bearer <access_token_or_meoo_ak>
```

## 按资源查看

| 资源     | 你可以做什么                                | 详细文档                                                                                                                     |
| :----- | :------------------------------------ | :----------------------------------------------------------------------------------------------------------------------- |
| 用户与项目  | 获取已授权用户信息、创建项目、查找项目、删除项目              | [用户与项目 API](/open/reference/users-and-projects)                                                                          |
| 团队成员   | 创建、查询、冻结或删除托管成员，签发成员临时 Token          | [团队成员 API](https://alidocs.dingtalk.com/i/nodes/G1DKw2zgV2KnvL4kFvOdLmKwJB5r9YAn) · [集成指南](/open/reference/team-members) |
| Agent  | 发起 Run、上传 ZIP 附件、接收实时进度、处理交互、继续会话     | [Agent OpenAPI](/open/reference/ai-generation) · [接入指南](/open/agent/overview) · [附件与 Skills](/open/agent/attachments)    |
| Skills | 上传私有 Skill，并在 Agent Run 中选择使用         | [Skills API](/open/reference/skills)                                                                                     |
| 云服务    | 查询数据库、存储、云函数和 Secret，执行 SQL，维护 Secret | [云服务 API](/open/reference/cloud-services)                                                                                |
| 源码     | 将项目当前源码导出为 ZIP，并获取短期下载链接              | [源码导出 API](/open/reference/source-export)                                                                                |
| 源码版本   | 查询历史源码版本，恢复源码并新建对话、重启预览；不会自动发布        | [项目源码版本 API](/open/reference/source-versions)                                                                            |
| 源码导入   | 上传 ZIP 创建新 Web 项目，可选 AI 适配；导入与发布分开执行  | [源码导入 API](/open/reference/source-import) · [项目导入与发布](/open/guides/import-and-publish)                                   |
| 发布     | 发布项目、接收发布进度、查询当前版本和历史记录               | [发布 API](/open/reference/publish)                                                                                        |

## 接口一览

### 用户与项目

| 方法     | 路径                                         | 权限                             |
| :----- | :----------------------------------------- | :----------------------------- |
| `GET`  | `/user`                                    | `user.read`                    |
| `GET`  | `/projects`                                | `project.read`                 |
| `POST` | `/projects`                                | `project.write`                |
| `POST` | `/projects/{project_id}/tokens`            | `project.token.write`（仅 OAuth） |
| `GET`  | `/projects/{project_id}/watermark-removal` | `project.read`                 |
| `PUT`  | `/projects/{project_id}/watermark-removal` | `project.write`                |
| DELETE | /projects/\{project\_id}                   | project.write                  |

### 团队成员（AK/SK HMAC）

| 方法       | 路径                                 | 权限                        |
| :------- | :--------------------------------- | :------------------------ |
| `POST`   | `/team/members/`                   | `team.member.create`      |
| `GET`    | `/team/members/`                   | `team.member.read`        |
| `GET`    | `/team/members/{member_id}`        | `team.member.read`        |
| `PATCH`  | `/team/members/{member_id}`        | `team.member.update`      |
| `DELETE` | `/team/members/{member_id}`        | `team.member.delete`      |
| `POST`   | `/team/members/{member_id}/tokens` | `team.member.token.issue` |

### Agent

| 方法     | 路径                                                                      | 权限           |
| :----- | :---------------------------------------------------------------------- | :----------- |
| `POST` | `/projects/{project_id}/agent/runs`                                     | `agent.run`  |
| `POST` | `/projects/{project_id}/agent/uploads`                                  | `agent.run`  |
| `POST` | `/projects/{project_id}/agent/archives`                                 | `agent.run`  |
| `POST` | `/projects/{project_id}/agent/archives/{archive_id}/confirm`            | `agent.run`  |
| `GET`  | `/projects/{project_id}/agent/runs/current`                             | `agent.read` |
| `GET`  | `/projects/{project_id}/agent/runs/{run_id}/events`                     | `agent.read` |
| `POST` | `/projects/{project_id}/agent/runs/{run_id}/cancellations`              | `agent.run`  |
| `POST` | `/projects/{project_id}/agent/action-responses`                         | `agent.run`  |
| `GET`  | `/projects/{project_id}/agent/conversations`                            | `agent.read` |
| `GET`  | `/projects/{project_id}/agent/conversations/{conversation_id}/messages` | `agent.read` |

ZIP 附件按「申请票据 → PUT 上传 → confirm → 启动 Run」接入，每次 Run 最多一个 ZIP；压缩包限额以票据返回的 `max_size_bytes` 为准。完整请求、响应及错误处理见[附件与 Skills](/open/agent/attachments)。

### Skills

| 方法     | 路径        | 权限            |
| :----- | :-------- | :------------ |
| `POST` | `/skills` | `skill.write` |

### 云服务

| 方法       | 路径                                                                   | 权限                         |
| :------- | :------------------------------------------------------------------- | :------------------------- |
| `GET`    | `/projects/{project_id}/cloud/database/status`                       | `cloud.database.read`      |
| `GET`    | `/projects/{project_id}/cloud/database/tables`                       | `cloud.database.read`      |
| `POST`   | `/projects/{project_id}/cloud/database/queries`                      | `cloud.database.write`     |
| `GET`    | `/projects/{project_id}/cloud/storage/buckets`                       | `cloud.storage.read`       |
| `GET`    | `/projects/{project_id}/cloud/storage/buckets/{bucket_name}/objects` | `cloud.storage.read`       |
| `GET`    | `/projects/{project_id}/cloud/functions`                             | `cloud.function.read`      |
| `GET`    | `/projects/{project_id}/cloud/functions/{function_name}/logs`        | `cloud.function.logs.read` |
| `GET`    | `/projects/{project_id}/cloud/secrets`                               | `cloud.secret.read`        |
| `PUT`    | `/projects/{project_id}/cloud/secrets/{secret_name}`                 | `cloud.secret.write`       |
| `DELETE` | `/projects/{project_id}/cloud/secrets/{secret_name}`                 | `cloud.secret.write`       |

### 源码导入

| 方法     | 路径                 | 权限                                                |
| :----- | :----------------- | :------------------------------------------------ |
| `POST` | `/projects/import` | `project.write source.write`；开启 AI 另需 `agent.run` |

仅支持新建 Web 项目；multipart 上传单个 ZIP，最大 100 MiB。读取 SSE 终态 `import.completed` 后再发布；开启 AI 时还需通过已有 Agent API 等待 Run 完成。具体限制、幂等重试及错误处理见[源码导入 API](/open/reference/source-import)。

### 源码

| 方法     | 路径                                                            | 权限             |
| :----- | :------------------------------------------------------------ | :------------- |
| `POST` | `/projects/{project_id}/source-exports`                       | `source.read`  |
| `GET`  | `/projects/{project_id}/source-versions`                      | `source.read`  |
| `POST` | `/projects/{project_id}/source-versions/{version_id}/restore` | `source.write` |

源码版本是 Git 提交，不是发布版本。恢复会创建新提交并保留历史，不会自动更新线上站点。请求参数、并发校验和预览恢复说明见[项目源码版本 API](/open/reference/source-versions)。

### 发布

当前只支持 `web` 项目的默认 Web 发布，不提供 App 安装包或小程序平台发布。

| 方法     | 路径                                          | 权限              |
| :----- | :------------------------------------------ | :-------------- |
| `POST` | `/projects/{project_id}/releases`           | `release.write` |
| `POST` | `/projects/{project_id}/releases/prepare`   | `release.write` |
| `POST` | `/projects/{project_id}/releases/complete`  | `release.write` |
| `POST` | `/projects/{project_id}/releases/unpublish` | `release.write` |
| `GET`  | `/projects/{project_id}/releases/current`   | `release.read`  |
| `GET`  | `/projects/{project_id}/releases`           | `release.read`  |

## 通用请求约定

### 项目标识

源码导入返回的 `project_id` 已是公开项目标识，可以直接用于后续接口路径，不需要内部项目 ID 或 Git 提交 ID。

项目相关接口的路径参数 `{project_id}` 使用项目接口返回的 `url_id` 字段值。请将它作为字符串保存和传递，不要尝试解析其结构。

### 分页

支持分页的接口使用以下参数：

**参数说明**

- `page_size`（integer，可选）：每页数量，默认 20，最大 100
- `page_token`（string，可选）：上一页响应中的 `next_page_token`

还有下一页时，响应会包含 `next_page_token`。下一次请求原样传回即可；不要解析、修改或跨接口复用。

### 时间与大整数

- 所有时间字段均为 Unix 毫秒时间戳。
- 可能超出 JavaScript 安全整数范围的 ID、文件大小和数据库统计值使用十进制字符串返回。
- 客户端应忽略暂时不认识的响应字段和枚举值，以便兼容后续扩展。

### 请求追踪

响应头中的 `X-Meoo-Trace-Id` 是请求的排查编号。反馈问题时请提供接口路径、请求时间、HTTP 状态码、错误码和该编号，不要提供 Token、API Key 或 Secret。

## 错误响应

JSON 接口使用 `application/problem+json` 返回错误：

```text
{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "page_size 必须是非负整数",
  "code": "invalid_request",
  "trace_id": "01JEXAMPLETRACEID"
}
```

| HTTP 状态               | 含义               | 建议处理                                         |
| :-------------------- | :--------------- | :------------------------------------------- |
| `400`                 | 请求参数或格式不正确       | 根据 `code` 和 `detail` 修正请求                    |
| `401`                 | 凭证缺失、失效或过期       | 更新 Access Token，或检查 API Key                  |
| `403`                 | 缺少所需权限，或当前操作不被允许 | 申请所需 Scope，或提示用户处理账号/项目状态                    |
| `404`                 | 资源不存在或当前用户不能访问   | 检查资源 ID；不要持续重试                               |
| `409`                 | 当前资源状态与操作冲突      | 根据错误码等待、恢复或重新发起操作                            |
| `413`                 | 请求、上传文件或响应结果超过限制 | 缩小文件、SQL 查询结果或请求内容；ZIP 上传检查 `max_size_bytes` |
| `429`                 | 请求过于频繁           | 按 `Retry-After` 等待后重试                        |
| `500` / `502` / `503` | 服务暂时不可用          | 对可安全重试的请求使用指数退避，并保留 `trace_id`               |

Agent 事件流当前使用 60 秒固定限频窗口；其 `Retry-After: 60` 是固定窗口的安全等待上界，不是剩余 TTL。客户端应等待后增加少量随机抖动再重连，避免集中重试。

完整的分页、错误、幂等和 SSE 规则见 [通用协议](/open/protocol)。
