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

# Create Queue Aggregation

> Create an immutable aggregation definition on a queue.



## OpenAPI

````yaml https://api.duvo.ai/v2/documentation/mintlify.json post /v2/queues/{queue_id}/aggregations
openapi: 3.0.3
info:
  title: Duvo Public API
  description: >-
    Public API for programmatic access to Duvo. Authenticate with API keys
    created in the Duvo dashboard.


    ## Rate limits


    Requests are counted per API key. Every response advertises the quota with
    the IETF RateLimit fields, so a client can self-throttle without waiting for
    a rejection:


    - `RateLimit-Policy: "default";q=<quota>;w=<window seconds>` — the policy in
    force: `q` requests per `w` seconds.

    - `RateLimit: "default";r=<remaining>;t=<seconds>` — the live state: `r`
    requests left, quota resetting in `t` seconds.

    - Read the quota from the headers rather than hard-coding it; it differs per
    environment.

    - The same numbers are also sent as `ratelimit-limit`, `ratelimit-remaining`
    and `ratelimit-reset`.


    Once the quota is exhausted the API answers `429 Too Many Requests` with
    `Retry-After` set to the seconds to wait; honor it instead of retrying
    immediately.
  version: 1.0.0
servers:
  - url: https://api.duvo.ai
    description: Production server
security: []
tags:
  - name: Runs
    description: Start, monitor, and manage agent runs (Runs in the Duvo UI)
  - name: Sandboxes
    description: Create sandboxes and upload files for agent runs
  - name: Queues
    description: Manage queues and their agent bindings
  - name: Cases
    description: Create, list, and manage cases and their labels within queues
  - name: Case Approvals
    description: Submit decisions on pending case approval requests issued by an agent run
  - name: Case Attachments
    description: Upload, list, download, and remove the files attached to a case
  - name: Automations
    description: >-
      List and manage automations — the workspace container that groups the
      agents and queues making up one end-to-end process
  - name: Agents
    description: Create and manage agents for automation workloads
  - name: Revisions
    description: Create and manage agent revisions — the underlying Setup for an Agent
  - name: Agent Folders
    description: Organize agents into folders
  - name: Agent Memory
    description: Read an agent's memory files (the Memory feature in the Duvo UI)
  - name: Suggestions
    description: >-
      List, apply, and dismiss an Agent's improvement suggestions (the
      suggestions inbox in the Duvo UI)
  - name: Notifications
    description: >-
      List, read, dismiss, and clear the authenticated user's team notifications
      (the Notification Center in the Duvo UI)
  - name: Schedules
    description: List schedules configured for an agent
  - name: Duvo Pulse
    description: >-
      Create, list, iterate on, and delete Duvo Pulse dashboards — live,
      agent-generated visualizations of your Duvo data
  - name: Case Triggers
    description: >-
      Configure case triggers that automatically dispatch agent runs (Runs in
      the Duvo UI) for cases added to a queue
  - name: Triggers
    description: >-
      Configure event triggers that start a Run automatically when an external
      event fires (e.g. an email arrives, a Linear issue is created, or a file
      changes in Google Drive)
  - name: Skills
    description: Manage team and system skills (reusable knowledge packs).
  - name: Files
    description: Manage team files.
  - name: Plugins
    description: Discover plugins that can be referenced from a revision.
  - name: Organizations
    description: Inspect organizations you belong to and the teams within them
  - name: Team
    description: Inspect the team and members associated with the API key
  - name: Invites
    description: >-
      Invite people to a team — one at a time or in bulk, scoped to a Clarity
      process or the whole team — and manage the team's shareable invite link
  - name: Integrations
    description: Browse the team's catalog of available integration types
  - name: Connections
    description: Manage your connected integrations
  - name: Credentials
    description: >-
      Manage logins (domain + username + password + TOTP) used by agents to sign
      in to websites and desktop applications, and attach them to assignment
      revisions
  - name: Secrets
    description: >-
      Manage env-var secrets injected into runs, and attach them to assignment
      revisions. Only metadata is exposed; values are never returned
  - name: Revision Integrations
    description: >-
      Attach integrations to assignment revisions, pin specific connections, and
      link queues
  - name: ClarityV2
    description: >-
      Manage Clarity v2 process snapshots, automation proposals, and the
      extra-capture-request follow-up loop
paths:
  /v2/queues/{queue_id}/aggregations:
    post:
      tags:
        - Queues
      summary: Create Queue Aggregation
      description: Create an immutable aggregation definition on a queue.
      operationId: createQueueAggregation
      parameters:
        - schema:
            type: string
            format: uuid
          in: path
          name: queue_id
          required: true
          description: The queue's unique identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                definition:
                  type: object
                  properties:
                    name:
                      type: string
                      pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                    measures:
                      minItems: 1
                      maxItems: 8
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                          operation:
                            type: string
                            enum:
                              - count
                              - sum
                              - avg
                              - min
                              - max
                              - count_distinct
                              - p50
                              - p90
                              - p95
                              - p99
                          path:
                            type: string
                            pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                        required:
                          - name
                          - operation
                        additionalProperties: false
                    dimensions:
                      maxItems: 4
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                          path:
                            type: string
                            pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                        required:
                          - name
                          - path
                        additionalProperties: false
                    timeDimension:
                      type: object
                      properties:
                        name:
                          type: string
                          pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                        path:
                          type: string
                          pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                        granularity:
                          type: string
                          enum:
                            - hour
                            - day
                            - week
                            - month
                            - quarter
                            - year
                      required:
                        - name
                        - path
                        - granularity
                      additionalProperties: false
                    filters:
                      maxItems: 12
                      type: array
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                          operator:
                            type: string
                            enum:
                              - equals
                              - notEquals
                              - in
                              - notIn
                              - gt
                              - gte
                              - lt
                              - lte
                              - contains
                              - isSet
                              - isNotSet
                          value:
                            anyOf:
                              - anyOf:
                                  - type: string
                                  - type: number
                                  - type: boolean
                              - minItems: 1
                                maxItems: 100
                                type: array
                                items:
                                  anyOf:
                                    - type: string
                                    - type: number
                                    - type: boolean
                        required:
                          - path
                          - operator
                        additionalProperties: false
                    order:
                      maxItems: 8
                      type: array
                      items:
                        type: object
                        properties:
                          field:
                            type: string
                            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                          direction:
                            type: string
                            enum:
                              - asc
                              - desc
                        required:
                          - field
                          - direction
                        additionalProperties: false
                    caseFilters:
                      type: object
                      properties:
                        createdAtFrom:
                          type: string
                          format: date-time
                        createdAtTo:
                          type: string
                          format: date-time
                        statuses:
                          minItems: 1
                          maxItems: 10
                          type: array
                          items:
                            type: string
                            enum:
                              - pending
                              - in_progress
                              - needs_input
                              - postponed
                              - evaluating
                              - success
                              - issues
                              - completed
                              - failed
                              - canceled
                        priorities:
                          minItems: 1
                          maxItems: 3
                          type: array
                          items:
                            type: string
                            enum:
                              - none
                              - medium
                              - high
                        labelIds:
                          minItems: 1
                          maxItems: 100
                          type: array
                          items:
                            type: string
                            format: uuid
                      additionalProperties: false
                    limit:
                      type: integer
                      minimum: 1
                      maximum: 500
                  required:
                    - name
                    - measures
                  additionalProperties: false
                maximum_stale_age_seconds:
                  type: integer
                  minimum: 1
                  maximum: 604800
              required:
                - definition
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  queue_id:
                    type: string
                    format: uuid
                  schema_family_id:
                    type: string
                    format: uuid
                  schema_id:
                    type: string
                    format: uuid
                  schema_version:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  definition:
                    type: object
                    properties:
                      name:
                        type: string
                        pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                      measures:
                        minItems: 1
                        maxItems: 8
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                            operation:
                              type: string
                              enum:
                                - count
                                - sum
                                - avg
                                - min
                                - max
                                - count_distinct
                                - p50
                                - p90
                                - p95
                                - p99
                            path:
                              type: string
                              pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                          required:
                            - name
                            - operation
                          additionalProperties: false
                      dimensions:
                        maxItems: 4
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                            path:
                              type: string
                              pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                          required:
                            - name
                            - path
                          additionalProperties: false
                      timeDimension:
                        type: object
                        properties:
                          name:
                            type: string
                            pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                          path:
                            type: string
                            pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                          granularity:
                            type: string
                            enum:
                              - hour
                              - day
                              - week
                              - month
                              - quarter
                              - year
                        required:
                          - name
                          - path
                          - granularity
                        additionalProperties: false
                      filters:
                        maxItems: 12
                        type: array
                        items:
                          type: object
                          properties:
                            path:
                              type: string
                              pattern: ^\$(\.[A-Za-z_][A-Za-z0-9_]{0,63})+$
                            operator:
                              type: string
                              enum:
                                - equals
                                - notEquals
                                - in
                                - notIn
                                - gt
                                - gte
                                - lt
                                - lte
                                - contains
                                - isSet
                                - isNotSet
                            value:
                              anyOf:
                                - anyOf:
                                    - type: string
                                    - type: number
                                    - type: boolean
                                - minItems: 1
                                  maxItems: 100
                                  type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                                      - type: boolean
                          required:
                            - path
                            - operator
                          additionalProperties: false
                      order:
                        maxItems: 8
                        type: array
                        items:
                          type: object
                          properties:
                            field:
                              type: string
                              pattern: ^[A-Za-z_][A-Za-z0-9_]{0,63}$
                            direction:
                              type: string
                              enum:
                                - asc
                                - desc
                          required:
                            - field
                            - direction
                          additionalProperties: false
                      caseFilters:
                        type: object
                        properties:
                          createdAtFrom:
                            type: string
                            format: date-time
                          createdAtTo:
                            type: string
                            format: date-time
                          statuses:
                            minItems: 1
                            maxItems: 10
                            type: array
                            items:
                              type: string
                              enum:
                                - pending
                                - in_progress
                                - needs_input
                                - postponed
                                - evaluating
                                - success
                                - issues
                                - completed
                                - failed
                                - canceled
                          priorities:
                            minItems: 1
                            maxItems: 3
                            type: array
                            items:
                              type: string
                              enum:
                                - none
                                - medium
                                - high
                          labelIds:
                            minItems: 1
                            maxItems: 100
                            type: array
                            items:
                              type: string
                              format: uuid
                        additionalProperties: false
                      limit:
                        type: integer
                        minimum: 1
                        maximum: 500
                    required:
                      - name
                      - measures
                    additionalProperties: false
                  definition_hash:
                    type: string
                  maximum_stale_age_seconds:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  created_at:
                    type: string
                  updated_at:
                    type: string
                required:
                  - id
                  - queue_id
                  - schema_family_id
                  - schema_id
                  - schema_version
                  - definition
                  - definition_hash
                  - maximum_stale_age_seconds
                  - created_at
                  - updated_at
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                additionalProperties: false
        '409':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                additionalProperties: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication. Get your API key from the Duvo dashboard.

````