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

# Analítica del portafolio

> Aggregated KPIs and distributions over your cases and actuaciones: by status, priority, office, city, period, day of week, and the most active cases. Use it for any volume or trend question instead of paging through rows.



## OpenAPI

````yaml legal/openapi.json GET /v1/analytics
openapi: 3.1.0
info:
  title: Croma Legal API
  version: 1.0.0
  description: >-
    Read-only access to your organization's litigation portfolio in Croma Legal:
    cases (processes), actuaciones, defendants, portfolio analytics and bulk
    exports. Every request is scoped to the organization that owns the API key.
servers:
  - url: https://api.legal.usecroma.com
security:
  - bearerAuth: []
tags:
  - name: Processes
    description: Cases in your portfolio.
  - name: Actuaciones
    description: Court filings and events across every case.
  - name: Defendants
    description: Demandados and the cases linked to them.
  - name: Analytics
    description: Aggregates over the portfolio.
  - name: Exports
    description: Bulk CSV / JSONL files.
  - name: Jobs
    description: Async job status.
paths:
  /v1/analytics:
    get:
      tags:
        - Analytics
      summary: Portfolio analytics
      description: >-
        Aggregated KPIs and distributions over your cases and actuaciones: by
        status, priority, office, city, period, day of week, and the most active
        cases. Use it for any volume or trend question instead of paging through
        rows.
      operationId: get_analytics
      parameters:
        - name: office
          in: query
          required: false
          description: Partial match on the judicial office (despacho).
          schema:
            type: string
        - name: status
          in: query
          required: false
          description: >-
            Monitoring status of the case in your portfolio. `TRACKING`:
            actively monitored for new actuaciones. `NOT_TRACKING`: monitoring
            paused.
          schema:
            type: string
            enum:
              - TRACKING
              - NOT_TRACKING
        - name: priority
          in: query
          required: false
          description: >-
            Filter by priority. Priority is a personal flag each dashboard user
            sets on their own cases, so it has no organization-level value:
            `NONE` matches every case, while `HIGH` and `MEDIUM` are accepted
            but match no rows for API callers.
          schema:
            type: string
            enum:
              - HIGH
              - MEDIUM
              - NONE
        - name: city
          in: query
          required: false
          description: >-
            City name, accent and case insensitive (e.g. `Bogotá`, `Medellin`).
            An unrecognized city returns `400`.
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          description: ISO 8601 date. Only cases filed on or after this date.
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          required: false
          description: ISO 8601 date. Only cases filed on or before this date.
          schema:
            type: string
            format: date
        - name: days
          in: query
          required: false
          description: >-
            Window, in days back from today, for the `actions.by_period`
            timeline (default 90, max 3650).
          schema:
            type: integer
            minimum: 1
            maximum: 3650
            default: 90
        - name: granularity
          in: query
          required: false
          description: Bucket size for `actions.by_period`.
          schema:
            type: string
            enum:
              - day
              - month
              - year
            default: day
      responses:
        '200':
          description: Successful response
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
            X-RateLimit-Limit:
              description: Requests allowed in the current window.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left before you are throttled.
              schema:
                type: integer
            X-RateLimit-Reset:
              description: ISO 8601 timestamp when the window resets.
              schema:
                type: string
                format: date-time
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Analytics'
              example:
                data:
                  kpis:
                    total_processes: 1280
                    tracking: 1174
                    not_tracking: 106
                    total_actions: 41230
                  processes:
                    by_status:
                      - status: TRACKING
                        count: 1174
                      - status: NOT_TRACKING
                        count: 106
                    by_priority:
                      - priority: NONE
                        count: 1280
                    by_office:
                      - office: JUZGADO 001 CIVIL MUNICIPAL DE BOGOTÁ
                        count: 96
                    by_city:
                      - city: Bogotá
                        count: 512
                      - city: Medellín
                        count: 203
                    concentration:
                      - city: Bogotá
                        office: JUZGADO 001 CIVIL MUNICIPAL DE BOGOTÁ
                        count: 96
                  actions:
                    by_period:
                      - date: '2026-08-17'
                        count: 38
                      - date: '2026-08-18'
                        count: 51
                    by_day_of_week:
                      - day_of_week: 1
                        count: 6120
                      - day_of_week: 2
                        count: 7045
                    by_office:
                      - office: JUZGADO 001 CIVIL MUNICIPAL DE BOGOTÁ
                        count: 3120
                    by_city:
                      - city: Bogotá
                        count: 16400
                    by_message:
                      - message: AUTO QUE DECRETA MEDIDAS CAUTELARES
                        count: 910
                    most_active_cases:
                      - registration_number: '11001400300120240012300'
                        office: JUZGADO 001 CIVIL MUNICIPAL DE BOGOTÁ
                        action_count: 74
        '400':
          description: Invalid filter
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: invalid_request_error
                  code: invalid_param
                  message: Unrecognized city.
                  param: city
                  details:
                    issues:
                      - path: city
                        message: Unrecognized city.
        '401':
          description: Missing or invalid API key
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: authentication_error
                  code: invalid_api_key
                  message: Invalid or missing API key.
        '429':
          description: Rate limit exceeded
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: rate_limit_error
                  code: rate_limited
                  message: Rate limit exceeded. Try again in 42 seconds.
        '500':
          description: Unexpected internal error
          headers:
            X-Request-Id:
              description: >-
                Unique id for the request (req_…). Include it in support
                reports.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  type: api_error
                  code: internal_error
                  message: >-
                    Internal error. Contact support with the X-Request-Id if it
                    persists.
      security:
        - bearerAuth: []
      externalDocs:
        description: Guide and examples
        url: https://docs.usecroma.com/legal/api-reference/overview
components:
  schemas:
    Analytics:
      type: object
      required:
        - kpis
        - processes
        - actions
      properties:
        kpis:
          type: object
          required:
            - total_processes
            - tracking
            - not_tracking
            - total_actions
          properties:
            total_processes:
              type: integer
            tracking:
              type: integer
              description: Cases with status `TRACKING`.
            not_tracking:
              type: integer
              description: Cases with status `NOT_TRACKING`.
            total_actions:
              type: integer
              description: >-
                Actuaciones matching the filters (all time, not bounded by
                `days`).
        processes:
          type: object
          properties:
            by_status:
              type: array
              items:
                type: object
                properties:
                  status:
                    type: string
                  count:
                    type: integer
            by_priority:
              type: array
              items:
                type: object
                properties:
                  priority:
                    type: string
                  count:
                    type: integer
            by_office:
              type: array
              description: Top 500 offices by case count.
              items:
                type: object
                properties:
                  office:
                    type: string
                  count:
                    type: integer
            by_city:
              type: array
              description: City is derived from the radicado.
              items:
                type: object
                properties:
                  city:
                    type: string
                  count:
                    type: integer
            concentration:
              type: array
              description: Top 500 city + office pairs by case count.
              items:
                type: object
                properties:
                  city:
                    type: string
                  office:
                    type: string
                  count:
                    type: integer
        actions:
          type: object
          properties:
            by_period:
              type: array
              description: >-
                Actuaciones per period within the last `days` days, by judicial
                date. `date` is `YYYY-MM-DD`, `YYYY-MM` or `YYYY` depending on
                `granularity`.
              items:
                type: object
                properties:
                  date:
                    type: string
                  count:
                    type: integer
            by_day_of_week:
              type: array
              description: '`day_of_week` is 0 (Sunday) to 6 (Saturday).'
              items:
                type: object
                properties:
                  day_of_week:
                    type: integer
                    minimum: 0
                    maximum: 6
                  count:
                    type: integer
            by_office:
              type: array
              items:
                type: object
                properties:
                  office:
                    type: string
                  count:
                    type: integer
            by_city:
              type: array
              items:
                type: object
                properties:
                  city:
                    type: string
                  count:
                    type: integer
            by_message:
              type: array
              description: Top 500 actuación texts by frequency.
              items:
                type: object
                properties:
                  message:
                    type: string
                  count:
                    type: integer
            most_active_cases:
              type: array
              description: Top 500 cases by number of actuaciones.
              items:
                type: object
                properties:
                  registration_number:
                    type: string
                  office:
                    type:
                      - string
                      - 'null'
                  action_count:
                    type: integer
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
          properties:
            type:
              type: string
              description: >-
                Broad category: invalid_request_error, authentication_error,
                not_found_error, rate_limit_error, api_error.
            code:
              type: string
              description: Machine-readable specific code.
            message:
              type: string
              description: Human-readable explanation, safe to surface in UI.
            param:
              type: string
              description: Field that triggered the error. Present on validation errors.
            details:
              type: object
              description: Free-form structured detail.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Use Authorization: Bearer YOUR_API_KEY'

````