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

## Permissions

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


## OpenAPI

````yaml /v3-openapi.yaml GET /v3/organizations/{org_id}/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/organizations/{org_id}/metrics/prs:
    get:
      tags:
        - metrics
      summary: Get PR Metrics
      description: Get aggregated PR metrics for the organization.
      operationId: handle_get_pr_metrics_v3_organizations__org_id__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: 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
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
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
    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: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````