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

# Daily Stats

> Returns daily breakdowns of key metrics over the specified time range,
suitable for charting and trend analysis.
Requires `analytics:view` permission.




## OpenAPI

````yaml GET /api/analytics/daily
openapi: 3.1.0
info:
  title: Naturalead Analytics API
  version: 1.0.0
  description: |
    API for retrieving analytics and reporting data in the Naturalead platform.
    Provides overview stats, funnel analysis, campaign performance, and daily
    breakdowns. All endpoints require API key authentication
    and are scoped to the caller's account.
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Analytics
    description: Analytics and reporting endpoints
paths:
  /api/analytics/daily:
    get:
      tags:
        - Analytics
      summary: Daily stats
      description: |
        Returns daily breakdowns of key metrics over the specified time range,
        suitable for charting and trend analysis.
        Requires `analytics:view` permission.
      operationId: getDailyStats
      parameters:
        - $ref: '#/components/parameters/Range'
      responses:
        '200':
          description: Daily stats array
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DailyStats'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    Range:
      name: range
      in: query
      required: false
      description: Time range for analytics data
      schema:
        type: string
        enum:
          - 7d
          - 30d
          - 90d
        default: 30d
  schemas:
    DailyStats:
      type: object
      description: Aggregated metrics for a single day.
      properties:
        date:
          type: string
          format: date
          description: The date for this data point (YYYY-MM-DD)
        newLeads:
          type: integer
          description: Leads created on this day
        conversationsStarted:
          type: integer
          description: Conversations started on this day
        messagesExchanged:
          type: integer
          description: Total messages sent and received on this day
        qualified:
          type: integer
          description: Leads qualified on this day
        disqualified:
          type: integer
          description: Leads disqualified on this day
      required:
        - date
        - newLeads
        - conversationsStarted
        - messagesExchanged
        - qualified
        - disqualified
    Error:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  responses:
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Failed to process request
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        API key for programmatic access. Keys use the format `nl_live_<64 hex>`
        or `nl_test_<64 hex>` and are scoped to an account's RBAC permissions.
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        Bearer token using an API key (format: nl_live_* or nl_test_*).

````