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

# Get Session Metrics

> Get aggregated session metrics for the organization.

## Permissions

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


## OpenAPI

````yaml v3-openapi.yaml GET /v3/organizations/{org_id}/metrics/sessions
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/sessions:
    get:
      tags:
        - metrics
      summary: Get Session Metrics
      description: Get aggregated session metrics for the organization.
      operationId: >-
        handle_get_session_metrics_v3_organizations__org_id__metrics_sessions_get
      parameters:
        - description: 'Organization ID (prefix: org-)'
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
        - 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/SessionMetricsResponse'
          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:
    SessionMetricsResponse:
      description: Response model for session metrics.
      properties:
        avg_acus_per_session:
          title: Avg Acus Per Session
          type: number
        sessions_created_by_origin:
          $ref: '#/components/schemas/SessionCountsByOrigin'
        sessions_created_by_size:
          $ref: '#/components/schemas/SessionCountsBySize'
        sessions_created_count:
          title: Sessions Created Count
          type: integer
        sessions_created_with_playbook_count:
          title: Sessions Created With Playbook Count
          type: integer
        sessions_created_with_search_count:
          title: Sessions Created With Search Count
          type: integer
        sessions_with_merged_prs_by_size:
          $ref: '#/components/schemas/SessionCountsBySize'
        sessions_with_merged_prs_count:
          title: Sessions With Merged Prs Count
          type: integer
      required:
        - sessions_created_count
        - sessions_created_by_size
        - sessions_created_by_origin
        - sessions_created_with_playbook_count
        - sessions_created_with_search_count
        - sessions_with_merged_prs_count
        - sessions_with_merged_prs_by_size
        - avg_acus_per_session
      title: SessionMetricsResponse
      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
    SessionCountsByOrigin:
      description: |-
        Session counts by origin type, exposed on the v3 metrics API.

        A curated subset of `SessionOrigin`: legacy origins (cli,
        vscode_extension, devin_spaces) are intentionally not surfaced.
        Counts for sessions with a `scheduled` DB origin roll into
        `automation` via the canonical `db_origin_to_api` mapping, since
        automations are a superset that schedules will migrate into.
      properties:
        api:
          default: 0
          title: Api
          type: integer
        automation:
          default: 0
          title: Automation
          type: integer
        code_scan:
          default: 0
          title: Code Scan
          type: integer
        desktop:
          default: 0
          title: Desktop
          type: integer
        jira:
          default: 0
          title: Jira
          type: integer
        linear:
          default: 0
          title: Linear
          type: integer
        slack:
          default: 0
          title: Slack
          type: integer
        teams:
          default: 0
          title: Teams
          type: integer
        webapp:
          default: 0
          title: Webapp
          type: integer
      title: SessionCountsByOrigin
      type: object
    SessionCountsBySize:
      description: Session counts by size category.
      properties:
        l:
          default: 0
          title: L
          type: integer
        m:
          default: 0
          title: M
          type: integer
        s:
          default: 0
          title: S
          type: integer
        xl:
          default: 0
          title: Xl
          type: integer
        xs:
          default: 0
          title: Xs
          type: integer
      title: SessionCountsBySize
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````