---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://docs.sendcorex.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://docs.sendcorex.com/llms.txt"
---

Source: https://docs.sendcorex.com/vi/api-reference/privacy/reading/get-many

Tùy chọn tracking: Đọc

# Get Many

Tùy chọn của tối đa 100 người nhận trong một lệnh. Dùng ngay trước khi gửi để quyết định track_opens và track_clicks cho từng người nhận.

POST `https://g.sendcorex.com/v1/privacy` command: get_many

Cần phạm vi `privacy:read` trên API key của bạn.

Chỉ những người nhận có tùy chọn mới được trả về. Địa chỉ không có trong câu trả lời chưa từng chọn gì.

## Tham số

- `emails` string[] bắt buộc
1 đến 100 địa chỉ người nhận. Địa chỉ trùng và không hợp lệ bị bỏ qua.
ví dụ `["jane.doe@example.com", "marc.dupont@example.fr", "new.person@example.com"]`

## Bắt đầu nhanh

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/privacy',
  {
    commands: [
      {
        command: "get_many",
        args: {
          emails: [
            "jane.doe@example.com",
            "marc.dupont@example.fr",
            "new.person@example.com"
          ]
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);
```

## Phản hồi

```
{
  "type": "SUCCESS",
  "results": [
    {
      "command": "get_many",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 6,
      "data": {
        "preferences": [
          {
            "email": "jane.doe@example.com",
            "track_opens": false,
            "track_clicks": true,
            "source": "page",
            "updated_at": "2026-10-24T07:20:12.031Z"
          },
          {
            "email": "marc.dupont@example.fr",
            "track_opens": false,
            "track_clicks": false,
            "source": "api",
            "updated_at": "2026-10-24T07:41:55.508Z"
          }
        ]
      }
    }
  ]
}
```

### Trường phản hồi

- `preferences`
Một mục cho mỗi người nhận có tùy chọn.
- `preferences[].email`
Địa chỉ người nhận, viết thường.
- `preferences[].track_opens`
`true` người nhận cho phép theo dõi mở, `false` họ đã từ chối, `null` họ chưa từng chọn.
- `preferences[].track_clicks`
`true` người nhận cho phép theo dõi nhấp, `false` họ đã từ chối, `null` họ chưa từng chọn.
- `preferences[].source`
Ai đã thay đổi: `page` (người nhận, trên trang tùy chọn tracking), `api` (bạn, bằng Set Preferences) hoặc `dashboard`.
- `preferences[].updated_at`
Thời điểm thay đổi. ISO 8601, UTC.

## Trước khi gửi

Đọc cả loạt, rồi gửi cho từng người nhận với tracking họ cho phép. Người nhận chưa có tùy chọn theo mặc định của bạn.

Node.js

```
const [r] = await call({ command: 'get_many', args: { emails: batch.map((x) => x.email) } });
const prefs = new Map(r.data.preferences.map((p) => [p.email, p]));

for (const x of batch) {
  const p = prefs.get(x.email.toLowerCase());
  await send({
    to: x.email,
    unsubscribe: true,
    track_opens: p?.track_opens === true,   // opt-in: only when allowed
    track_clicks: p?.track_clicks === true,
  });
}
```

Bạn không cần làm vậy để tôn trọng việc từ chối: với `"unsubscribe": true`, người nhận đã tắt tracking sẽ không bao giờ bị theo dõi. Việc này dành cho quy tắc opt-in, nơi tracking phải tắt cho tới khi người nhận cho phép.

## Câu trả lời

data

```
{
  "preferences": [
    {
      "email": "jane.doe@example.com",
      "track_opens": false,
      "track_clicks": true,
      "source": "page",
      "updated_at": "2026-10-24T07:20:12.031Z"
    },
    {
      "email": "marc.dupont@example.fr",
      "track_opens": false,
      "track_clicks": false,
      "source": "api",
      "updated_at": "2026-10-24T07:41:55.508Z"
    }
  ]
}
```

## Lỗi

Lỗi ở mức HTTP trả về `type`, `code` và `message`. Lỗi đánh dấu CMD được trả về trong kết quả lệnh, với HTTP 200.

- 401`INVALID_API_KEY`
API key không tồn tại, đã bị thu hồi hoặc bị tắt trong dashboard.
- 429`RATE_LIMITED`
Hơn 15 yêu cầu/giây hoặc 15 yêu cầu đồng thời cho cùng IP + API key. Chờ số giây trong Retry-After.
- CMD`MISSING_SCOPE`
API key không có scope của lệnh này (`privacy:read` để đọc, `privacy:write` để thay đổi).
- CMD`INVALID_ARGS`
Một đối số không hợp lệ: thiếu hoặc sai `email`, hơn 100 `emails`, `track_opens` không phải `true`/`false`, limit ngoài phạm vi…
- CMD`INTERNAL`
Lỗi máy chủ. Chi tiết chỉ được ghi vào log máy chủ.
