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

# Run a report

> Numbers, totals, and breakdowns from the report metric catalog. Choose one to five metrics and a range. Read-only, despite POST. A combination the catalog does not support returns 200 with status unsupported_combination and the allowed alternatives. Customer API.




## OpenAPI

````yaml /openapi.yaml post /reports
openapi: 3.0.0
info:
  title: Answering Agent API
  description: >
    The Customer API reads a team's conversations, transcripts, recordings,
    tasks, contacts, and reports. It also updates tasks and adds notes to them.
    The Partner API lets reseller accounts manage organizations, users,
    locations, partner links, and embed tokens. Both use an X-API-KEY header.
    Requests from this playground go to production.
  version: 1.0.0
servers:
  - url: https://answeringagent.com/api/v1
    description: Production
security: []
tags:
  - name: Account
    description: Customer API. Your team, phone lines, and members.
  - name: Conversations
    description: >-
      Customer API. Calls, texts, website chats, and emails, with transcripts
      and recordings.
  - name: Tasks
    description: >-
      Customer API. Follow-up tasks. Read them, update their status or assignee,
      and add notes.
  - name: Contacts
    description: Customer API. Your customers.
  - name: Reports
    description: Customer API. Report metrics, totals, and breakdowns.
  - name: Organizations
    description: Partner API, reseller accounts only.
  - name: Users
    description: Partner API, reseller accounts only.
  - name: Locations
    description: Partner API, reseller accounts only.
  - name: Account Linking
    description: Partner API, reseller accounts only.
  - name: Embed Tokens
    description: Partner API, reseller accounts only.
paths:
  /reports:
    post:
      tags:
        - Reports
      summary: Run a report
      description: >
        Numbers, totals, and breakdowns from the report metric catalog. Choose
        one to five metrics and a range. Read-only, despite POST. A combination
        the catalog does not support returns 200 with status
        unsupported_combination and the allowed alternatives. Customer API.
      operationId: runReport
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReportRequest'
            example:
              measures:
                - conversations
                - ai_resolved_conversations
              range: 30d
              group_by: phone_line
      responses:
        '200':
          description: The report, or why the combination is not supported.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportResult'
        '400':
          $ref: '#/components/responses/CustomerBadRequest'
        '401':
          $ref: '#/components/responses/CustomerUnauthorized'
        '403':
          $ref: '#/components/responses/CustomerForbidden'
        '404':
          description: filters.phone_line_id is not a phone line the key's owner can see.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerError'
              example:
                error: That phone line is not available.
                code: not_found
        '405':
          $ref: '#/components/responses/CustomerMethodNotAllowed'
        '429':
          $ref: '#/components/responses/CustomerRateLimited'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ReportRequest:
      type: object
      required:
        - measures
        - range
      additionalProperties: false
      properties:
        measures:
          type: array
          minItems: 1
          maxItems: 5
          uniqueItems: true
          items:
            type: string
            enum:
              - conversations
              - ai_resolved_conversations
              - ai_resolved_rate
              - meaningful_conversations
              - handled_conversations
              - handled_rate
              - needs_team_conversations
              - asked_for_person_conversations
              - asked_for_person_ai_resolved_conversations
              - asked_for_person_ai_resolved_rate
              - transfer_attempts
              - conversation_categories
              - texts_sent
              - avg_duration_minutes
              - handled_well_rate
              - avg_quality_score
              - quality_review_rate
              - caller_resolution_coverage_rate
              - caller_resolved_rate
              - system_health_rate
              - accuracy_rate
              - escalation_failure_rate
              - quality_failure_types
              - quality_knowledge_gaps
              - caller_resolved_with_task_rate
              - cancellation_conversations
              - cancellation_reasons
              - retention_offers_pitched
              - retention_offers_accepted
              - retention_acceptance_rate
              - retention_discounts_applied
              - memberships_saved
              - offers_pitched
              - offers_accepted
              - offer_acceptance_rate
              - tasks_created
              - tasks_completed
              - tasks_still_open
              - task_completion_rate
              - task_categories
              - conversations_with_tasks
              - conversations_with_tasks_rate
              - team_member_activity
              - account_updates
              - questions_answered
              - questions_answered_rate
              - tasks_worked
              - task_closes
              - avg_hours_to_close
              - median_hours_to_close
              - avg_hours_to_first_action
              - median_hours_to_first_action
              - same_day_close_rate
              - open_tasks
        range:
          type: string
          enum:
            - today
            - yesterday
            - 7d
            - 14d
            - 30d
            - 90d
            - 365d
            - mtd
            - ytd
            - month
            - custom
        month:
          type: string
          pattern: ^\d{4}-\d{2}$
          description: Required when range is month.
        from:
          type: string
          format: date
          description: First day. Required when range is custom.
        to:
          type: string
          format: date
          description: Last day, included. Required when range is custom.
        group_by:
          type: string
          enum:
            - day
            - week
            - month
            - hour_of_day
            - category
            - channel
            - phone_line
            - team_member
            - task_age
            - action_group
            - failure_type
            - failure_subcategory
            - cancellation_reason
        split_by:
          type: string
          enum:
            - team_member
        filters:
          type: object
          additionalProperties: false
          properties:
            channel:
              $ref: '#/components/schemas/Channel'
            phone_line_id:
              type: integer
              minimum: 1
              description: >-
                A phone line id from phone_lines[].id in GET /account. A line
                the key's owner cannot see returns 404.
            category:
              type: string
              enum:
                - damage_claim
                - cancellation
                - lost_items
                - sales
                - scheduling
                - hours_status
                - service_status
                - billing
                - account_update
                - general_questions
                - job_seeking
                - no_answer
                - not_stated
                - spam
                - other
                - form
            language:
              type: string
              pattern: ^[a-z]{2}$
            team_member_ids:
              type: array
              minItems: 1
              maxItems: 5
              uniqueItems: true
              description: >-
                Team member ids from members[].id in GET /account. Team-work
                metrics only.
              items:
                type: integer
                minimum: 1
        top_n:
          type: integer
          minimum: 1
          maximum: 10
        include_percent_of_total:
          type: boolean
    ReportResult:
      type: object
      properties:
        status:
          type: string
          enum:
            - ok
            - unsupported_combination
        range:
          type: object
          properties:
            requested:
              type: string
            from:
              type: string
              format: date
            to:
              type: string
              format: date
            timezone:
              type: string
        values:
          type: object
          additionalProperties:
            type: object
            properties:
              label:
                type: string
              unit:
                type: string
                enum:
                  - count
                  - percent
                  - minutes
                  - hours
                  - score
              value:
                type: number
                nullable: true
              numerator:
                type: number
              denominator:
                type: number
              rate:
                type: number
        rows:
          type: array
          items:
            type: object
            properties:
              label:
                type: string
                description: For display. Match rows by the group key.
              channel:
                allOf:
                  - $ref: '#/components/schemas/Channel'
                description: Present when the rows are grouped by channel.
              category:
                type: string
                nullable: true
                description: >-
                  Present when the rows are grouped by category. Null on the
                  Uncategorized and All other categories rows.
              phone_line:
                anyOf:
                  - $ref: '#/components/schemas/PhoneLine'
                  - $ref: '#/components/schemas/NullValue'
                description: Present when the rows are grouped by phone line.
              team_member:
                anyOf:
                  - $ref: '#/components/schemas/Person'
                  - $ref: '#/components/schemas/NullValue'
                description: >-
                  Present when the rows are grouped by team member. Null on the
                  Unassigned row.
              values:
                type: object
                additionalProperties:
                  type: number
                  nullable: true
              percent_of_total:
                type: number
        resolved_group_by:
          type: string
        chart:
          type: object
          properties:
            kind:
              type: string
              enum:
                - line
                - bar
            title:
              type: string
            label_kind:
              type: string
            series:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  points:
                    type: array
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                        value:
                          type: number
        methodology:
          type: array
          items:
            type: string
        caveats:
          type: array
          items:
            type: string
        error:
          type: string
          enum:
            - unsupported_combination
          description: Present when status is unsupported_combination, with the same value.
        reason:
          type: string
          description: >-
            Why the combination is not supported. Present when status is
            unsupported_combination.
        message:
          type: string
        allowed_alternatives:
          type: object
          description: >-
            Values to retry with. Present when status is
            unsupported_combination.
        url:
          type: string
          example: https://answeringagent.com/dashboard/reports
    CustomerError:
      type: object
      required:
        - error
        - code
      properties:
        error:
          type: string
          description: A message for people. The text can change.
          example: That conversation is not available.
        code:
          type: string
          description: A stable code to branch on.
          enum:
            - invalid_request
            - unauthorized
            - forbidden
            - not_found
            - method_not_allowed
            - conflict
            - unprocessable
            - rate_limited
            - internal
          example: not_found
        issues:
          type: array
          description: >-
            Present when code is invalid_request. One entry for each input that
            failed validation.
          items:
            type: object
            properties:
              path:
                type: array
                items: {}
              message:
                type: string
    Channel:
      type: string
      enum:
        - phone
        - text
        - web_chat
        - email
    PhoneLine:
      type: object
      properties:
        id:
          type: integer
          example: 2181
        name:
          type: string
          nullable: true
          example: Westside Wash
        phone_number:
          type: string
          nullable: true
          example: '+15125550142'
    NullValue:
      description: No value.
      type: object
      nullable: true
      enum:
        - null
    Person:
      type: object
      description: >-
        A team member. The id is what assigned_to and report
        filters.team_member_ids take.
      properties:
        id:
          type: integer
          example: 9034
        name:
          type: string
          example: Priya Shah
  responses:
    CustomerBadRequest:
      description: An input is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CustomerError'
    CustomerUnauthorized:
      description: >-
        The X-API-KEY header is missing, the key is wrong or revoked, or its
        owner was deactivated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CustomerError'
    CustomerForbidden:
      description: The key's owner is not an owner, admin, or manager on the team.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CustomerError'
    CustomerMethodNotAllowed:
      description: The endpoint does not support that HTTP method. Nothing changed.
      headers:
        Allow:
          description: The methods the endpoint supports, such as GET, HEAD, OPTIONS.
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CustomerError'
          example:
            error: This endpoint accepts GET.
            code: method_not_allowed
    CustomerRateLimited:
      description: More than 120 requests in a minute for this user.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CustomerError'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.