Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

Retrieve Metrics

GET

/

segments

/

metrics

Node.js
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.segments.metrics({
  dimensions: ['segment'],
  metrics: ['all_contacts'],
});
cURL
curl -X GET 'https://api.resend.com/segments/metrics?dimensions=segment&metrics=all_contacts' \
     -H 'Authorization: Bearer re_xxxxxxxxx'
Response
{
  "object": "metrics",
  "metrics": ["all_contacts"],
  "dimensions": ["segment"],
  "totals": {
    "all_contacts": 12450
  },
  "data": [
    {
      "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
      "name": "Registered Users",
      "all_contacts": 4300
    }
  ]
}

Contact counts for your account, optionally broken down by segment. Works across your whole account by default, or scoped to specific segments via segment_id.

All parameters are optional. With none, the response covers your whole account, includes every metric, and returns only totals. There’s no date range, so counts are a point-in-time snapshot rather than a historical window.

Every metric counts contacts, not emails.

Metric Description
all_contacts Every contact. Sum of subscribers and unsubscribers.
subscribers Contacts with unsubscribed set to false.
unsubscribers Contacts with unsubscribed set to true.
Node.js
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.segments.metrics({
  dimensions: ['segment'],
  metrics: ['all_contacts'],
});
cURL
curl -X GET 'https://api.resend.com/segments/metrics?dimensions=segment&metrics=all_contacts' \
     -H 'Authorization: Bearer re_xxxxxxxxx'
JSON
{
  "object": "metrics",
  "metrics": ["all_contacts"],
  "dimensions": ["segment"],
  "totals": {
    "all_contacts": 12450
  },
  "data": [
    {
      "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
      "name": "Registered Users",
      "all_contacts": 4300
    }
  ]
}

Was this page helpful?

⌘I

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu