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

# Get stats by period

> Get email statistics grouped by time period. Returns counts of emails by status (all, sent, read, unread, archived, unarchived) for each period.



## OpenAPI

````yaml GET /stats/by-period
openapi: 3.1.0
info:
  title: Inbox Zero API
  version: 1.0.0
servers:
  - url: https://www.getinboxzero.com/api/v1
    description: Production server
  - url: http://localhost:3000/api/v1
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /stats/by-period:
    get:
      description: >-
        Get email statistics grouped by time period. Returns counts of emails by
        status (all, sent, read, unread, archived, unarchived) for each period.
      parameters:
        - schema:
            type: string
            enum:
              - day
              - week
              - month
              - year
            default: week
          required: false
          name: period
          in: query
        - schema:
            type: number
            nullable: true
          required: false
          name: fromDate
          in: query
        - schema:
            type: number
            nullable: true
          required: false
          name: toDate
          in: query
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    items:
                      type: object
                      properties:
                        startOfPeriod:
                          type: string
                        All:
                          type: number
                        Sent:
                          type: number
                        Read:
                          type: number
                        Unread:
                          type: number
                        Unarchived:
                          type: number
                        Archived:
                          type: number
                      required:
                        - startOfPeriod
                        - All
                        - Sent
                        - Read
                        - Unread
                        - Unarchived
                        - Archived
                  allCount:
                    type: number
                  inboxCount:
                    type: number
                  readCount:
                    type: number
                  sentCount:
                    type: number
                required:
                  - result
                  - allCount
                  - inboxCount
                  - readCount
                  - sentCount
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: API-Key

````