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

# Retrieve Volume Metrics

> Retrieve volume metrics for messages sent from your account,
including counts of processed, delivered and dropped events.
Supports optional filters for time range and campaign ID.




## OpenAPI

````yaml /email-api/api-reference/openapi.yaml get /metrics/volume
openapi: 3.0.0
info:
  contact:
    email: support@mailchannels.com
    name: MailChannels Corporation
  description: >
    This is the API reference for Email API. Here, you'll find more detailed
    information on every endpoint, including parameters, response formats, and
    error codes.
  title: Email API
  version: 1.4.0
servers:
  - url: https://api.mailchannels.net/tx/v1
security: []
tags:
  - name: Send
  - name: DKIM
  - name: Metrics
  - name: Sub-accounts
  - name: Suppression
  - name: Webhooks
  - name: Usage
  - name: Custom Tracking
paths:
  /metrics/volume:
    get:
      tags:
        - Metrics
      summary: Retrieve Volume Metrics
      description: |
        Retrieve volume metrics for messages sent from your account,
        including counts of processed, delivered and dropped events.
        Supports optional filters for time range and campaign ID.
      parameters:
        - description: >
            The beginning of the time range for retrieving message volume
            metrics (inclusive).

            Formats: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ.

            Defaults to one month ago if not provided.
          example: '2025-05-26'
          in: query
          name: start_time
          required: false
          schema:
            type: string
        - description: >
            The end of the time range for retrieving message volume metrics
            (exclusive).

            Formats: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ.

            Defaults to the current time if not provided.
          example: '2025-05-31T15:16:17Z'
          in: query
          name: end_time
          required: false
          schema:
            type: string
        - description: |
            The ID of the campaign to filter metrics by.
            If not provided, metrics for all campaigns will be returned.
          in: query
          name: campaign_id
          required: false
          schema:
            type: string
        - description: |
            The interval for aggregating metrics data. Allowed values:
              - hour: Hourly breakdown
              - day: Daily breakdown (default)
              - week: Weekly breakdown
              - month: Monthly breakdown
          in: query
          name: interval
          required: false
          schema:
            default: day
            enum:
              - hour
              - day
              - week
              - month
            type: string
        - in: header
          name: X-Api-Key
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricsVolume'
          description: |
            Successfully retrieved volume metrics
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '500':
          description: Internal Server Error
      x-codeSamples:
        - label: Node.js
          lang: javascript
          source: >-
            import { MailChannels } from "mailchannels-sdk";


            const { MAILCHANNELS_API_KEY } = process.env;

            if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY
            before running");


            const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);


            const { data, error } = await mailchannels.metrics.volume({
              startTime: "2026-01-01T00:00:00Z",
              endTime: "2026-01-07T23:59:59Z",
            });


            if (error) {
              console.error("Get volume metrics failed:", error);
              process.exit(1);
            }

            console.log(data);
        - label: Python
          lang: python
          source: >-
            import os

            import sys


            import mailchannels


            if not os.environ.get("MAILCHANNELS_API_KEY"):
                sys.exit("Set MAILCHANNELS_API_KEY before running")

            # Retrieve processed, delivered, and dropped counts for the first
            week of January 2026.

            response = mailchannels.Metrics.volume(
                start_time="2026-01-01T00:00:00Z",
                end_time="2026-01-07T23:59:59Z",
            )


            print(response)
        - label: PHP
          lang: php
          source: >-
            <?php


            require_once __DIR__ . '/vendor/autoload.php';


            use MailChannels\Client;


            $api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error:
            MAILCHANNELS_API_KEY is not set\n");


            $client = new Client(apiKey: $api_key);


            // Retrieve processed, delivered, and dropped counts for the first
            week of January 2026.

            $response = $client->metrics->volume(
                startTime: '2026-01-01T00:00:00Z',
                endTime:   '2026-01-07T23:59:59Z',
            );


            print_r($response->toArray());
components:
  schemas:
    MetricsVolume:
      properties:
        buckets:
          description: >-
            A series of metrics aggregations bucketed by time interval (e.g.
            hour, day)
          properties:
            delivered:
              items:
                $ref: '#/components/schemas/MetricsBucket'
              type: array
            dropped:
              items:
                $ref: '#/components/schemas/MetricsBucket'
              type: array
            processed:
              items:
                $ref: '#/components/schemas/MetricsBucket'
              type: array
          required:
            - processed
            - delivered
            - dropped
          type: object
        delivered:
          description: |
            Count of messages delivered during the specified time range.
          minimum: 0
          type: integer
        dropped:
          description: |
            Count of messages dropped during the specified time range.
          minimum: 0
          type: integer
        end_time:
          description: >
            The end of the time range for retrieving message volume metrics
            (exclusive).
          format: date-time
          type: string
        processed:
          description: |
            Count of messages processed during the specified time range.
          minimum: 0
          type: integer
        start_time:
          description: >
            The beginning of the time range for retrieving message volume
            metrics (inclusive).
          format: date-time
          type: string
      required:
        - processed
        - delivered
        - dropped
        - buckets
      type: object
    ErrorResponse:
      properties:
        errors:
          description: >
            This is an array error objects that provide machine and human
            readable descriptions of the errors.
          items:
            type: string
          type: array
      type: object
    MetricsBucket:
      description: >
        Represents a time-based bucket for aggregating metrics data.

        Each bucket corresponds to a specific time interval, with the
        `period_start` indicating the beginning of that interval.

        The `count` field represents the number of events or occurrences that
        fall within that time period.
      properties:
        count:
          description: >-
            The number of events or occurrences aggregated within this time
            period.
          minimum: 0
          type: integer
        period_start:
          description: >-
            The starting date and time of the time period this bucket
            represents.
          format: date-time
          type: string
      required:
        - period_start
        - count
      type: object

````