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

# 為客戶匯入社群帳戶

> 使用 MCP Server 透過 JWT 社群連結 URL，將客戶的社群帳戶匯入到子設定檔（sub-profile）中。

使用 Business 或 Enterprise 方案的整合商可以將客戶的社群帳戶匯入到 **子設定檔（sub-profile）** 之下。透過 [MCP Server](/additional/mcp-action-server)，代理程式會建立一個子設定檔並將其設為目標，然後產生一個單一登入的連結 URL 供客戶開啟以連結其帳戶。

## 流程

<Steps>
  <Step title="建立子設定檔">
    呼叫 `create_profile`（帳戶層級 — 不需要 `profileKey`）。它會回傳新子設定檔的 **profile key**。
  </Step>

  <Step title="將子設定檔設為目標">
    在後續呼叫中使用回傳的 profile key —— 可以透過連線上的 `Profile-Key` 標頭，或是作為單次呼叫的 `profileKey` 參數傳入。有關優先順序請參見 [Connect & Setup](/additional/mcp-action-connect#precedence-argument-wins-over-header)。
  </Step>

  <Step title="產生社群連結 URL">
    呼叫 `generate_jwt_social_linking_url` 以產生一個單一登入的連結 URL。JWT 簽章金鑰和匯入網域都在 **伺服器端** 推導 —— 呼叫端 **不需要** 提供任何 `X-Ayrshare-*` 標頭，也不需要提供私密金鑰或網域。
  </Step>

  <Step title="客戶連結其帳戶">
    客戶開啟該 URL 並對其社群帳戶進行授權（OAuth）。已連線的帳戶會關聯到該子設定檔。
  </Step>
</Steps>

## 前置需求

<Warning>
  `generate_jwt_social_linking_url` **必須** 提供 `profileKey`。如果無法解析出 profileKey，呼叫會回傳 **400**，訊息為 **"Profile Key is required…"**。

  你的帳戶還必須 **已佈建社群連結網域（social-linking domain）**。此功能在 **Business** 與 **Enterprise** 方案中提供。
</Warning>

### 錯誤狀態

| 條件    | 回應                                                                                                             |
| ----- | -------------------------------------------------------------------------------------------------------------- |
| 未佈建網域 | **400** — "No social-linking domain is provisioned for this account (available on Business/Enterprise plans)." |
| 無簽章金鑰 | **400** — "No signing key found for this account's social-linking domain."                                     |

## 後續步驟

<CardGroup cols={2}>
  <Card title="Connect & Setup" icon="plug" href="/additional/mcp-action-connect" horizontal>
    身分驗證與設定檔定位。
  </Card>

  <Card title="工具目錄" icon="list" href="/additional/mcp-action-tools" horizontal>
    按領域分組的 27 個工具，包含適用範圍與用途。
  </Card>
</CardGroup>
