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

# Get Connected Org Stats

> Aggregate statistics for a connected org, computed from its latest completed scan: repository and dependency counts plus artifact orphan/consumption breakdowns.



## OpenAPI

````yaml /openapi.json get /api/v1/connected-orgs/{connected_org_id}/stats
openapi: 3.1.0
info:
  description: Change Impact Engine for multi-repo systems
  title: Riftmap
  version: 1.12.3
servers: []
security: []
paths:
  /api/v1/connected-orgs/{connected_org_id}/stats:
    get:
      tags:
        - connected-orgs
      summary: Get Connected Org Stats
      description: >-
        Aggregate statistics for a connected org, computed from its latest
        completed scan: repository and dependency counts plus artifact
        orphan/consumption breakdowns.
      operationId: >-
        get_connected_org_stats_api_v1_connected_orgs__connected_org_id__stats_get
      parameters:
        - in: path
          name: connected_org_id
          required: true
          schema:
            format: uuid
            title: Connected Org Id
            type: string
        - in: header
          name: X-Workspace-Id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Workspace-Id
        - in: cookie
          name: riftmap_access
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Riftmap Access
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrgStats'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    OrgStats:
      description: >-
        Per-connected-org stats payload (scoped to one connected org).


        Artifact-count semantics (every count is a raw artifact-row count — no

        canonical-name dedup — so all surfaces agree). Consumption is computed
        by the

        single source of truth ``src/graph/artifact_stats.py`` (the type-matched

        union), so an artifact's orphan status here always matches its
        ``is_orphan``

        on ``GET /connected-orgs/{id}/artifacts``:

          - ``total_artifact_rows`` — every artifact row the org produces (matches the
            ``X-Total-Count`` header of ``GET /connected-orgs/{id}/artifacts``).
          - ``orphan_artifact_count`` — rows with **zero** consumers
            (``consumer_count == 0``). Equals the count of ``is_orphan==true`` rows on
            the artifacts endpoint and the Artifacts page "Hide orphans (N)" toggle.
          - ``consumed_artifact_count`` — rows with **at least one** consumer
            (``== total_artifact_rows - orphan_artifact_count``).
          - ``artifact_type_breakdown`` — count of **all** artifact rows grouped by
            ``artifact_type`` (includes every type present; never drops one).
            Invariant: ``sum(artifact_type_breakdown.values()) == total_artifact_rows``.
      properties:
        artifact_type_breakdown:
          additionalProperties:
            type: integer
          title: Artifact Type Breakdown
          type: object
        consumed_artifact_count:
          title: Consumed Artifact Count
          type: integer
        dependency_type_breakdown:
          additionalProperties:
            type: integer
          title: Dependency Type Breakdown
          type: object
        health:
          $ref: '#/components/schemas/HealthSummary'
        last_scan:
          anyOf:
            - $ref: '#/components/schemas/LastScanSummary'
            - type: 'null'
        orphan_artifact_count:
          title: Orphan Artifact Count
          type: integer
        total_artifact_rows:
          title: Total Artifact Rows
          type: integer
        total_dependencies:
          title: Total Dependencies
          type: integer
        total_repositories:
          title: Total Repositories
          type: integer
      required:
        - total_repositories
        - total_dependencies
        - consumed_artifact_count
        - orphan_artifact_count
        - total_artifact_rows
        - dependency_type_breakdown
        - artifact_type_breakdown
        - last_scan
        - health
      title: OrgStats
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    HealthSummary:
      description: Aggregate health indicators.
      properties:
        consumers_lagging:
          title: Consumers Lagging
          type: integer
        consumers_on_latest:
          title: Consumers On Latest
          type: integer
        unresolved_declarations:
          title: Unresolved Declarations
          type: integer
      required:
        - consumers_on_latest
        - consumers_lagging
        - unresolved_declarations
      title: HealthSummary
      type: object
    LastScanSummary:
      description: Summary of the most recent scan.
      properties:
        completed_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Completed At
        errors:
          title: Errors
          type: integer
        id:
          format: uuid
          title: Id
          type: string
        repos_scanned:
          title: Repos Scanned
          type: integer
        status:
          title: Status
          type: string
      required:
        - id
        - status
        - completed_at
        - repos_scanned
        - errors
      title: LastScanSummary
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-API-Key
      type: apiKey
    HTTPBearer:
      description: API key as Bearer token (rfm_live_... prefix)
      scheme: bearer
      type: http

````