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

# Audience बनाएँ

> अपनी customer list या website visitors की Reddit custom audience बनाएँ, ताकि पोस्ट boost करते समय उसे शामिल या बाहर कर सकें।

Reddit ad account पर custom audience बनाएँ। दो प्रकार समर्थित हैं, जिन्हें `type` से चुना जाता है:

<ul>
  <li>`customerList`: लोगों की आपकी अपनी सूची, जिसे आप [Audience Members](https://www.ayrshare.com/docs/apis/ads/reddit/audience-members.md) के ज़रिए hashed identifiers से भरते हैं।</li>
  <li>`website`: वे लोग जिन्हें आपके Reddit pixel ने आपकी साइट पर देखा।</li>
</ul>

नई audience `audience` के अंतर्गत उसी रूप में लौटाई जाती है जैसी [Audiences](https://www.ayrshare.com/docs/apis/ads/reddit/get-audiences.md) में, `status.ready: false` के साथ। Reddit समय के साथ उसे भरता है। यह देखने के लिए उसे सूचीबद्ध करें कि `status.ready` कब `true` होता है, फिर जब आप [कोई पोस्ट boost करें](https://www.ayrshare.com/docs/apis/ads/reddit/boost-post.md#audiences), तो उसका `id` `targeting.audiences` या `targeting.excludedAudiences` में उपयोग करें।

<ul>
  <li>Reddit यहाँ engagement या lookalike audiences नहीं बना सकता। `type: engagement` या `type: lookalike` भेजने पर `code: 101` वाला `400` लौटाया जाता है।</li>
  <li>किसी boost द्वारा target किए जाने से पहले audience में कम से कम 1,000 matched लोग होने चाहिए।</li>
</ul>

## हैडर पैरामीटर

**Authorization** `string` *required*

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

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## बॉडी पैरामीटर

दोनों types ये लेते हैं:

**accountId** `string` *required*

आपके Reddit ad account की ID, उदाहरण के लिए `a2_abc123`।

**name** `string` *required*

Reddit Ads Manager में दिखने वाला नाम।

**type** `string` *required*

`customerList` या `website`। हर type सिर्फ़ नीचे दिए अपने fields लेता है। किसी दूसरे type का field उसके नाम के साथ `code: 101` वाला `400` लौटाता है।

**idempotencyKey** `string`

हर नई audience के लिए एक नया unique मान, जैसे UUID। अगर आप उसी key से request दोहराते हैं, तो Ayrshare पहला response लौटाता है, `idempotentReplayed: true` से चिह्नित, और दूसरी audience नहीं बनाता। आप key को इसके बजाय `Idempotency-Key` header में भी भेज सकते हैं; अगर दोनों भेजते हैं, तो वे मेल खाने चाहिए। किसी अलग request के साथ, या जब पहला request अभी चल रहा हो, key दोबारा उपयोग करने पर `409` मिलता है। `503` का मतलब है कि key reserve नहीं हो सकी और कुछ भी नहीं बना: उसी key से बाद में फिर कोशिश करें।

### Customer-list audiences

Customer list कोई अन्य required field नहीं लेती और खाली शुरू होती है। [Audience Members](https://www.ayrshare.com/docs/apis/ads/reddit/audience-members.md) से लोग जोड़ें। Hashed identifiers फिर भी personal data हैं: सूची upload करने से पहले वह पेज पढ़ें।

Reddit पर `customerFileSource` तभी स्वीकार किया जाता है जब वह `USER_PROVIDED_ONLY` हो: Reddit सिर्फ़ आपकी अपनी सूचियाँ लेता है।

### Website audiences

**pixelId** `string` *required*

आपकी Reddit pixel ID, Reddit Ads Events Manager से।

**retentionDays** `number` *required*

किसी विज़िटर के आख़िरी visit के बाद वह कितने दिन audience में रहता है, 1 से 90।

**event** `string`

सिर्फ़ उन विज़िटर को रखें जिन्होंने यह event trigger किया। Reddit के standard events `PAGE_VISIT`, `VIEW_CONTENT`, `SEARCH`, `ADD_TO_CART`, `ADD_TO_WISHLIST`, `PURCHASE`, `LEAD` और `SIGN_UP` हैं, किसी भी letter case में। कोई भी अन्य मान custom event के नाम के रूप में भेजा जाता है। हर visit गिनने के लिए इसे छोड़ दें।

Reddit पर `urlContains` स्वीकार नहीं किया जाता: Reddit की website audience में कोई URL filter नहीं होता।

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/reddit/audiences \
-d '{"accountId": "a2_abcdefg", "name": "Site visitors 30d", "type": "website", "pixelId": "t2_pixel123", "retentionDays": 30, "event": "purchase"}'
```

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

fetch("https://api.ayrshare.com/api/ads/reddit/audiences", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${API_KEY}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
    "accountId": "a2_abcdefg",
    "name": "Site visitors 30d",
    "type": "website",
    "pixelId": "t2_pixel123",
    "retentionDays": 30,
    "event": "purchase"
  })
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

```python Python theme={"system"}
import requests

headers = {'Authorization': 'Bearer API_KEY', 'Content-Type': 'application/json'}
payload = {
  "accountId": "a2_abcdefg",
  "name": "Site visitors 30d",
  "type": "website",
  "pixelId": "t2_pixel123",
  "retentionDays": 30,
  "event": "purchase"
}

r = requests.post('https://api.ayrshare.com/api/ads/reddit/audiences', json=payload, headers=headers)

print(r.json())
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "audience": {
    "id": "ca.129482487242999",
    "name": "Site visitors 30d",
    "type": "website",
    "size": null,
    "status": { "ready": false, "code": null, "description": "PENDING" },
    "created": "2026-12-02T10:05:00.000Z"
  }
}
```

```json 400: Lookback over 90 days theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 101,
  "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
  "details": "retentionDays on reddit is at most 90."
}
```

```json 400: Reddit refused the request theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 101,
  "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
  "details": "Reddit's reason"
}
```

```json 400: Reddit failed the request theme={"system"}
{
  "action": "ads",
  "status": "error",
  "code": 369,
  "message": "Unable to create the audience. Please try again.",
  "details": "Reddit's reason"
}
```


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