Contatori: Lettura

Ottieni orari

Ora per ora (UTC), per vedere come sta andando un invio adesso. Sono elencate solo le ore con invii.

POSThttps://g.sendcorex.com/v1/counterscommand: get_hourly

Richiede lo scope counters:read sulla tua API key.

Fino a 7 giorni per comando.

Argomenti

  • fromstringobbligatorio

    Inizio, RFC 3339. L'ora in cui cade è inclusa.

    es. "2026-10-17T00:00:00Z"

  • tostringobbligatorio

    Fine, RFC 3339. L'ora in cui cade è inclusa.

    es. "2026-10-17T23:59:59Z"

Avvio rapido

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

Risposta

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

Campi della risposta

  • hourly

    Una voce per ogni ora con invii, dalla più vecchia.

  • hourly[].hour

    L'inizio dell'ora, RFC 3339 UTC.

  • hourly[].delivered / bounced / blocked / complaints / rate_limited

    I contatori di quell'ora (qui niente total né percentuali).

Errori

Gli errori a livello HTTP restituiscono type, code e message. Gli errori marcati CMD tornano dentro il risultato del comando, con HTTP 200.

  • 401INVALID_API_KEY

    La API key non esiste, è stata revocata o disattivata nella dashboard.

  • 429RATE_LIMITED

    Più di 15 richieste/s o 15 in corso per la stessa IP + API key. Attendi i secondi indicati in Retry-After.

  • CMDMISSING_SCOPE

    La API key non ha `counters:read`.

  • CMDINVALID_ARGS

    Un argomento non è valido: un mese che non è YYYY-MM, un giorno che non è YYYY-MM-DD, un fuso orario sconosciuto, from successivo a to, un intervallo troppo lungo…

  • CMDINTERNAL

    Errore del server. Il dettaglio viene scritto solo nel log del server.