> ## 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.

# Profiles API 概觀

> 建立與管理多個使用者個人檔案（User Profile）。

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

<PlansAvailable plans={["business"]} maxPackRequired={false} />

<Info>
  在 API 呼叫中指定 User Profile 的方式，是[在標頭中加入 Profile Key](/apis/overview#profile-key-format)。
</Info>

User Profile 是 Ayrshare 的核心概念之一，讓你能建立與管理多個使用者。你平台上的每一位使用者，都會擁有一個或多個 Ayrshare User Profile。每個 User Profile 對每個支援的社群網路都可以有一個連線。

## Profile Key

許多端點（例如 /user、/analytics 或 /delete）都可以透過在標頭中[加入「Profile-Key」參數](/apis/overview#profile-key-format)來代表某個 Profile 帳號執行。

舉例來說，/delete 端點可搭配指定的 *Profile Key*，用來刪除該 Profile 帳號中指定 *post* *id* 的貼文。

```javascript theme={"system"}
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
const id = "Post ID";

fetch("https://api.ayrshare.com/api/delete", {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${API_KEY}`
        "Profile-Key": PROFILE_KEY
      },
      body: JSON.stringify({
        id: id
      }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

## 啟用或停用社群網路

你可以在全域層級或 User Profile 層級啟用與停用社群網路。

<ul class="custom-bullets">
  <li>在控制台中[全域管理社群帳號存取權限](/multiple-users/manage-user-profiles#set-social-networks-access)。</li>
  <li>在[建立](/apis/profiles/create-profile)或[更新](/apis/profiles/update-profile) User Profile 時，管理該 Profile 的社群帳號存取權限。</li>
</ul>

需要注意的是，透過控制台在全域設定中停用的社群網路，會覆蓋 User Profile 的設定。

例如，若你在控制台中停用了 TikTok 存取權限，那麼所有 User Profile 都無法使用 TikTok。反之，若你在控制台中啟用 TikTok，但針對某個特定 User Profile 停用它，則除了該特定 Profile 外，所有 User Profile 都能存取 TikTok。

## 取得已連結的社群帳號

使用 [/profiles 端點](/apis/profiles/get-profiles)或 [/user 端點](/apis/user/profile-details)，取得 User Profile 已連結的社群帳號。

## 對某個 User Profile 發文

使用 [/post](/apis/post/post) 端點，你可以在標頭中加入 Profile Key，對指定的 User Profile 發文。回應會是一個貼文結果或錯誤結果的陣列，並帶有整體狀態：若所有貼文都成功，狀態為「success」；若任何一則失敗，狀態為「error」。

你可以在使用 [/create-profile](/apis/profiles/create-profile) 端點建立 Profile 時取得使用者的 Profile Key，或於 Ayrshare 網頁控制台 GUI 中切換到該 Profile，並前往 **Profile Key** 頁面取得。
