トラッキング設定:読み取り

Get Many

1つのコマンドで最大100人の受信者の設定を取得します。送信の直前に使い、受信者ごとにtrack_opensとtrack_clicksを決めてください。

POSThttps://g.sendcorex.com/v1/privacycommand: get_many

API keyにprivacy:readスコープが必要です。

返るのは設定を持つ受信者だけです。回答に含まれないアドレスは何も選んでいません。

引数

  • emailsstring[]必須

    1〜100件の受信者アドレス。重複や無効なアドレスは無視されます。

    例: ["jane.doe@example.com", "marc.dupont@example.fr", "new.person@example.com"]

クイックスタート

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);

レスポンス

{
  "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"
          }
        ]
      }
    }
  ]
}

レスポンスの項目

  • preferences

    設定を持つ受信者ごとに1件。

  • preferences[].email

    受信者のアドレス(小文字)。

  • preferences[].track_opens

    trueは開封のトラッキングを許可、falseは拒否、nullは未選択。

  • preferences[].track_clicks

    trueはクリックのトラッキングを許可、falseは拒否、nullは未選択。

  • preferences[].source

    変更した人:page(トラッキング設定のページで受信者が)、api(あなたがSet Preferencesで)、dashboard。

  • preferences[].updated_at

    変更した日時。ISO 8601、UTC。

送信前

まとめて読み取り、各受信者が許可するトラッキングで送信します。設定のない受信者には既定の設定が適用されます。

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,
  });
}

拒否を守るためにこれを行う必要はありません:"unsubscribe": trueなら、トラッキングをオフにした受信者がトラッキングされることはありません。これは、受信者が許可するまでトラッキングをオフにしておく必要があるオプトインのルール向けです。

回答

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"
    }
  ]
}

エラー

HTTPレベルのエラーはtype、code、messageを返します。CMDと表示されたエラーは、HTTP 200でコマンドの結果内に返ります。

  • 401INVALID_API_KEY

    API keyが存在しないか、取り消されたか、ダッシュボードで無効化されています。

  • 429RATE_LIMITED

    同じIP + API keyで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。

  • CMDMISSING_SCOPE

    API keyにこのコマンドのscopeがありません(読み取りは`privacy:read`、変更は`privacy:write`)。

  • CMDINVALID_ARGS

    引数が無効です:`email`がないか形式が不正、`emails`が100件を超える、`true`/`false`でない`track_opens`、範囲外のlimit…

  • CMDINTERNAL

    サーバーエラー。詳細はサーバーのログにのみ記録されます。