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

# 受众成员

> 发送电子邮件或移动广告 ID 的 SHA-256 哈希，向 Reddit 客户名单受众添加或移除人员。

向通过[创建受众](https://www.ayrshare.com/docs/apis/ads/reddit/create-audience.md)创建的客户名单受众（`type: customerList`）添加人员，或将其移除。您以规范化标识符的 SHA-256 哈希形式发送每个人；Reddit 将哈希与账户匹配；原始值永远不会离开您的系统。

`DELETE /ads/reddit/audiences/{id}/users` 接受相同的请求体，改为移除这些人员。

<ul>
  <li>当 Reddit 匹配到至少 1,000 人后，名单即可用于推广。届时[受众](https://www.ayrshare.com/docs/apis/ads/reddit/get-audiences.md)会显示 `status.ready`。</li>
  <li>每个请求最多包含 10,000 行，请求体最大 10 MiB。较大的名单请分多个请求发送。</li>
  <li>如果请求中途失败，失败前已发送的行仍保留在受众中。请重新发送整个请求：添加已在名单中的人员不会产生任何变化。</li>
  <li>ID 必须是 `accountId` 指定的广告账户上的客户名单受众。任何其他 ID 都会返回带有 `code: 101` 的 `400`。</li>
</ul>

## 哈希标识符属于个人数据

根据 GDPR 及类似法律，经过哈希处理的电子邮件或广告 ID 仍属于个人数据。上传名单时：

<ul>
  <li>**您是数据控制者。** 您需要合法依据（通常是名单中人员的同意）才能将他们的数据用于广告，这是您的隐私政策和 Reddit 的广告政策所要求的。</li>
  <li>**Ayrshare 是数据处理者。** 我们将哈希传递给 Reddit，除计数外不保留任何内容：请求体中的任何行都不会被记录、缓存或存储，响应也绝不会回显任何行。</li>
  <li>**您在发送前进行哈希。** Ayrshare 绝不会替您进行哈希。不是哈希的值会在向 Reddit 发送任何内容之前被拒绝。</li>
</ul>

### 如何进行哈希

按照 Reddit 的[客户名单指南](https://ads-api.reddit.com/docs/v3/manage-customer-lists)规范化每个值，然后用 SHA-256 进行哈希，并以 64 个小写十六进制字符发送结果。简而言之：

<ul>
  <li>`EMAIL`：去除空格并转为小写，例如 `jane@example.com`。</li>
  <li>`MADID`：设备的移动广告 ID（Google 的 GAID 或 Apple 的 IDFA）。</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`

## 路径参数

**id** `string` *required*

客户名单受众 ID，来自[创建受众](https://www.ayrshare.com/docs/apis/ads/reddit/create-audience.md)或[受众](https://www.ayrshare.com/docs/apis/ads/reddit/get-audiences.md)。

## 请求体参数

**accountId** `string` *required*

受众所属的 Reddit 广告账户，例如 `a2_abc123`。

**schema** `array` *required*

每列中的标识符，按顺序排列：`EMAIL`、`MADID` 或两者。这些名称与 Facebook 受众使用的名称相同。其他键会返回带有 `code: 101` 的 `400`。

**data** `array` *required*

每人一行：一个数组，每个 `schema` 列对应一个 SHA-256 哈希，以 64 个小写十六进制字符表示。最多 10,000 行。

不是此类哈希的单元格、宽度错误的行或不受支持的键，会在向 Reddit 发送任何内容之前返回带有 `code: 101` 的 `400`。消息会指明行和列，但绝不包含值，例如 `data[1][0] (EMAIL) is not a hash: expected 64 lowercase hex characters.`

## 响应

仅包含计数：

<ul>
  <li>`received`：Reddit 接收的行数。</li>
  <li>`invalid`：在 Reddit 上始终为 `0`。Reddit 不报告无法匹配的行。匹配结果稍后会体现在[受众](https://www.ayrshare.com/docs/apis/ads/reddit/get-audiences.md)中该受众的 `size` 和 `status` 中。</li>
  <li>`batches`：这些行分几次上传发送。Reddit 每次上传接收 2,500 行。</li>
</ul>

```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/ca.129482487242828/users \
-d '{"accountId": "a2_abcdefg", "schema": ["EMAIL"], "data": [["5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"]]}'
```

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

fetch("https://api.ayrshare.com/api/ads/reddit/audiences/ca.129482487242828/users", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${API_KEY}`,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
    "accountId": "a2_abcdefg",
    "schema": [
      "EMAIL"
    ],
    "data": [
      [
        "5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
      ]
    ]
  })
    })
      .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",
  "schema": [
    "EMAIL"
  ],
  "data": [
    [
      "5f4dcc3b5aa765d61d8327deb882cf99b8f0e2e1f6b0d3c0a9b3b2f1e0d9c8b7"
    ]
  ]
}

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

print(r.json())
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "id": "ca.129482487242828",
  "received": 1,
  "invalid": 0,
  "batches": 1
}
```

```json 400: A raw value 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": "data[0][0] (EMAIL) is not a hash: expected 64 lowercase hex characters."
}
```

```json 400: Not a customer list 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": "id ca.129482487242999 is a website audience; members can be added to or removed from a customer-list audience only."
}
```

```json 413: Body over 10 MiB theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 525,
  "message": "The request body is too large. Please reduce the size of the request."
}
```


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