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

# Get Interaction Aggregates V2

This endpoint returns the same grouped interaction metrics as [Get Interaction Aggregates](/embedded-pages/interactions/get-interaction-aggregates), with a shorter response. The request body is the same: `time_range`, `filters`, `group_by`, `additional_group_bys`, `variables`, `order_by`, `limit`, and `offset`. If `variables` is omitted, the API computes `n_interactions`, `n_users`, `cost`, and `latency_seconds`. Any variable you do not request is null.

You need an API key to authenticate. See [here](/embedded-pages/quickstart) for more information about the API keys.

<RequestExample>
  ```python Request theme={null}
  import requests

  url = "https://backend.nebuly.com/api/external/get-interaction-aggregates-v2"
  headers = {
      "Authorization": "Bearer <YOUR_API_KEY>"
  }
  payload = {
      "time_range": {
          "start": "2024-05-01T00:00:00Z",
          "end": "2024-05-31T23:59:59Z",
      },
      "filters": [],
      "variables": ["n_interactions", "aifi_score"],
  }

  response = requests.post(url, headers=headers, json=payload)
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": [
      {
        "group_name": "total",
        "n_interactions": 120,
        "aifi_proficiency_score": 45.0
      }
    ],
    "total": 1,
    "limit": 10,
    "offset": 0
  }
  ```
</ResponseExample>

<ResponseField name="total" type="integer">
  The total number of groups.
</ResponseField>

<ResponseField name="offset" type="integer">
  The offset used for pagination.
</ResponseField>

<ResponseField name="limit" type="integer">
  The maximum number of groups returned.
</ResponseField>

<ResponseField name="data" type="object[]">
  Aggregated values for each group.

  <Expandable title="properties">
    <ResponseField name="group_name" type="string">
      The group name.
    </ResponseField>

    <ResponseField name="additional_groups" type="string[]">
      Names for the additional group-by dimensions, when requested.
    </ResponseField>

    <ResponseField name="n_interactions" type="integer">
      The number of interactions in the group.
    </ResponseField>

    <ResponseField name="n_interactions_prev" type="integer">
      The number of interactions in the previous period.
    </ResponseField>

    <ResponseField name="n_users" type="integer">
      The number of users in the group.
    </ResponseField>

    <ResponseField name="n_users_prev" type="integer">
      The number of users in the previous period.
    </ResponseField>

    <ResponseField name="n_feedback" type="integer">
      The number of feedback events in the group.
    </ResponseField>

    <ResponseField name="n_feedback_prev" type="integer">
      The number of feedback events in the previous period.
    </ResponseField>

    <ResponseField name="n_positive_implicit_user_feedback" type="integer">
      Positive implicit feedback in the group.
    </ResponseField>

    <ResponseField name="n_negative_implicit_user_feedback" type="integer">
      Negative implicit feedback in the group.
    </ResponseField>

    <ResponseField name="n_positive_explicit_user_feedback" type="integer">
      Positive explicit feedback in the group.
    </ResponseField>

    <ResponseField name="n_negative_explicit_user_feedback" type="integer">
      Negative explicit feedback in the group.
    </ResponseField>

    <ResponseField name="n_positive_implicit_user_feedback_prev" type="integer">
      Positive implicit feedback in the previous period.
    </ResponseField>

    <ResponseField name="n_negative_implicit_user_feedback_prev" type="integer">
      Negative implicit feedback in the previous period.
    </ResponseField>

    <ResponseField name="n_positive_explicit_user_feedback_prev" type="integer">
      Positive explicit feedback in the previous period.
    </ResponseField>

    <ResponseField name="n_negative_explicit_user_feedback_prev" type="integer">
      Negative explicit feedback in the previous period.
    </ResponseField>

    <ResponseField name="n_intents" type="integer">
      The number of intents in the group.
    </ResponseField>

    <ResponseField name="n_intents_prev" type="integer">
      The number of intents in the previous period.
    </ResponseField>

    <ResponseField name="cost" type="float">
      The total cost for the group.
    </ResponseField>

    <ResponseField name="latency_seconds" type="float">
      The average latency for the group, in seconds.
    </ResponseField>

    <ResponseField name="retention" type="float">
      Retention for the group.
    </ResponseField>

    <ResponseField name="session_length" type="float">
      Average session length for the group.
    </ResponseField>

    <ResponseField name="session_time" type="float">
      Average session time for the group.
    </ResponseField>

    <ResponseField name="n_sessions" type="integer">
      The number of sessions in the group.
    </ResponseField>

    <ResponseField name="n_sessions_prev" type="integer">
      The number of sessions in the previous period.
    </ResponseField>

    <ResponseField name="n_segments" type="integer">
      The number of segments in the group.
    </ResponseField>

    <ResponseField name="n_segments_prev" type="integer">
      The number of segments in the previous period.
    </ResponseField>

    <ResponseField name="topics" type="string[]">
      Topics present in the group.
    </ResponseField>

    <ResponseField name="input_length" type="float">
      Average input length for the group.
    </ResponseField>

    <ResponseField name="input_length_prev" type="float">
      Average input length in the previous period.
    </ResponseField>

    <ResponseField name="input_tokens" type="integer">
      Input tokens for the group.
    </ResponseField>

    <ResponseField name="input_tokens_prev" type="integer">
      Input tokens in the previous period.
    </ResponseField>

    <ResponseField name="output_tokens" type="integer">
      Output tokens for the group.
    </ResponseField>

    <ResponseField name="output_tokens_prev" type="integer">
      Output tokens in the previous period.
    </ResponseField>

    <ResponseField name="aifi_proficiency_score" type="float">
      AI Proficiency for the selected group, with two digits after the decimal. Null when the group has no proficiency score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_score_prev" type="float">
      AI Proficiency for the selected group in the previous period. Null when the group has no proficiency score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_task_clarity_score" type="float">
      Task clarity component of AI Proficiency, with two digits after the decimal. Null when the group has no score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_context_provision_score" type="float">
      Context provision component of AI Proficiency, with two digits after the decimal. Null when the group has no score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_output_specification_score" type="float">
      Output specification component of AI Proficiency, with two digits after the decimal. Null when the group has no score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_prompt_length_score" type="float">
      Prompt length component of AI Proficiency, with two digits after the decimal. Null when the group has no score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_conversation_efficiency_score" type="float">
      Conversation efficiency component of AI Proficiency, with two digits after the decimal. Null when the group has no score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_constraint_specification_score" type="float">
      Constraint specification component of AI Proficiency, with two digits after the decimal. Null when the group has no score.
    </ResponseField>

    <ResponseField name="aifi_proficiency_moved_up" type="integer">
      Users in the group whose AI Proficiency moved up. Null when it was not requested.
    </ResponseField>

    <ResponseField name="aifi_proficiency_slipped_back" type="integer">
      Users in the group whose AI Proficiency slipped back. Null when it was not requested.
    </ResponseField>

    <ResponseField name="aifi_proficiency_stayed" type="integer">
      Users in the group whose AI Proficiency stayed the same. Null when it was not requested.
    </ResponseField>

    <ResponseField name="roi_hours_saved" type="float">
      Hours saved for the selected group when ROI is enabled. Null when ROI is off.
    </ResponseField>

    <ResponseField name="roi_hours_saved_prev" type="float">
      Hours saved for the selected group in the previous period. Null when ROI is off.
    </ResponseField>

    <ResponseField name="roi_value_saved" type="float">
      Value saved for the selected group when ROI is enabled. Null when ROI is off.
    </ResponseField>

    <ResponseField name="roi_value_saved_prev" type="float">
      Value saved for the selected group in the previous period. Null when ROI is off.
    </ResponseField>
  </Expandable>
</ResponseField>


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