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

# Get Tenant Statistics

> Retrieve aggregated email delivery statistics (delivery, bounce, reception counts) for every domain on your tenant. Requires an API key with the domainStats scope.

<Note>
  Please note that domain statistics are available through a different API hostname (stats.sendrapp.org). See the Statistics API documentation for more details.
</Note>

Retrieve email delivery statistics for all domains associated with your tenant. This endpoint provides detailed metrics about email delivery, bounces, and receptions.

### Features

* Real-time email delivery statistics
* Per-domain metrics tracking
* Bounce, delivery, and reception counts
* Last update timestamps
* Total domains count

### Response

Returns `{ client_id, domains, total_domains }`, where `domains` maps each domain name to `{ counts: { bounce, delivery, reception }, lastUpdated }`.

* `200 OK`: Statistics retrieved successfully
* `401 Unauthorized`: Missing/invalid API key, or the key lacks the `domainStats` scope
* `500 Internal Server Error`: Unexpected server error

<Note>
  Authenticate with your API key in the `Authorization` header. The key must have the `domainStats` scope.
</Note>


## OpenAPI

````yaml GET /domain/stats
openapi: 3.1.0
info:
  title: Email Service API
  description: API for sending and managing email communications
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://sending.sendrapp.org
    description: Email Sending API
  - url: https://stats.sendrapp.org
    description: Statistics API
  - url: https://logs.sendrapp.org
    description: Logs API
  - url: http://localhost:3001
    description: Local Development
security:
  - apiKeyAuth: []
paths:
  /domain/stats:
    get:
      summary: Get Email Statistics
      description: >-
        Retrieve aggregated email delivery statistics (delivery, bounce,
        reception counts) for every domain on your tenant. Requires an API key
        with the domainStats scope.
      responses:
        '200':
          description: Statistics retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatsResponse'
        '401':
          description: Missing/invalid API key, or the key lacks the domainStats scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      servers:
        - url: https://stats.sendrapp.org
          description: Statistics API
        - url: http://localhost:3001
          description: Local Development
components:
  schemas:
    StatsResponse:
      type: object
      properties:
        client_id:
          type: string
          description: Client identifier
        domains:
          type: object
          description: Statistics per domain
          additionalProperties:
            type: object
            properties:
              counts:
                type: object
                properties:
                  bounce:
                    type: integer
                    description: Number of bounced emails
                  delivery:
                    type: integer
                    description: Number of delivered emails
                  reception:
                    type: integer
                    description: Number of received emails
              lastUpdated:
                type: string
                format: date-time
                description: Last update timestamp
        total_domains:
          type: integer
          description: Total number of domains
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
          description: Error code
        message:
          type: string
          description: Error message
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````