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

# إنشاء تفويضات التعزيز

> اسمح لملف شخصي في حسابك، وهو الدافع، بتعزيز منشورات ملفات شخصية أخرى من حساب الإعلانات الخاص به. أرسل الطلب باستخدام API Key الخاص بـ Primary Profile.

يتيح تفويض التعزيز لملف شخصي واحد في حسابك، وهو الدافع (payer)، تعزيز المنشورات التي نشرتها ملفات شخصية أخرى في حسابك. والدافع هو الملف الشخصي الذي يدفع حساب الإعلانات الخاص به تكلفة الإعلان.

تُدار التفويضات باستخدام API Key الخاص بـ Primary Profile لديك. أرسل الطلب بدون `Profile-Key`.

## معاملات الترويسة

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`

## معاملات الجسم

**owners** `array | string` *required*

ملفات User Profile (ملفات المستخدمين الشخصية) التي يمكن للدافع تعزيز منشوراتها. إما قائمة تضم حتى 1,000 كائن يحتوي كل منها على `refId`، أو `"all"` لكل User Profile موجود في حسابك حاليًا، باستثناء الدافع. لا يمكن أن يكون Primary Profile مالكًا (owner).

يشمل حد الـ 1,000 القيمة `"all"` أيضًا: إذا كان حسابك يضم أكثر من 1,000 User Profile إلى جانب الدافع، يُرفض الطلب بالرمز code 101 ولا يُنشأ أي شيء. أرسل `owners` بدلًا من ذلك في قوائم تضم حتى 1,000 ملف شخصي لكل طلب.

لا تشمل `"all"` الملفات الشخصية التي تنشئها لاحقًا. أرسل الطلب مرة أخرى لإضافتها.

**payer** `object`

الملف الشخصي الذي يدفع، في صورة كائن يحتوي على `refId`. احذفه لاستخدام Primary Profile.

**platforms** `array` *required*

منصات الإعلانات المراد تفويضها، على سبيل المثال `["instagram"]`. لا تُقبل إلا الشبكات التي تدعم [الترويج نيابةً عن الآخرين](https://www.ayrshare.com/docs/apis/ads/delegations/boost-on-behalf.md)؛ وأي شبكة أخرى تُرجع `101`. تحصل على تفويض واحد
لكل مالك ومنصة.

يُشار إلى الملفات الشخصية بقيمة `refId` المُعادة عند [إنشاء ملف شخصي](https://www.ayrshare.com/docs/apis/profiles/create-profile.md) أو [الحصول على الملفات الشخصية](https://www.ayrshare.com/docs/apis/profiles/get-profiles.md).

يحصل كل مالك ومنصة على تفويض خاص به، له `id` خاص. يؤدي إرسال الطلب مرة أخرى إلى إنشاء التفويضات المفقودة فقط، ويُعيد التفويضات الموجودة دون تغيير. باستثناء حالة واحدة: إذا رفض المالك الإذن على الشبكة، تعود قيمة `permission` للتفويض إلى `unknown`، لكي يطلب التعزيز التالي الإذن مجددًا. أرسل الطلب بعد أن يعيد المالك ربط الحساب. ويعود التفويض المُلغى لمالك ومنصة مُدرجين في هذا الطلب نشطًا مرة أخرى بالمعرّف `id` نفسه؛ أما المنصات المُلغاة الأخرى للمالك فتظل مُلغاة.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/delegations \
-d '{"owners": [{"refId": "140b8709bd6ade099b242d895e268fb886130c53"}], "platforms": ["instagram"]}'
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/ads/delegations", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${API_KEY}`
  },
  body: JSON.stringify({
    owners: [{ refId: "140b8709bd6ade099b242d895e268fb886130c53" }],
    platforms: ["instagram"]
  })
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

```json 200 theme={"system"}
{
  "status": "success",
  "delegations": [
    {
      "id": "Kx3v9QpL2mZ7tR1wYb4N",
      "owner": { "refId": "140b8709bd6ade099b242d895e268fb886130c53", "title": "Agent One" },
      "payer": { "refId": "9f1c3e7a2b4d", "title": "Agency" },
      "platform": "instagram",
      "permission": "unknown",
      "status": "active"
    }
  ]
}
```

```json 400 theme={"system"}
{
  "action": "ads",
  "status": "error",
  "code": 400,
  "message": "These owner profiles are not found in this account: 140b8709bd6ade."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.