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

# 使用指标

> 获取 Enterprise 的使用指标（会话、搜索和 PR）

需要 Enterprise 管理员的个人 API key。

返回在指定时间范围内与你的 Enterprise 相关的使用指标，包括会话次数、搜索次数以及拉取请求 (PR) 数量。

<Note>
  只有 [GitHub app integration](/zh/integrations/gh) 能够提供包含 PR 及其状态的完整统计数据。对于 [GitLab on-premise](/zh/integrations/gitlab) 部署，MR 状态仅每天同步一次，这可能会导致状态在短时间内出现暂时不准确的情况。
</Note>


## OpenAPI

````yaml zh/v2-openapi.yaml GET /v2/enterprise/metrics/usage
openapi: 3.1.0
info:
  description: 供企业管理员使用的 Devin v2 API（个人 API key）
  title: Devin API v2
  version: 2.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v2/enterprise/metrics/usage:
    get:
      tags:
        - metrics
      summary: 企业版使用指标端点
      operationId: enterprise_usage_metrics_endpoint_v2_enterprise_metrics_usage_get
      parameters:
        - in: query
          name: start_date
          required: false
          schema:
            anyOf:
              - format: date-time
                type: string
              - type: 'null'
            title: Start Date
        - in: query
          name: end_date
          required: false
          schema:
            anyOf:
              - format: date-time
                type: string
              - type: 'null'
            title: End Date
        - in: query
          name: start
          required: false
          schema:
            anyOf:
              - format: date-time
                type: string
              - type: 'null'
            title: Start
        - in: query
          name: end
          required: false
          schema:
            anyOf:
              - format: date-time
                type: string
              - type: 'null'
            title: End
        - in: query
          name: org_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Org Ids
        - in: query
          name: user_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: User Ids
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageMetrics'
          description: 成功的响应
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 验证错误
components:
  schemas:
    UsageMetrics:
      properties:
        prs_closed:
          title: Prs Closed
          type: integer
        prs_merged:
          title: Prs Merged
          type: integer
        prs_opened:
          title: Prs Opened
          type: integer
        searches_count:
          title: Searches Count
          type: integer
        sessions_count:
          title: Sessions Count
          type: integer
      required:
        - sessions_count
        - searches_count
        - prs_opened
        - prs_closed
        - prs_merged
      title: UsageMetrics
      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: 仅供 Enterprise 管理员使用的个人 API Key（apk_user_*）
      scheme: bearer
      type: http

````