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

# Get Workflow Statistics

> Get aggregated statistics for workflow runs.

Optional filtering:
- `configuration_id`: Filter statistics for a specific configuration. If not provided, returns statistics across all workflows.
- `start_date`: Filter runs started after this date (ISO 8601)
- `end_date`: Filter runs started before this date (ISO 8601)



## OpenAPI

````yaml /openapi/em-data-readiness-v2.yaml get /api/data-readiness/workflows/statistics
openapi: 3.1.0
info:
  title: EM Data Readiness Service
  description: Data Readiness Service API for managing workflows, metrics, and data quality
  version: 4.3.0-dev1
servers: []
security:
  - BearerAuth: []
tags:
  - name: Health
    description: Service health monitoring. Check service status and version information.
  - name: Root
    description: Root endpoint providing service information and navigation links.
  - name: Configuration
    description: Service configuration endpoints. View current configuration values.
  - name: Workflows
    description: >-
      Workflow configuration and execution management. Create, configure, and
      run data quality workflows including definitions, configurations, runs,
      and tasks.
  - name: Data Assets
    description: >-
      Data catalog entity management. Manage databases, schemas, and tables
      metadata.
  - name: Metrics
    description: >-
      Data quality metrics and scorecards. Calculate scores, view trends, and
      analyze dimensions.
  - name: Violations
    description: >-
      Data quality violation management. View, acknowledge, and remediate
      detected violations.
  - name: Glossary
    description: >-
      Business glossary management. Create, verify, and organize business terms
      and definitions.
paths:
  /api/data-readiness/workflows/statistics:
    get:
      tags:
        - Workflows
      summary: Get Workflow Statistics
      description: >-
        Get aggregated statistics for workflow runs.


        Optional filtering:

        - `configuration_id`: Filter statistics for a specific configuration. If
        not provided, returns statistics across all workflows.

        - `start_date`: Filter runs started after this date (ISO 8601)

        - `end_date`: Filter runs started before this date (ISO 8601)
      operationId: get_workflow_statistics
      parameters:
        - name: configuration_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            description: >-
              Configuration ID. If not provided, returns statistics for all
              workflows.
            title: Configuration Id
          description: >-
            Configuration ID. If not provided, returns statistics for all
            workflows.
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Start date (ISO 8601)
            title: Start Date
          description: Start date (ISO 8601)
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: End date (ISO 8601)
            title: End Date
          description: End date (ISO 8601)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowStatisticsResponse'
        '404':
          description: Configuration not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    WorkflowStatisticsResponse:
      properties:
        configuration_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Configuration Id
          description: >-
            Workflow configuration ID. None when returning statistics for all
            workflows.
          examples:
            - 123e4567-e89b-12d3-a456-426614174000
        total_runs:
          type: integer
          title: Total Runs
          description: Total number of runs
          examples:
            - 25
        successful_runs:
          type: integer
          title: Successful Runs
          description: Number of successful runs
          examples:
            - 20
        failed_runs:
          type: integer
          title: Failed Runs
          description: Number of failed runs
          examples:
            - 3
        cancelled_runs:
          type: integer
          title: Cancelled Runs
          description: Number of cancelled runs
          examples:
            - 2
        in_progress_runs:
          type: integer
          title: In Progress Runs
          description: Number of runs currently in progress (queued or running)
          examples:
            - 1
        average_duration_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Average Duration Seconds
          description: Average run duration in seconds
          examples:
            - 285.3
        last_run_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Run At
          description: Last run timestamp (ISO 8601)
          examples:
            - '2024-01-15T10:35:00Z'
      type: object
      required:
        - total_runs
        - successful_runs
        - failed_runs
        - cancelled_runs
        - in_progress_runs
      title: WorkflowStatisticsResponse
      description: >-
        Aggregated statistics for workflow runs, optionally filtered by
        configuration.
      example:
        average_duration_seconds: 285.3
        cancelled_runs: 2
        configuration_id: 123e4567-e89b-12d3-a456-426614174000
        failed_runs: 3
        in_progress_runs: 1
        last_run_at: '2024-01-15T10:35:00Z'
        successful_runs: 20
        total_runs: 25
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorInfo'
          description: >-
            Error information object containing code, message, and optional
            details
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: Request ID for debugging and support
          examples:
            - req_abc123xyz
      type: object
      required:
        - error
      title: ErrorResponse
      description: >-
        Standard error response model for API errors.


        Matches the structure returned by _handle_service_error in
        workflows/routes.py.

        The actual API response format is:

        {
            "error": {
                "code": "ERROR_CODE",
                "message": "Error message",
                "details": {...}
            },
            "request_id": "optional-request-id"
        }
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorInfo:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Error code identifier (e.g., 'WORKFLOW_NOT_FOUND',
            'VALIDATION_ERROR')
          examples:
            - WORKFLOW_NOT_FOUND
        message:
          type: string
          title: Message
          description: Human-readable error message
          examples:
            - >-
              Workflow configuration with id
              '123e4567-e89b-12d3-a456-426614174000' not found
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Additional error details as a dictionary (flexible structure for
            business logic errors)
          examples:
            - workflow_id: 123e4567-e89b-12d3-a456-426614174000
      type: object
      required:
        - code
        - message
      title: ErrorInfo
      description: >-
        Nested error information object.


        Note: This model uses an untyped dict for `details` to match the
        flexible error

        structure used throughout the service layer (see WorkflowServiceError
        and similar).

        This is distinct from ErrorDetail, which is used for structured
        validation errors.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Bearer token authentication. Include the token in the Authorization
        header as: `Authorization: Bearer <token>`. The JWT must contain valid
        client_id, and project_id claims for tenant isolation and SDK routing.

````