> ## 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.

# Get PR Metrics

> Get aggregated PR metrics for the enterprise account.

Optionally filter by playbook_id to get metrics for PRs from sessions created with a specific playbook.

## Permissions

Requires a service user with the `ViewAccountMetrics` permission at the enterprise level.


## OpenAPI

````yaml v3-openapi.yaml GET /v3/enterprise/metrics/prs
openapi: 3.1.0
info:
  description: Devin v3 API with Service User authentication and RBAC
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/metrics/prs:
    get:
      tags:
        - metrics
      summary: Get PR Metrics
      description: >-
        Get aggregated PR metrics for the enterprise account.


        Optionally filter by playbook_id to get metrics for PRs from sessions
        created with a specific playbook.
      operationId: handle_get_pr_metrics_v3_enterprise_metrics_prs_get
      parameters:
        - in: query
          name: user_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: User Ids
        - in: query
          name: service_user_ids
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Service User Ids
        - 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
        - in: query
          name: playbook_id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Playbook Id
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrMetricsResponse'
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Unprocessable Content
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Too Many Requests
components:
  schemas:
    PrMetricsResponse:
      description: Response model for PR metrics.
      properties:
        prs_closed_count:
          description: PRs Devin authored that were closed without merging.
          title: Prs Closed Count
          type: integer
        prs_created_count:
          description: Total PRs Devin authored across all states (open + merged + closed).
          title: Prs Created Count
          type: integer
        prs_merged_count:
          description: PRs Devin authored that were merged.
          title: Prs Merged Count
          type: integer
        prs_opened_count:
          description: PRs Devin authored that are currently open.
          title: Prs Opened Count
          type: integer
        prs_taken_over_closed_count:
          default: 0
          description: PRs Devin took over that were closed without merging.
          title: Prs Taken Over Closed Count
          type: integer
        prs_taken_over_count:
          default: 0
          description: >-
            Total PRs Devin took over across all states (open + merged +
            closed). A take-over is when Devin pushed commits to a PR it did not
            originally create.
          title: Prs Taken Over Count
          type: integer
        prs_taken_over_merged_count:
          default: 0
          description: PRs Devin took over that were merged.
          title: Prs Taken Over Merged Count
          type: integer
        prs_taken_over_opened_count:
          default: 0
          description: PRs Devin took over that are currently open.
          title: Prs Taken Over Opened Count
          type: integer
      required:
        - prs_created_count
        - prs_opened_count
        - prs_merged_count
        - prs_closed_count
      title: PrMetricsResponse
      type: object
    ProblemDetail:
      description: >-
        RFC 9457 application/problem+json error body for the v3 API.


        detail is retained from the legacy {"detail": ...} body for back-compat;
        the

        other members are additive. errors carries field-level validation
        failures

        (422 only).
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: A human-readable explanation specific to this occurrence.
          title: Detail
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: Field-level validation errors (422 responses only).
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: A URI reference (the request path) for this occurrence.
          title: Instance
        status:
          description: The HTTP status code.
          title: Status
          type: integer
        title:
          description: A short, human-readable summary of the problem type.
          title: Title
          type: string
        type:
          default: about:blank
          description: A URI reference identifying the problem type.
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````