> ## 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 by Category

> Get session counts and ACU consumption grouped by category and subcategory.

## Permissions

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


## OpenAPI

````yaml v3-openapi.yaml GET /v3/enterprise/metrics/sessions-by-category
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/sessions-by-category:
    get:
      tags:
        - metrics
      summary: Get Session Metrics by Category
      description: >-
        Get session counts and ACU consumption grouped by category and
        subcategory.
      operationId: >-
        handle_get_sessions_by_category_v3_enterprise_metrics_sessions_by_category_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/SessionsByCategoryResponse'
          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:
    SessionsByCategoryResponse:
      properties:
        categories:
          items:
            $ref: '#/components/schemas/CategoryMetrics'
          title: Categories
          type: array
      required:
        - categories
      title: SessionsByCategoryResponse
      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
    CategoryMetrics:
      properties:
        acus:
          title: Acus
          type: number
        category:
          title: Category
          type: string
        sessions_count:
          title: Sessions Count
          type: integer
        subcategories:
          items:
            $ref: '#/components/schemas/SubcategoryMetrics'
          title: Subcategories
          type: array
      required:
        - category
        - sessions_count
        - acus
        - subcategories
      title: CategoryMetrics
      type: object
    SubcategoryMetrics:
      properties:
        acus:
          title: Acus
          type: number
        display_name:
          title: Display Name
          type: string
        sessions_count:
          title: Sessions Count
          type: integer
        subcategory_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Subcategory Id
      required:
        - subcategory_id
        - display_name
        - sessions_count
        - acus
      title: SubcategoryMetrics
      type: object
  securitySchemes:
    bearerAuth:
      description: 'Service User credential (prefix: cog_)'
      scheme: bearer
      type: http

````