Kraiter
SDK Reference

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

Parameters

ParameterTypeRequiredDescription
fromstringNoStart date in ISO 8601 format.
tostringNoEnd date in ISO 8601 format. Defaults to now.
limitnumberNoMaximum items to return.
cursorstringNoPagination cursor.

Returns

Promise<TenantMetrics> — aggregate metrics for your organisation.

FieldTypeDescription
totalContactsnumberTotal contacts in your organisation.
totalSendsnumberTotal emails sent.
totalOpensnumberUnique opens tracked.
totalClicksnumberUnique clicks tracked.
activeSequencesnumberNumber 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

ParameterTypeRequiredDescription
fromstringNoStart date in ISO 8601 format.
tostringNoEnd date in ISO 8601 format. Defaults to now.
limitnumberNoMaximum items per page.
cursorstringNoPagination cursor.

Returns

Promise<{ items: SequenceMetrics[]; cursor?: string; hasMore: boolean }> — a paginated list of sequence metrics.

Each SequenceMetrics object contains:

FieldTypeDescription
sequenceIdstringThe sequence ID.
namestringThe sequence name.
totalEnrollednumberTotal contacts enrolled.
totalCompletednumberTotal contacts who completed the sequence.
totalExitednumberTotal contacts who exited early.
totalSendsnumberTotal emails sent by this sequence.
totalOpensnumberUnique opens.
totalClicksnumberUnique 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

ParameterTypeRequiredDescription
sequenceIdstringYesThe sequence ID.
fromstringNoStart date in ISO 8601 format.
tostringNoEnd date in ISO 8601 format. Defaults to now.
limitnumberNoMaximum items to return.
cursorstringNoPagination cursor.

Returns

Promise<SequenceMetrics | null> — the sequence metrics, or null if not found.

Errors

CodeWhen
NOT_FOUNDNo 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

ParameterTypeRequiredDescription
fromstringNoStart date in ISO 8601 format.
tostringNoEnd date in ISO 8601 format. Defaults to now.
limitnumberNoMaximum items per page.
cursorstringNoPagination cursor.

Returns

Promise<{ items: TemplateMetrics[]; cursor?: string; hasMore: boolean }> — a paginated list of template metrics.

Each TemplateMetrics object contains:

FieldTypeDescription
templateIdstringThe template ID.
namestringThe template name.
totalSendsnumberTotal emails sent using this template.
totalOpensnumberUnique opens.
totalClicksnumberUnique clicks.
openRatenumberOpen rate (opens / sends).
clickRatenumberClick 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

ParameterTypeRequiredDescription
templateIdstringYesThe template ID.
fromstringNoStart date in ISO 8601 format.
tostringNoEnd date in ISO 8601 format. Defaults to now.
limitnumberNoMaximum items to return.
cursorstringNoPagination cursor.

Returns

Promise<TemplateMetrics | null> — the template metrics, or null if not found.

Errors

CodeWhen
NOT_FOUNDNo template exists with this ID.