---
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/th/api-reference/counters/reading/get-hourly

ตัวนับ: การอ่าน

# ดูรายชั่วโมง

รายชั่วโมง (UTC) เพื่อดูว่าการส่งเป็นอย่างไรตอนนี้ แสดงเฉพาะชั่วโมงที่มีการส่ง

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

ต้องมี scope `counters:read` ใน API key ของคุณ

สูงสุด 7 วันต่อคำสั่ง

## อาร์กิวเมนต์

- `from` string จำเป็น
เริ่มต้น RFC 3339 รวมชั่วโมงที่เวลานี้อยู่
เช่น `"2026-10-17T00:00:00Z"`
- `to` string จำเป็น
สิ้นสุด RFC 3339 รวมชั่วโมงที่เวลานี้อยู่
เช่น `"2026-10-17T23:59:59Z"`

## เริ่มต้นอย่างรวดเร็ว

```
import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/counters',
  {
    commands: [
      {
        command: "get_hourly",
        args: {
          from: "2026-10-17T00:00:00Z",
          to: "2026-10-17T23:59:59Z"
        }
      }
    ]
  },
  { 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_hourly",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "hourly": [
          {
            "hour": "2026-10-17T06:00:00Z",
            "delivered": 182,
            "bounced": 3,
            "blocked": 1,
            "complaints": 0,
            "rate_limited": 0
          }
        ]
      }
    }
  ]
}
```

### ฟิลด์การตอบกลับ

- `hourly`
หนึ่งรายการต่อชั่วโมงที่มีการส่ง เก่าสุดก่อน
- `hourly[].hour`
เวลาเริ่มของชั่วโมง RFC 3339 UTC
- `hourly[].delivered / bounced / blocked / complaints / rate_limited`
ตัวนับของชั่วโมงนั้น (ไม่มี total หรืออัตรา)

## ข้อผิดพลาด

ข้อผิดพลาดระดับ HTTP ส่งกลับ `type`, `code` และ `message` ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200

- 401`INVALID_API_KEY`
API key ไม่มีอยู่ ถูกเพิกถอน หรือถูกปิดในแดชบอร์ด
- 429`RATE_LIMITED`
เกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + API key เดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD`MISSING_SCOPE`
API key ไม่มี `counters:read`
- CMD`INVALID_ARGS`
อาร์กิวเมนต์ไม่ถูกต้อง: เดือนที่ไม่ใช่ YYYY-MM วันที่ไม่ใช่ YYYY-MM-DD เขตเวลาที่ไม่รู้จัก from อยู่หลัง to ช่วงยาวเกินไป…
- CMD`INTERNAL`
ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์
