# Get email account stats for a date range

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /account/email-stats:
    get:
      summary: Get email account stats for a date range
      deprecated: false
      description: >+
        Returns aggregated email account statistics for the given workspace

        and date range, broken down per day in the `chart` array and

        summed up in the `header` object.


        ### Filters


        All filters are optional and combinable. A request with no filters

        (only `workspace_id` + dates) returns stats for **every** sending

        mailbox in the workspace.


        - `email_acc_id` — restrict to a single sending mailbox by its unique
        identifier. Useful for per-mailbox statistics.

        - `provider` — comma-separated list of sender provider types.
          Allowed values: `GOOGLE_WORKSPACE`, `MICROSOFT365`,
          `REGULAR_ACCOUNT` (i.e. SMTP/IMAP). 
        - `tags` — comma-separated list of tag ObjectIds assigned to email
        accounts. Example: `tags=66f0a1...,66f0a2...`.

        - `recp_provider` — comma-separated list of recipient provider types
        (the provider of the address being mailed *to*). Same allowed values as
        `provider`.

      operationId: getEmailAccountStats
      tags:
        - Email Account
        - Email Account Stats
      parameters:
        - name: workspace_id
          in: query
          description: |
            The unique identifier of the workspace
          required: true
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
            examples:
              - 6509f7691205283f2a79f98c
        - name: start_date
          in: query
          description: |
            Inclusive start of the range, in `YYYY-MM-DD` format
            (UTC). Combined with `00:00:00.000Z` server-side.
          required: true
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
            examples:
              - '2026-03-01'
        - name: end_date
          in: query
          description: |
            Inclusive end of the range, in `YYYY-MM-DD` format (UTC).
            Combined with `23:59:59.999Z` server-side. Must be greater
            than or equal to `start_date`.
          required: true
          schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
            examples:
              - '2026-03-31'
        - name: email_acc_id
          in: query
          description: >
            Restrict stats to a single sending mailbox by its unique identifie.
            When omitted, stats span all mailboxes

            in the workspace.
          required: false
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
            examples:
              - 65a1b2c3d4e5f60718293a4b
        - name: provider
          in: query
          description: |
            Comma-separated list of sender provider types to include.
            Allowed values: `GOOGLE_WORKSPACE`, `MICROSOFT365`,
            `REGULAR_ACCOUNT`. Omit to include all providers.
          required: false
          schema:
            type: string
        - name: tags
          in: query
          description: >
            Comma-separated list of tag Ids. Stats are restricted to email
            accounts that carry at least one of the listed tags.
          required: false
          schema:
            type: string
            examples:
              - 66f0a1b2c3d4e5f607182930,66f0a1b2c3d4e5f607182931
        - name: recp_provider
          in: query
          description: |
            Comma-separated list of recipient provider types. Allowed
            values are the same as `provider`. Useful to look at
            deliverability into Google vs. Microsoft inboxes separately.
          required: false
          schema:
            type: string
            examples:
              - GOOGLE_WORKSPACE
      responses:
        '200':
          description: Aggregated stats for the requested workspace and range.
          content:
            application/json:
              schema:
                type: object
                x-apidog-refs: {}
                x-apidog-orders:
                  - header
                  - chart
                properties:
                  header:
                    type: object
                    x-apidog-refs: {}
                    x-apidog-orders:
                      - total_sent_count
                      - total_reply_count
                      - total_ooo_reply_count
                      - total_open_count
                      - total_bounce_count
                      - total_contacted_count
                      - total_new_lead_contacted_count
                      - total_completed_count
                      - total_pos_reply_count
                      - bounce_rate
                      - open_rate
                      - reply_rate
                      - reply_rate_with_ooo
                      - pos_reply_rate
                    properties:
                      total_sent_count:
                        type: integer
                        description: Total number of emails sent in the range.
                        examples:
                          - 3936
                      total_reply_count:
                        type: integer
                        description: >-
                          Total number of human replies received (excludes
                          out-of-office).
                        examples:
                          - 145
                      total_ooo_reply_count:
                        type: integer
                        description: >-
                          Total number of replies classified as out-of-office /
                          auto-reply.
                        examples:
                          - 3
                      total_open_count:
                        type: integer
                        description: >
                          Total number of opens. Will be `0` for workspaces
                          where

                          open tracking is disabled.
                        examples:
                          - 0
                      total_bounce_count:
                        type: integer
                        description: Total number of bounces in the range.
                        examples:
                          - 31
                      total_contacted_count:
                        type: integer
                        description: |
                          Total number of leads contacted in the range
                        examples:
                          - 1408
                      total_new_lead_contacted_count:
                        type: integer
                        description: |
                          Total number of new leads contacted in the range
                        examples:
                          - 1503
                      total_completed_count:
                        type: integer
                        description: >
                          Total number of leads that completed their sequence in
                          the range.
                        examples:
                          - 1231
                      total_pos_reply_count:
                        type: integer
                        description: >
                          Total number of replies classified as positive
                          sentiment
                        examples:
                          - 101
                      bounce_rate:
                        type: number
                        format: float
                        description: >
                          `total_bounce_count / total_sent_count * 100`, rounded
                          to 1

                          decimal. `0` when `total_sent_count` is 0.
                        examples:
                          - 0.8
                      open_rate:
                        type: number
                        format: float
                        description: >
                          `total_open_count / total_contacted_count* 100`,

                          rounded to 1 decimal. `0` when open tracking is
                          disabled or

                          no recipients were contacted.
                        examples:
                          - 0
                      reply_rate:
                        type: number
                        format: float
                        description: >
                          `total_reply_count / total_contacted_count * 100`,

                          rounded to 1 decimal. Out-of-office replies are
                          excluded.
                        examples:
                          - 9.6
                      reply_rate_with_ooo:
                        type: number
                        format: float
                        description: |
                          `(total_reply_count + total_ooo_reply_count) /
                          total_contacted_count * 100`, rounded to 1 decimal.
                        examples:
                          - 9.8
                      pos_reply_rate:
                        type: number
                        format: float
                        description: >
                          `total_pos_reply_count / total_reply_count * 100`,
                          rounded

                          to 1 decimal. `0` when `total_reply_count` is 0.
                        examples:
                          - 69.7
                    required:
                      - total_sent_count
                      - total_reply_count
                      - total_ooo_reply_count
                      - total_open_count
                      - total_bounce_count
                      - total_contacted_count
                      - total_new_lead_contacted_count
                      - total_completed_count
                      - total_pos_reply_count
                      - bounce_rate
                      - open_rate
                      - reply_rate
                      - reply_rate_with_ooo
                      - pos_reply_rate
                    x-apidog-ignore-properties: []
                  chart:
                    type: array
                    description: |-
                      One entry per day in `[start_date, end_date]`, in
                      chronological order.
                    items:
                      $ref: '#/components/schemas/EmailStatsChartPoint'
                required:
                  - header
                  - chart
                x-apidog-ignore-properties: []
              examples:
                workspaceMonth:
                  summary: Whole workspace, March 2026
                  value:
                    header:
                      total_sent_count: 3936
                      total_reply_count: 145
                      total_ooo_reply_count: 3
                      total_open_count: 0
                      total_bounce_count: 31
                      total_contacted_count: 1408
                      total_completed_count: 1231
                      total_pos_reply_count: 101
                      bounce_rate: 0.8
                      open_rate: 0
                      reply_rate: 9.6
                      reply_rate_with_ooo: 9.8
                      pos_reply_rate: 69.7
                      total_unique_contacted_count: 1503
                    chart:
                      - label: 1 Mar 26
                        date: '2026-03-01'
                        total_sent_count: 49
                        total_reply_count: 1
                        total_ooo_reply_count: 0
                        total_open_count: 0
                        total_bounce_count: 0
                        total_contacted_count: 8
                        total_completed_count: 29
                        total_pos_reply_count: 1
                      - label: 2 Mar 26
                        date: '2026-03-02'
                        total_sent_count: 45
                        total_reply_count: 1
                        total_ooo_reply_count: 0
                        total_open_count: 0
                        total_bounce_count: 0
                        total_contacted_count: 24
                        total_completed_count: 14
                        total_pos_reply_count: 1
                      - label: 3 Mar 26
                        date: '2026-03-03'
                        total_sent_count: 132
                        total_reply_count: 5
                        total_ooo_reply_count: 0
                        total_open_count: 0
                        total_bounce_count: 1
                        total_contacted_count: 51
                        total_completed_count: 40
                        total_pos_reply_count: 4
          headers: {}
          x-apidog-name: ''
        '400':
          description: |
            Validation error — one of the query parameters is missing or
            malformed (e.g. non-hex `workspace_id`, `start_date` not in
            `YYYY-MM-DD` form, `end_date` earlier than `start_date`, or
            an unknown provider value).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              examples:
                badDateRange:
                  summary: end_date before start_date
                  value:
                    message: Validation Error
                    error: Validation Error
                    errors:
                      - >-
                        end_date: End date must be greater than or equal to
                        start date.
                missingWorkspace:
                  summary: Missing workspace_id
                  value:
                    message: Validation Error
                    error: Validation Error
                    errors:
                      - 'workspace_id: "workspace_id" is required'
                userNotFound:
                  summary: API key resolves to no user
                  value:
                    message: PlusVibe User not found.
                    error: PlusVibe User not found.
          headers: {}
          x-apidog-name: ''
        '500':
          description: Unexpected server error while computing stats.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Internal Server Error
                error: Internal Server Error
          headers: {}
          x-apidog-name: ''
      security:
        - ApiKeyAuth: []
          x-apidog:
            schemeGroups:
              - id: uS5KiuC4wfZHK42AzOfA_
                schemeIds:
                  - ApiKeyAuth
            required: true
            use:
              id: uS5KiuC4wfZHK42AzOfA_
            scopes:
              uS5KiuC4wfZHK42AzOfA_:
                ApiKeyAuth: []
      x-apidog-folder: Email Account
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/929054/apis/api-34175055-run
components:
  schemas:
    EmailStatsChartPoint:
      type: object
      description: Per-day counters for a single calendar day in the requested range.
      required:
        - label
        - date
        - total_sent_count
        - total_reply_count
        - total_ooo_reply_count
        - total_open_count
        - total_bounce_count
        - total_contacted_count
        - total_completed_count
        - total_pos_reply_count
      properties:
        label:
          type: string
          description: |
            Human-readable day label in `D MMM YY` format, intended for
            direct display on a chart x-axis.
          examples:
            - 1 Mar 26
        date:
          type: string
          format: date
          description: ISO-8601 calendar day in UTC (`YYYY-MM-DD`).
          examples:
            - '2026-03-01'
        total_sent_count:
          type: integer
          description: Emails sent on this day.
          examples:
            - 49
        total_reply_count:
          type: integer
          description: Human replies received on this day (excludes out-of-office).
          examples:
            - 1
        total_ooo_reply_count:
          type: integer
          description: Out-of-office / auto-replies received on this day.
          examples:
            - 0
        total_open_count:
          type: integer
          description: Email opens on this day. `0` when open tracking is disabled.
          examples:
            - 0
        total_bounce_count:
          type: integer
          description: Bounces on this day.
          examples:
            - 0
        total_contacted_count:
          type: integer
          description: Total leads contacted on this day
          examples:
            - 8
        total_completed_count:
          type: integer
          description: Leads that completed their sequence on this day.
          examples:
            - 29
        total_pos_reply_count:
          type: integer
          description: |
            Replies classified as positive sentiment on this day.
            Subset of `total_reply_count`.
          examples:
            - 1
      x-apidog-orders:
        - label
        - date
        - total_sent_count
        - total_reply_count
        - total_ooo_reply_count
        - total_open_count
        - total_bounce_count
        - total_contacted_count
        - total_completed_count
        - total_pos_reply_count
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ValidationErrorResponse:
      type: object
      description: |
        Returned with HTTP 400 when one or more query parameters fail
        Joi validation. The `errors` array contains one human-readable
        message per failed field.
      required:
        - message
        - error
      properties:
        message:
          type: string
          examples:
            - Validation Error
        error:
          type: string
          examples:
            - Validation Error
        errors:
          type: array
          items:
            type: string
          examples:
            - - >-
                start_date: "start_date" with value "2026/03/01" fails to match
                the required pattern: /^\d{4}-\d{2}-\d{2}$/
      x-apidog-orders:
        - message
        - error
        - errors
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    ErrorResponse:
      type: object
      required:
        - code
        - message
        - data
      properties:
        code:
          type: integer
          enum:
            - 0
        message:
          type: string
        data:
          type: object
          x-apidog-orders: []
          properties: {}
          x-apidog-ignore-properties: []
      x-apidog-orders:
        - code
        - message
        - data
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    ApiKeyAuth:
      type: apikey
      in: header
      name: x-api-key
      description: |
        API key issued in the PlusVibe dashboard. The server reads it
        from the `x-api-key` header and injects it into the request as
        the `api_key` query parameter, which is why you will see
        `api_key` referenced in validation errors.
    apiKey:
      type: apikey
      in: body
      name: api_key
      description: API key passed in request body
servers:
  - url: https://api.plusvibe.ai/api/v1
    description: Prod Env
security:
  - ApiKeyAuth: []
    x-apidog:
      schemeGroups:
        - id: uS5KiuC4wfZHK42AzOfA_
          schemeIds:
            - ApiKeyAuth
      required: true
      use:
        id: uS5KiuC4wfZHK42AzOfA_
      scopes:
        uS5KiuC4wfZHK42AzOfA_:
          ApiKeyAuth: []

```
