Contatori: Lettura
Ottieni orari
Ora per ora (UTC), per vedere come sta andando un invio adesso. Sono elencate solo le ore con invii.
https://g.sendcorex.com/v1/counterscommand: get_hourlyRichiede lo scope counters:read sulla tua API key.
Fino a 7 giorni per comando.
Argomenti
fromstringobbligatorioInizio, RFC 3339. L'ora in cui cade è inclusa.
es.
"2026-10-17T00:00:00Z"tostringobbligatorioFine, 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
hourlyUna voce per ogni ora con invii, dalla più vecchia.
hourly[].hourL'inizio dell'ora, RFC 3339 UTC.
hourly[].delivered / bounced / blocked / complaints / rate_limitedI 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.
- 401
INVALID_API_KEYLa API key non esiste, è stata revocata o disattivata nella dashboard.
- 429
RATE_LIMITEDPiù di 15 richieste/s o 15 in corso per la stessa IP + API key. Attendi i secondi indicati in Retry-After.
- CMD
MISSING_SCOPELa API key non ha `counters:read`.
- CMD
INVALID_ARGSUn 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…
- CMD
INTERNALErrore del server. Il dettaglio viene scritto solo nel log del server.