import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
const { data, error } = await mailchannels.metrics.volume({
startTime: "2026-01-01T00:00:00Z",
endTime: "2026-01-07T23:59:59Z",
});
if (error) {
console.error("Get volume metrics failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY before running")
# Retrieve processed, delivered, and dropped counts for the first week of January 2026.
response = mailchannels.Metrics.volume(
start_time="2026-01-01T00:00:00Z",
end_time="2026-01-07T23:59:59Z",
)
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$client = new Client(apiKey: $api_key);
// Retrieve processed, delivered, and dropped counts for the first week of January 2026.
$response = $client->metrics->volume(
startTime: '2026-01-01T00:00:00Z',
endTime: '2026-01-07T23:59:59Z',
);
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/metrics/volume \
--header 'X-Api-Key: <x-api-key>'{
"buckets": {
"delivered": [
{
"count": 1,
"period_start": "2023-11-07T05:31:56Z"
}
],
"dropped": [
{
"count": 1,
"period_start": "2023-11-07T05:31:56Z"
}
],
"processed": [
{
"count": 1,
"period_start": "2023-11-07T05:31:56Z"
}
]
},
"delivered": 1,
"dropped": 1,
"processed": 1,
"end_time": "2023-11-07T05:31:56Z",
"start_time": "2023-11-07T05:31:56Z"
}{
"errors": [
"<string>"
]
}Retrieve Volume Metrics
Retrieve volume metrics for messages sent from your account, including counts of processed, delivered and dropped events. Supports optional filters for time range and campaign ID.
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
const { data, error } = await mailchannels.metrics.volume({
startTime: "2026-01-01T00:00:00Z",
endTime: "2026-01-07T23:59:59Z",
});
if (error) {
console.error("Get volume metrics failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY before running")
# Retrieve processed, delivered, and dropped counts for the first week of January 2026.
response = mailchannels.Metrics.volume(
start_time="2026-01-01T00:00:00Z",
end_time="2026-01-07T23:59:59Z",
)
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$client = new Client(apiKey: $api_key);
// Retrieve processed, delivered, and dropped counts for the first week of January 2026.
$response = $client->metrics->volume(
startTime: '2026-01-01T00:00:00Z',
endTime: '2026-01-07T23:59:59Z',
);
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/metrics/volume \
--header 'X-Api-Key: <x-api-key>'{
"buckets": {
"delivered": [
{
"count": 1,
"period_start": "2023-11-07T05:31:56Z"
}
],
"dropped": [
{
"count": 1,
"period_start": "2023-11-07T05:31:56Z"
}
],
"processed": [
{
"count": 1,
"period_start": "2023-11-07T05:31:56Z"
}
]
},
"delivered": 1,
"dropped": 1,
"processed": 1,
"end_time": "2023-11-07T05:31:56Z",
"start_time": "2023-11-07T05:31:56Z"
}{
"errors": [
"<string>"
]
}Headers
Query Parameters
The beginning of the time range for retrieving message volume metrics (inclusive). Formats: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ. Defaults to one month ago if not provided.
The end of the time range for retrieving message volume metrics (exclusive). Formats: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ. Defaults to the current time if not provided.
The ID of the campaign to filter metrics by. If not provided, metrics for all campaigns will be returned.
The interval for aggregating metrics data. Allowed values:
- hour: Hourly breakdown
- day: Daily breakdown (default)
- week: Weekly breakdown
- month: Monthly breakdown
hour, day, week, month Response
Successfully retrieved volume metrics
A series of metrics aggregations bucketed by time interval (e.g. hour, day)
Show child attributes
Show child attributes
Count of messages delivered during the specified time range.
x >= 0Count of messages dropped during the specified time range.
x >= 0Count of messages processed during the specified time range.
x >= 0The end of the time range for retrieving message volume metrics (exclusive).
The beginning of the time range for retrieving message volume metrics (inclusive).
Was this page helpful?

