Metrics
SDK reference for retrieving engagement analytics in Kraiter.
The kraiter.metrics namespace provides methods for querying engagement analytics across your organisation, sequences, and templates.
getTenantMetrics
Returns aggregate metrics for your entire organisation.
const metrics = await kraiter.metrics.getTenantMetrics({
from: '2025-09-01T00:00:00.000Z',
to: '2025-09-30T23:59:59.999Z',
});
console.log(metrics.totalSends); // 12500
console.log(metrics.totalOpens); // 4800
console.log(metrics.activeSequences); // 3Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | No | Start date in ISO 8601 format. |
to | string | No | End date in ISO 8601 format. Defaults to now. |
limit | number | No | Maximum items to return. |
cursor | string | No | Pagination cursor. |
Returns
Promise<TenantMetrics> — aggregate metrics for your organisation.
| Field | Type | Description |
|---|---|---|
totalContacts | number | Total contacts in your organisation. |
totalSends | number | Total emails sent. |
totalOpens | number | Unique opens tracked. |
totalClicks | number | Unique clicks tracked. |
activeSequences | number | Number of currently active sequences. |
listSequenceMetrics
Lists engagement metrics for all sequences.
const result = await kraiter.metrics.listSequenceMetrics({ limit: 10 });
for (const seq of result.items) {
console.log(seq.name, seq.totalSends, seq.totalOpens);
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | No | Start date in ISO 8601 format. |
to | string | No | End date in ISO 8601 format. Defaults to now. |
limit | number | No | Maximum items per page. |
cursor | string | No | Pagination cursor. |
Returns
Promise<{ items: SequenceMetrics[]; cursor?: string; hasMore: boolean }> — a paginated list of sequence metrics.
Each SequenceMetrics object contains:
| Field | Type | Description |
|---|---|---|
sequenceId | string | The sequence ID. |
name | string | The sequence name. |
totalEnrolled | number | Total contacts enrolled. |
totalCompleted | number | Total contacts who completed the sequence. |
totalExited | number | Total contacts who exited early. |
totalSends | number | Total emails sent by this sequence. |
totalOpens | number | Unique opens. |
totalClicks | number | Unique clicks. |
getSequenceMetrics
Retrieves engagement metrics for a single sequence.
const metrics = await kraiter.metrics.getSequenceMetrics('seq_onboarding', {
from: '2025-09-01T00:00:00.000Z',
});
if (metrics) {
console.log(metrics.name, metrics.totalSends, metrics.totalOpens);
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sequenceId | string | Yes | The sequence ID. |
from | string | No | Start date in ISO 8601 format. |
to | string | No | End date in ISO 8601 format. Defaults to now. |
limit | number | No | Maximum items to return. |
cursor | string | No | Pagination cursor. |
Returns
Promise<SequenceMetrics | null> — the sequence metrics, or null if not found.
Errors
| Code | When |
|---|---|
NOT_FOUND | No sequence exists with this ID. |
listTemplateMetrics
Lists engagement metrics for all templates.
const result = await kraiter.metrics.listTemplateMetrics({ limit: 10 });
for (const tmpl of result.items) {
console.log(tmpl.name, tmpl.totalSends, tmpl.openRate);
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | No | Start date in ISO 8601 format. |
to | string | No | End date in ISO 8601 format. Defaults to now. |
limit | number | No | Maximum items per page. |
cursor | string | No | Pagination cursor. |
Returns
Promise<{ items: TemplateMetrics[]; cursor?: string; hasMore: boolean }> — a paginated list of template metrics.
Each TemplateMetrics object contains:
| Field | Type | Description |
|---|---|---|
templateId | string | The template ID. |
name | string | The template name. |
totalSends | number | Total emails sent using this template. |
totalOpens | number | Unique opens. |
totalClicks | number | Unique clicks. |
openRate | number | Open rate (opens / sends). |
clickRate | number | Click rate (clicks / sends). |
getTemplateMetrics
Retrieves engagement metrics for a single template.
const metrics = await kraiter.metrics.getTemplateMetrics('tmpl_welcome', {
from: '2025-09-01T00:00:00.000Z',
});
if (metrics) {
console.log(metrics.name, metrics.openRate, metrics.clickRate);
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
templateId | string | Yes | The template ID. |
from | string | No | Start date in ISO 8601 format. |
to | string | No | End date in ISO 8601 format. Defaults to now. |
limit | number | No | Maximum items to return. |
cursor | string | No | Pagination cursor. |
Returns
Promise<TemplateMetrics | null> — the template metrics, or null if not found.
Errors
| Code | When |
|---|---|
NOT_FOUND | No template exists with this ID. |