> ## 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 的方式是[在 header 中添加 Profile Key](/apis/overview#profile-key-format)。
</Info>

User Profile 是 Ayrshare 的核心概念之一,可让你创建并管理多个用户。你平台上的每个用户都会拥有一个或多个 Ayrshare User Profile。每个 User Profile 可以与每个受支持的社交网络建立一个连接。

## Profile Key

许多端点(例如 /user、/analytics 或 /delete)都可以通过在 header 中[添加 "Profile-Key" 参数](/apis/overview#profile-key-format)以某个 Profile 账户的身份进行调用。

例如,可以调用 /delete 端点,针对给定的 *post* *id* 并使用所提供的 *Profile Key*,删除某个 Profile 账户的帖子。

```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 时管理其社交账户访问权限。</li>
</ul>

请注意,在控制台中通过全局设置禁用的社交网络会覆盖 User Profile 的设置。

例如,如果你在控制台中禁用了 TikTok 访问,那么任何 User Profile 都无法访问 TikTok。反之,如果你在控制台中启用了 TikTok 访问,但为某个特定的 User Profile 禁用它,那么除该 User Profile 外,其余所有 User Profile 都能访问 TikTok。

## 获取已关联的社交账户

使用 [/profiles 端点](/apis/profiles/get-profiles)或 [/user 端点](/apis/user/profile-details)获取某个 User Profile 已关联的社交账户。

## 向某个 User Profile 发布内容

通过 [/post](/apis/post/post) 端点,你可以通过在 header 中添加 Profile Key 向某个 User Profile 发布内容。返回结果为一个包含帖子或错误结果的数组,并带有整体的 status。如果所有帖子都成功,则为 "success";如果有任何一条失败,则为 "error"。

你可以在使用 [/create-profile](/apis/profiles/create-profile) 端点创建 profile 时获取用户的 Profile Key,或在 Ayrshare 的网页控制台 GUI 中切换到该 profile 并进入 **Profile Key** 页面获取。
