# appstore_sales

> 從 Apple 的銷售報告中讀取一個 App 或整個 Apple 團隊的下載量、重新下載量、更新量、App 內購買和收益。

Source: https://air.build/tw/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/tw/docs/mcp-tools/server/#transport)）。

| 唯讀 | 破壞性 | 冪等 |
| --- | --- | --- |
| 是 | 否 | 是 |

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字串（UUID） | yes | — | 團隊，來自 [list_teams](https://air.build/tw/docs/mcp-tools/list_teams/)。 |
| `projectId` | 字串（UUID） | no | — | 一個 App：該專案的 App，來自 [list_projects](https://air.build/tw/docs/mcp-tools/list_projects/)。 |
| `appId` | string | no | — | 一個 App，以來自 [appstore_list_apps](https://air.build/tw/docs/mcp-tools/appstore_list_apps/) 的 App Store Connect ID 指定。 |
| `appleTeamId` | 字串（UUID） | 連結多個 Apple 團隊且沒有指定 App 時必填 | 唯一已連結的那一個 | Apple 團隊，來自 [appstore_list_apple_teams](https://air.build/tw/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/tw/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/tw/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/tw/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 版本 | 請專案的 Agent 建置 iOS 版本（[send_message](https://air.build/tw/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/tw/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/tw/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/tw/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
  }
}
```
