# appstore_sales

> 从 Apple 的销售报告中读取一个 App 或整个 Apple 团队的下载量、重新下载量、更新量、App 内购买和收益。

Source: https://air.build/cn/docs/mcp-tools/appstore_sales/

汇总 Apple 的销售报告：下载量、重新下载量、更新量、App 内购买和收益，针对一个 App（`projectId` 或 `appId`）或某个 Apple 团队的所有 App。范围是最近几天（默认 7 天，截至昨天）或一个自然月。Apple 发布每天的报告大约会晚一天；还没有报告的日期列在 `noReportYet` 中。它不做任何更改。

销售报告需要在 App Store Connect 中接受 Apple 的付费 App 协议。AirBuild 还没有该 Apple 团队的供应商编号时，第一次调用会通过团队拥有者在 AirBuild 中的 Apple 登录向 Apple 获取。

时间段较长时，这个工具可能需要一段时间。客户端接受流式响应时，它会以带进度的流返回（见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#transport)）。

| 只读 | 破坏性 | 幂等 |
| --- | --- | --- |
| 是 | 否 | 是 |

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | yes | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/)。 |
| `projectId` | 字符串（UUID） | no | — | 一个 App：该项目的 App，来自 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/)。 |
| `appId` | string | no | — | 一个 App，用来自 [appstore_list_apps](https://air.build/cn/docs/mcp-tools/appstore_list_apps/) 的 App Store Connect ID 指定。 |
| `appleTeamId` | 字符串（UUID） | 连接了多个 Apple 团队且没有指定 App 时必填 | 唯一已连接的那个 | Apple 团队，来自 [appstore_list_apple_teams](https://air.build/cn/docs/mcp-tools/appstore_list_apple_teams/)。不指定 App 时，统计它的所有 App。 |
| `days` | 整数，1 到 31 | no | 7 | 多少天，截至 `endDate`。 |
| `endDate` | 字符串，`YYYY-MM-DD` | no | yesterday | 最后一天，按太平洋时间。 |
| `month` | 字符串，`YYYY-MM` | no | — | 改为整个月；此时忽略 `days` 和 `endDate`。 |

每个工具对输入所做的检查见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#errors)。

## 结果

一个 JSON 对象，同时以文本和 `structuredContent` 返回。

| 字段 | 说明 |
| --- | --- |
| `scope` | App（`appId`、`name`），或 Apple 团队（`appleTeamId`、`apps: "all"`） |
| `period` | `from` 和 `to` 日期，或 `month` |
| `totals` | `downloads`（首次下载）、`redownloads`、`updates`、`inAppPurchases`（数量）和 `proceeds`：按币种列出的开发者收益，与 Apple 报告的一致 |
| `byDay` | 仅按天，不按月：`date`、`downloads`、`inAppPurchases` |
| `topCountries` | 下载量最多的 10 个国家/地区：`country`（两个字母的代码）、`downloads` |
| `products` | 数量最多的 20 个产品，不含更新：`sku`、`title`、`type`（Apple 的产品类型）、`units`、按币种的 `proceeds`。只看一个 App 时，包括它的 App 内购买项目 |
| `noReportYet` | 仅在部分报告缺失时出现：没有报告的日期（或月份） |

```json
{
  "scope": {
    "appId": "1234567890",
    "name": "Notes"
  },
  "period": {
    "from": "2026-11-12",
    "to": "2026-11-18"
  },
  "totals": {
    "downloads": 120,
    "redownloads": 14,
    "updates": 300,
    "inAppPurchases": 6,
    "proceeds": {
      "USD": 20.94
    }
  },
  "byDay": [
    {
      "date": "2026-11-18",
      "downloads": 18,
      "inAppPurchases": 1
    }
  ],
  "topCountries": [
    {
      "country": "US",
      "downloads": 64
    }
  ],
  "products": [
    {
      "sku": "com.example.notes",
      "title": "Notes",
      "type": "1F",
      "units": 120,
      "proceeds": {}
    }
  ]
}
```

## 错误

每个错误都以工具错误（`isError: true`）返回。_斜体_ 文字代表句中的具体值。所有工具都可能返回的错误见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#errors)。

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| Apple has no sales reports for this team yet: the Paid Applications agreement must be accepted in App Store Connect first. | Apple 没有该 Apple 团队的供应商编号 | 由账户持有人在 App Store Connect 中接受付费 App 协议 |
| month must look like 2026-09. | `month` 不是 `YYYY-MM` 格式 | 修正格式 |
| endDate must look like 2026-09-30. | `endDate` 不是 `YYYY-MM-DD` 格式 | 修正格式 |
| This Team has no Apple Developer account connected. The Team's owner connects one in AirBuild (Settings → Apple Developer). | 团队拥有者没有关联任何 Apple 开发者账户 | 请团队拥有者关联一个（在 App 中：**设置** › **开发者**） |
| None of this Team's Apple teams is connected yet. The Team's owner finishes connecting it in AirBuild. | 拥有者有 Apple 团队，但没有一个已开启并就绪 | 请团队拥有者完成连接 |
| This Team works with several Apple teams; pass appleTeamId: _name_ = _id_, …. | 连接了多个 Apple 团队，但没有发送 `appleTeamId` | 发送 `appleTeamId`，取句中列出的某个 ID |
| That Apple team is not one of this Team's. See appstore_list_apple_teams. | `appleTeamId` 不是该团队的 Apple 团队 | 从 [appstore_list_apple_teams](https://air.build/cn/docs/mcp-tools/appstore_list_apple_teams/) 获取 |
| This Project has not been built for iOS yet, so it has no bundle id to find its app by. Ask the Team's Agent to build it, or pass appId. | 该项目从未构建过 iOS 版本 | 请项目的智能体构建一个 iOS 版本（[send_message](https://air.build/cn/docs/mcp-tools/send_message/)），或用 `appId` 指定 App |
| This Project has no app on App Store Connect yet. Create one with appstore_create_app (its bundle id is the Project's), or pass appId. | 团队已连接的 Apple 团队中没有 App 的 bundle ID 与项目相同，或没有连接任何 Apple 团队 | 用 [appstore_create_app](https://air.build/cn/docs/mcp-tools/appstore_create_app/) 创建 App，或用 `appId` 指定另一个 App |
| No connected Apple team of this Team has that app. See appstore_list_apps. | `appId` 不是任何已连接 Apple 团队（或 `appleTeamId`）中的 App | 从 [appstore_list_apps](https://air.build/cn/docs/mcp-tools/appstore_list_apps/) 获取 ID |
| The Team owner's Apple sign-in has lapsed and only they can renew it: ask them to open AirBuild and sign in to Apple again, then try once more. | 团队拥有者在 AirBuild 中的 Apple 登录已过期，没有拥有者参与 AirBuild 无法续期 | 告诉团队拥有者，请对方在 AirBuild 中重新登录（见 [关联你的 Apple 开发者账户](https://air.build/cn/docs/app-store/connect-apple-developer-account/)）。在此之前重试会得到同样的回答 |
| App Store Connect: _Apple's sentence_ | Apple 拒绝了请求。后面最多附上 Apple 自己的五句话，Apple 指明相关字段时会在括号中注明。App Store Connect 中有待接受的 Apple 协议时，也会这样被拒绝 | 按 Apple 的说明处理。协议由 Apple Developer 账户的账户持有人在 App Store Connect 中接受（商务 › 协议） |
| App Store Connect answered _status_. Try again in a moment. | Apple 拒绝了，但没有说明原因 | 稍后再试 |

## 示例

```json
{
  "name": "appstore_sales",
  "arguments": {
    "teamId": "00000000-0000-0000-0000-000000000000",
    "projectId": "00000000-0000-0000-0000-000000000000",
    "days": 7
  }
}
```
