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

# コードスキャンメトリクスを取得

> Enterpriseのコードスキャンのメトリクスを取得します

<div id="permissions">
  ## 権限
</div>

Enterprise レベルの `ViewAccountCodeScans` 権限を持つサービスユーザーが必要です。

<div id="time-filters">
  ## 時間フィルター
</div>

このエンドポイントでは、`time_after` と `time_before` のクエリパラメータが必要です。

* `time_after` と `time_before` は、どちらも **秒単位の Unix タイムスタンプ** で、UTC として解釈されます。
* `time_after` は `time_before` より前の時刻である必要があります。
* `time_after` から `time_before` までの時間範囲は、**100 日以内** である必要があります。
* メトリクスは、この時間範囲内に作成されたコードスキャンを対象としています。


## OpenAPI

````yaml ja/v3-openapi.yaml GET /v3/enterprise/code-scans/metrics
openapi: 3.1.0
info:
  description: Service User 認証および RBAC に対応した Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/code-scans/metrics:
    get:
      tags:
        - code-scans
      summary: コードスキャンのメトリクスを取得
      description: >-
        Enterprise アカウントの集計済みコードスキャンメトリクスを取得します。


        指定した期間内に作成されたコードスキャンについて、スキャン、検出結果、および修復用PRのメトリクスを返します。必要に応じて、特定の組織で絞り込めます。
      operationId: handle_get_code_scan_metrics_v3_enterprise_code_scans_metrics_get
      parameters:
        - in: query
          name: time_before
          required: true
          schema:
            title: Time Before
            type: integer
        - in: query
          name: time_after
          required: true
          schema:
            title: Time After
            type: integer
        - in: query
          name: org_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Org Ids
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeScanMetricsResponse'
          description: 成功レスポンス
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: バリデーションエラー
components:
  schemas:
    CodeScanMetricsResponse:
      description: >-
        コードスキャンのメトリクスのレスポンスモデル。


        すべてのメトリクスは、指定した期間内に作成されたコードスキャンを対象としています。検出結果と修復用PRは、それらを生成したスキャンに紐付けられます。
      properties:
        avg_pr_open_duration_seconds:
          anyOf:
            - type: number
            - type: 'null'
          description: >-
            PRがオープン状態にある（またはあった）平均時間（秒）。完了したPRでは作成からマージまたはクローズまで、オープン中のPRでは作成から現在までを指します。PRが1件も作成されていない場合は
            Null。
          title: Avg Pr Open Duration Seconds
        avg_pr_time_to_merge_seconds:
          anyOf:
            - type: number
            - type: 'null'
          description: PRの作成からマージまでの平均時間（秒）。マージ済みのPRが1件もない場合は Null。
          title: Avg Pr Time To Merge Seconds
        open_critical_findings_count:
          description: 重大度がcriticalの未解決の検出結果数。
          title: Open Critical Findings Count
          type: integer
        open_high_findings_count:
          description: 重大度がhighの未解決の検出結果数。
          title: Open High Findings Count
          type: integer
        open_low_findings_count:
          description: 重大度がlowの未解決の検出結果数。
          title: Open Low Findings Count
          type: integer
        open_medium_findings_count:
          description: 重大度がmediumの未解決の検出結果数。
          title: Open Medium Findings Count
          type: integer
        prs_closed_count:
          description: マージされずにクローズされた修復用PRの数。
          title: Prs Closed Count
          type: integer
        prs_created_count:
          description: スキャンの修復セッションによって作成されたPRの数。
          title: Prs Created Count
          type: integer
        prs_merged_count:
          description: マージされた修復用PRの数。
          title: Prs Merged Count
          type: integer
        prs_open_count:
          description: 現在オープン状態の修復用PRの数。
          title: Prs Open Count
          type: integer
        repos_scanned_count:
          description: スキャン対象となった一意のリポジトリ数。
          title: Repos Scanned Count
          type: integer
        scans_count:
          description: 指定した期間内に作成されたコードスキャンの数。
          title: Scans Count
          type: integer
      required:
        - scans_count
        - repos_scanned_count
        - prs_created_count
        - prs_open_count
        - prs_merged_count
        - prs_closed_count
        - avg_pr_time_to_merge_seconds
        - avg_pr_open_duration_seconds
        - open_critical_findings_count
        - open_high_findings_count
        - open_medium_findings_count
        - open_low_findings_count
      title: CodeScanMetricsResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        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:
    bearerAuth:
      description: 'サービスユーザーの認証情報（接頭辞: cog_）'
      scheme: bearer
      type: http

````