> ## Documentation Index
> Fetch the complete documentation index at: https://docs.migma.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Email Metrics

> Aggregate performance for one generated email across every API send of it: delivery, opens, clicks, bounces, complaints, unsubscribes, plus a daily time series and country breakdown. Numbers arrive asynchronously and cover roughly the last 30 days of raw history (aggregates persist longer). Opens are directional — Apple Mail Privacy Protection and bots inflate them; clicks and delivery events are stronger signals. Requires the email:read scope.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/emails/{emailId}/metrics
openapi: 3.1.0
info:
  title: Migma.ai API (v1)
  description: >-
    API for managing brands, contacts, email generation, sending, and
    integrations.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.migma.ai
    description: Production
security:
  - apiKeyAuth: []
tags:
  - name: Projects/Brands
    description: Manage projects (brands) and import from websites
  - name: Contacts
    description: Manage your contacts, segments, tags, and topics
  - name: Segments
    description: Create and manage dynamic contact segments
  - name: Tags
    description: Organize contacts with tags
  - name: Topics
    description: Manage subscription topics and preferences
  - name: Emails
    description: Generate, send, and export emails
  - name: Email Validation
    description: Validate email content for compatibility and deliverability
  - name: Email Previews
    description: Preview emails across devices and email clients
  - name: Domains
    description: Manage sending domains and verification
  - name: Webhooks
    description: Manage webhook endpoints for real-time event notifications
  - name: Integrations
    description: Third-party platform integrations
  - name: Campaigns
    description: Create, schedule, send, and manage email campaigns
  - name: Project Editing
    description: Edit project assets, logos, images, and knowledge base entries
paths:
  /v1/emails/{emailId}/metrics:
    get:
      tags:
        - Emails
      summary: Get Email Metrics
      description: >-
        Aggregate performance for one generated email across every API send of
        it: delivery, opens, clicks, bounces, complaints, unsubscribes, plus a
        daily time series and country breakdown. Numbers arrive asynchronously
        and cover roughly the last 30 days of raw history (aggregates persist
        longer). Opens are directional — Apple Mail Privacy Protection and bots
        inflate them; clicks and delivery events are stronger signals. Requires
        the email:read scope.
      operationId: GetEmailMetrics
      parameters:
        - name: emailId
          in: path
          description: Email ID returned in generation status result.emails[].emailId.
          required: true
          schema:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
      responses:
        '200':
          description: Email metrics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseEmailMetrics'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      x-codeSamples:
        - lang: javascript
          label: Node.js SDK
          source: |-
            import Migma from 'migma';

            const migma = new Migma('YOUR_API_KEY');

            const { data } = await migma.emails.metrics('EMAIL_ID');
            console.log(data.summary);
components:
  schemas:
    ApiResponseEmailMetrics:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/EmailMetrics'
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          nullable: true
        error:
          type: string
          nullable: true
      required:
        - success
    EmailMetrics:
      type: object
      description: >-
        Aggregate performance for one generated email across every API send of
        it. Sourced from the tracking worker, so values may be slightly stale
        and cover roughly the last 30 days of raw send history (aggregates
        persist longer). Opens are directional: Apple Mail Privacy Protection
        and bots inflate them; clicks and delivery events are stronger signals.
      properties:
        summary:
          type: object
          properties:
            totalEmails:
              type: integer
            delivered:
              type: integer
            opened:
              type: integer
            clicked:
              type: integer
            bounced:
              type: integer
            complained:
              type: integer
            unsubscribed:
              type: integer
            deliveryRate:
              type: number
              description: 0-100.
            openRate:
              type: number
              description: >-
                0-100. Directional — inflated by Apple Mail Privacy Protection
                and bots.
            clickRate:
              type: number
              description: 0-100.
            bounceRate:
              type: number
              description: 0-100.
            complaintRate:
              type: number
              description: 0-100.
            unsubscribeRate:
              type: number
              description: 0-100.
        timeSeries:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
              sent:
                type: integer
              delivered:
                type: integer
              opened:
                type: integer
              clicked:
                type: integer
              bounced:
                type: integer
              complained:
                type: integer
        countryBreakdown:
          type: array
          items:
            type: object
            properties:
              country:
                type: string
              count:
                type: integer
        lastUpdated:
          type: string
          format: date-time
          description: When these stats were last refreshed from the tracking worker.
        cached:
          type: boolean
      required:
        - summary
        - lastUpdated
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: string
        code:
          type: string
          description: >-
            Machine-readable error code (e.g., IDEMPOTENCY_CONFLICT,
            DOMAIN_CLAIMABLE).
        data:
          type: object
          description: >-
            Additional structured context for the error, such as the affected
            domain.
          additionalProperties: true
      required:
        - success
        - error
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: Forbidden - Missing required permissions or access denied
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where
        YOUR_API_KEY is obtained from the Migma dashboard under Settings →
        Developers → API Keys.

````