> ## 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 बनाएँ

> Snapchat customer list, website या lookalike audience segment बनाएँ, ताकि Ayrshare से Snap boost करते समय उसे शामिल या बाहर कर सकें।

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

<ul>
  <li>`customerList`: लोगों की आपकी अपनी list, जिसे आप [Audience Members](https://www.ayrshare.com/docs/apis/ads/snapchat/audience-members.md) के ज़रिए hashed identifiers से भरते हैं।</li>
  <li>`website`: वे लोग जिनके लिए आपके Snap Pixel ने आपकी site पर कोई event दर्ज किया।</li>
  <li>`lookalike`: आपके बताए देशों के वे लोग जो आपकी किसी customer list के लोगों जैसे हैं।</li>
</ul>

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

<ul>
  <li>जब Snapchat पर्याप्त लोगों को match कर लेता है, तब कोई boost segment को target कर सकता है। तब तक `status.ready` `false` रहता है।</li>
  <li>एक ad account में अधिकतम 1,000 customer lists हो सकती हैं, और segment का नाम अधिकतम 375 characters का होता है। इससे ज़्यादा होने पर Snapchat `code: 369` के साथ मना कर देता है।</li>
  <li>Snapchat यहाँ engagement audiences नहीं बना सकता। `type: engagement` `code: 101` के साथ `400` लौटाता है।</li>
  <li>अगर आप दोबारा प्रयास कर सकते हैं तो `idempotencyKey` भेजें: उसी key और body के साथ दोबारा प्रयास करने पर दूसरा segment बनाने के बजाय पहला response लौटता है।</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`

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

**accountId** `string` *required*

आपके Snapchat ad account का ID जिस पर segment बनाना है, उदाहरण के लिए `5a0d0000-0000-4000-8000-000000000003`।

**name** `string` *required*

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

**type** `string` *required*

`customerList`, `website` या `lookalike`। बाकी fields इसी पर निर्भर करते हैं।

**idempotencyKey** `string`

हर नए segment के लिए एक unique मान, जैसे UUID।

### Customer list

कोई अन्य field नहीं। List खाली शुरू होती है और लोगों को तब तक रखती है जब तक आप उन्हें हटा न दें। `customerFileSource` वैकल्पिक है: Snapchat lists में केवल आपका अपना data होता है, इसलिए `USER_PROVIDED_ONLY` के अलावा कोई भी मान `code: 101` लौटाता है।

### Website

**pixelId** `string` *required*

आपका Snap Pixel id।

**event** `string` *required*

वह pixel event जिसे visitor ने fire किया होना चाहिए, जैसा Snapchat लिखता है: `PAGE_VIEW`, `VIEW_CONTENT`, `ADD_CART`, `START_CHECKOUT`, `PURCHASE`, `SIGN_UP`, `SUBSCRIBE`, `SEARCH`, `ADD_TO_WISHLIST`, `CUSTOM_EVENT_1` से `CUSTOM_EVENT_5` तक, या [Snapchat के pixel events](https://developers.snap.com/marketing-api/Ads-API/audience-creation/website-events) में से कोई और। Snapchat पर आवश्यक।

**retentionDays** `number` *required*

कोई visitor segment में कितने दिन रहता है, 1 से 180 तक।

Snapchat पर `urlContains` समर्थित नहीं है: Snapchat का website segment लोगों को केवल pixel event के आधार पर रखता है, इसलिए यह `code: 101` लौटाता है।

### Lookalike

**seedAudienceId** `string` *required*

वह customer list जिसके जैसे लोग खोजने हैं ([Audiences](https://www.ayrshare.com/docs/apis/ads/snapchat/get-audiences.md) में `type: customerList`)। Snapchat lookalike केवल customer list से बनाता है, इसलिए ऐसा seed जो इस ad account पर आपकी कोई customer list नहीं है (दूसरे प्रकार का segment, किसी दूसरे account का segment, या हटाया गया segment) `code: 101` लौटाता है।

**countries** `array` *required*

वे देश जिनमें लोगों को खोजना है, दो अक्षरों के codes के रूप में, जैसे `US`। हर देश केवल एक बार।

**similarity** `string`

`balance` (डिफ़ॉल्ट) समानता और size को संतुलित करता है, `similarity` seed से सबसे मिलते-जुलते लोगों को रखता है, और `reach` सबसे ज़्यादा लोग खोजता है।

**retentionDays** `number`

कोई व्यक्ति segment में कितने दिन रहता है, 1 से 180 तक। डिफ़ॉल्ट 180 है।

Snapchat lookalike में कोई size percentage नहीं होता: `ratio` और `allowInternationalSeeds` `code: 101` लौटाते हैं।

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-X POST https://api.ayrshare.com/api/ads/snapchat/audiences \
-d '{"accountId": "5a0d1b2c-0000-4000-8000-000000000003", "type": "lookalike", "name": "Like my subscribers", "seedAudienceId": "8c1e2f3a-0000-4000-8000-000000000101", "countries": ["US", "GB"], "similarity": "balance"}'
```

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

fetch("https://api.ayrshare.com/api/ads/snapchat/audiences", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${API_KEY}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        accountId: "5a0d1b2c-0000-4000-8000-000000000003",
        type: "lookalike",
        name: "Like my subscribers",
        seedAudienceId: "8c1e2f3a-0000-4000-8000-000000000101",
        countries: ["US", "GB"],
        similarity: "balance"
      })
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

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

payload = {
    'accountId': '5a0d1b2c-0000-4000-8000-000000000003',
    'type': 'lookalike',
    'name': 'Like my subscribers',
    'seedAudienceId': '8c1e2f3a-0000-4000-8000-000000000101',
    'countries': ['US', 'GB'],
    'similarity': 'balance'
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer API_KEY'}

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

print(r.json())
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "audience": {
    "id": "8c1e2f3a-0000-4000-8000-000000000102",
    "name": "Like my subscribers",
    "type": "lookalike",
    "size": { "lower": 0, "upper": 0 },
    "status": { "ready": false, "code": null, "description": "NOT_READY" },
    "created": "2026-12-02T12:00:00.000Z"
  }
}
```

```json 400: A field Snapchat does not take 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": "ratio is not a recognised field."
}
```

```json 400: Website without an event 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": "event is required on snapchat: one of APP_INSTALL, PURCHASE, ..."
}
```

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


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