---
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/ja/api-reference/counters/reading/get-totals

カウンター：読み取り

# 合計の取得

アカウントが開始以来送信したすべてを1回の呼び出しで。

POST `https://g.sendcorex.com/v1/counters` command: get_totals

API keyにscope `counters:read`が必要です。

## 引数

このエンドポイントに引数はありません。

## クイックスタート

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/counters',
  {
    commands: [
      {
        command: "get_totals"
      }
    ]
  },
  { 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_totals",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "totals": {
          "delivered": 48210,
          "bounced": 612,
          "blocked": 88,
          "complaints": 9,
          "rate_limited": 140,
          "total": 49050,
          "delivered_rate": 98.29,
          "bounce_rate": 1.25,
          "blocked_rate": 0.18,
          "complaint_rate": 0.02,
          "rate_limited_rate": 0.29
        }
      }
    }
  ]
}
```

### レスポンスの項目

- `totals`
アカウント作成以来のカウンター。
- `totals.delivered`
受信側サーバーが受け付けたメール。
- `totals.bounced`
届かなかったメール：受信側サーバーに拒否された、キューで期限切れになった、または送信前に止められたもの。それぞれの理由は「バウンスと苦情」にあります。
- `totals.blocked`
配信時に受信側サーバーがスパム、ポリシー、レピュテーションを理由に拒否したメール。アドレスに問題はなく、問題は送信のほうです（リストの質、量、認証、内容）。
- `totals.complaints`
メールを受け取ったあとにスパムとして報告した受信者：フィードバックループ（Outlook、Yahooなど）と不正利用の報告。これらのメールはすでに配信済みとしてカウントされているため、`total`には含まれません。
- `totals.rate_limited`
受信側サーバーが受け取りを延期し続け、再試行を使い切ったメール。
- `totals.total`
`delivered` + `bounced` + `blocked` + `rate_limited`：結果が出たすべてのメール。
- `totals.delivered_rate / totals.bounce_rate / totals.blocked_rate / totals.complaint_rate / totals.rate_limited_rate`
各カウンターの`total`に対する割合（小数点以下2桁）。`total`が`0`のときは`0`。

## エラー

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

- 401`INVALID_API_KEY`
API keyが存在しないか、取り消されたか、ダッシュボードで無効化されています。
- 429`RATE_LIMITED`
同じIP + API keyで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。
- CMD`MISSING_SCOPE`
API keyに`counters:read`がありません。
- CMD`INTERNAL`
サーバーエラー。詳細はサーバーのログにのみ記録されます。
