unsent
unsent.dev
API Reference

Analytics

Retrieve usage data, reputation metrics, and time-series performance data for your emails.

Overview

The Analytics API provides deep insights into your email performance. You can track daily and monthly usage, monitor your sender reputation (bounces, complaints), and analyze time-series data to spot trends over time.

Base URL

https://api.unsent.dev/v1/analytics

Endpoints

Get Usage Stats

Retrieve a high-level overview of your email usage for the current day and month.

Endpoint: GET /analytics

Response Example

{
  "day": [
    {
      "type": "email",
      "sent": 150
    }
  ],
  "month": [
    {
      "type": "email",
      "sent": 4500
    }
  ]
}

Get Reputation Metrics

Monitor your sender reputation. This endpoint aggregates delivery, bounce, and complaint metrics to help you understand your sending health. You can filter by a specific domain or get an aggregate view.

Endpoint: GET /analytics/reputation

Query Parameters

ParamTypeRequiredDescription
domainstringNoFilter reputation metrics by a specific domain (e.g., example.com).

Response Attributes

  • delivered: Total number of emails successfully delivered.
  • hardBounced: Number of emails that hard bounced (permanent failures).
  • complained: Number of spam complaints received.
  • bounceRate: Percentage of sent emails that bounced (hardBounced / delivered * 100).
  • complaintRate: Percentage of delivered emails that received a complaint (complained / delivered * 100).

Response Example

{
  "delivered": 10000,
  "hardBounced": 15,
  "complained": 2,
  "bounceRate": 0.15,
  "complaintRate": 0.02
}

Get Time-Series Data

Get detailed day-by-day performance metrics. This is useful for building charts and analyzing trends over a period of time (7 or 30 days).

Endpoint: GET /analytics/time-series

Query Parameters

ParamTypeRequiredDefaultDescription
daysnumberNo7Number of days to look back. Supports 7 or 30.
domainstringNo-Filter time-series data by a specific domain.

Response Object

The response contains two main objects:

  • result: An array of daily stats (sent, delivered, opened, clicked, bounced, complained).
  • totalCounts: Aggregated totals for the requested period.

Response Example

{
  "result": [
    {
      "date": "Jan 01",
      "sent": 500,
      "delivered": 498,
      "opened": 300,
      "clicked": 150,
      "bounced": 2,
      "complained": 0
    },
    {
      "date": "Jan 02",
      "sent": 600,
      "delivered": 595,
      "opened": 350,
      "clicked": 180,
      "bounced": 5,
      "complained": 1
    }
  ],
  "totalCounts": {
    "sent": 1100,
    "delivered": 1093,
    "opened": 650,
    "clicked": 330,
    "bounced": 7,
    "complained": 1
  }
}

API Reference