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

# Get Query Results

> Returns the resolved results of a completed query, as an array of metric rows.

Every row carries the common fields (`metric`, `granularity`, `splitby`, `tseq`, `cseq`). The remaining fields depend on the analysis type the query was registered for, so handle each row as a flexible set of keys. Select an example below to see the shape returned for each analysis type.




## OpenAPI

````yaml /api/analytics-query/analytics-query.yaml get /v5/analytics/query/{request_id}/results
openapi: 3.0.3
info:
  title: MoEngage Analytics Query API
  version: '5.0'
  description: >
    Asynchronous REST APIs to run MoEngage Analytics queries — Behavior,
    Funnels, Retention,

    Session/Source (BFRS) and User Property Analysis (UPA) — and retrieve their
    results.


    These queries are asynchronous. A `POST` registers the query and immediately
    returns a

    `request_id`; a worker executes the query; you then poll the status and
    fetch the results:


    1. **Submit** — `POST` one of the analysis endpoints. The response echoes
    the analysis `type` and returns a `request_id`.

    2. **Poll** — `GET /v5/analytics/query/{request_id}/status` until `status`
    is `SUCCESSFUL` (or `FAILED`).

    3. **Fetch** — `GET /v5/analytics/query/{request_id}/results` to retrieve
    the resolved series.
servers:
  - url: https://api-{dc}.moengage.com
    description: MoEngage API Server
    variables:
      dc:
        default: '01'
        description: >-
          The 'dc' in the API Endpoint URL refers to the MoEngage Data Center
          (DC). MoEngage hosts each customer in a different DC. You can find
          your DC number and replace the value of 'dc' in the URL by referring
          to the DC and API endpoint mapping
          [here](/api/introduction#data-centers). Your MoEngage Data Center (DC)
          can be 01, 02, 03, 04, 05, 06, or 101.
security:
  - basicAuth: []
tags:
  - name: Analytics Queries
    description: >-
      Register asynchronous BFRS and UPA analytics queries, then poll status and
      fetch results.
paths:
  /v5/analytics/query/{request_id}/results:
    get:
      tags:
        - Analytics Queries
      summary: Get Query Results
      description: >
        Returns the resolved results of a completed query, as an array of metric
        rows.


        Every row carries the common fields (`metric`, `granularity`, `splitby`,
        `tseq`, `cseq`). The remaining fields depend on the analysis type the
        query was registered for, so handle each row as a flexible set of keys.
        Select an example below to see the shape returned for each analysis
        type.
      operationId: getQueryResults
      parameters:
        - name: request_id
          in: path
          required: true
          description: The `request_id` returned when the query was registered.
          schema:
            type: string
            example: REQUEST_ID
      responses:
        '200':
          description: >-
            This response is returned when the request is processed
            successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  response_id:
                    $ref: '#/components/schemas/ResponseId'
                  type:
                    type: string
                    description: The type of resource returned in the `data` field.
                    example: query_result
                  data:
                    type: array
                    description: The resolved query results, as an array of metric rows.
                    items:
                      $ref: '#/components/schemas/QueryResultRow'
              examples:
                Behavior Analysis:
                  summary: Behavior analysis
                  value:
                    response_id: b3f1c0d2-2a4e-4f9b-9c1a-6d2e8f0a1b23
                    type: query_result
                    data:
                      - metric: 1217
                        granularity: 2026/06/01
                        splitby: []
                        grouped_by: []
                        step: A
                        tseq: 0
                        cseq: 0
                      - metric: 3482
                        granularity: 2026/06/02
                        splitby: []
                        grouped_by: []
                        step: A
                        tseq: 0
                        cseq: 0
                Funnels Analysis:
                  summary: Funnels analysis
                  value:
                    response_id: a7e3b9c1-4d62-4a05-8f37-1c9b2e6d0a84
                    type: query_result
                    data:
                      - step: 1
                        metric: 327
                        splitby: []
                        granularity: entire
                        split_by_weight: 327
                        tseq: 0
                        cseq: 0
                      - step: 2
                        metric: 0
                        splitby: []
                        granularity: entire
                        split_by_weight: 327
                        tseq: 0
                        cseq: 0
                Retention Analysis:
                  summary: Retention analysis
                  value:
                    response_id: e8c40a92-3f71-4b6d-82a5-9d1f0e7c3b48
                    type: query_result
                    data:
                      - metric: 0
                        granularity: 2026/07/07
                        splitby: []
                        total_users: 58
                        retained_user: 0
                        retention_comparison_index: 0
                        retention_compared_by: 2026/07/07
                        tseq: 0
                        cseq: 0
                      - metric: 0
                        granularity: 2026/07/07
                        splitby: []
                        total_users: 58
                        retained_user: 0
                        retention_comparison_index: 1
                        retention_compared_by: 2026/07/08
                        tseq: 0
                        cseq: 0
                Session/Source Analysis:
                  summary: Session/Source analysis
                  value:
                    response_id: c4a2d1e0-7b53-4f18-9a6c-2e8d0f1a3b45
                    type: query_result
                    data:
                      - analysis_type: session_count
                        splitby: []
                        granularity: 2026/07/09
                        metric: 54
                        fseq: 0
                        event_name: MOE_SESSION
                        tseq: 0
                        cseq: 0
                      - analysis_type: session_count
                        splitby: []
                        granularity: 2026/07/14
                        metric: 54
                        fseq: 0
                        event_name: MOE_SESSION
                        tseq: 0
                        cseq: 0
                User Analysis:
                  summary: User Analysis (UPA)
                  value:
                    response_id: f2d81b47-6c09-4e3a-95b8-0a7e4c1d2f63
                    type: query_result
                    data:
                      - metric: 8249
                        granularity: entire
                        splitby: []
                        step: A
                        tseq: 0
                        cseq: 0
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '424':
          $ref: '#/components/responses/QueryFailed'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ResponseId:
      type: string
      description: >-
        A unique identifier for the response, useful for correlating logs and
        support requests.
      example: fc803857-632e-4bf0-8df1-fbc2bdeedb66
    QueryResultRow:
      type: object
      description: >
        A single row of query results. The common fields are present for every
        analysis type; the remaining fields depend on the analysis the query was
        registered for.
      properties:
        metric:
          type: number
          description: >-
            The computed value for this row — a count, rate, or aggregation
            result.
          example: 15
        granularity:
          type: string
          description: >
            The time bucket this row belongs to, or `entire` when the result is
            not time-bucketed.
          example: 2026/07/14
        splitby:
          type: array
          description: >
            The key/value breakdown pairs for this row. Empty when the query
            requested no split.
          items:
            type: object
        tseq:
          type: integer
          description: Time-comparison sequence index. `0` for the primary time range.
          example: 0
        cseq:
          type: integer
          description: Segment-comparison sequence index. `0` for the first segment.
          example: 0
        step:
          type: string
          description: >
            Behavior and User Analysis: the `id` of the event or user property
            this row belongs to. Funnels: the funnel step number.
          example: A
        grouped_by:
          type: array
          description: Behavior only. The grouping values applied to this row.
          items:
            type: object
        split_by_weight:
          type: integer
          description: >
            Funnels only. The base denominator used to calculate the conversion
            rate for this step.
          example: 4
        total_users:
          type: integer
          description: Retention only. The size of the cohort for this period.
          example: 1
        retained_user:
          type: integer
          description: Retention only. The number of users from the cohort who returned.
          example: 0
        retention_comparison_index:
          type: integer
          description: Retention only. The offset, in periods, from the cohort period.
          example: 0
        retention_compared_by:
          type: string
          description: Retention only. The label of the period being compared against.
          example: 2026/06/29
        analysis_type:
          type: string
          description: Session/Source only. Echoes the `report_type` the query requested.
          example: session_count
        event_name:
          type: string
          description: >-
            Session/Source only. The underlying system event the metric is
            derived from.
          example: MOE_SESSION
        fseq:
          type: integer
          description: Session/Source only. Filter sequence index.
          example: 0
        bucket:
          type: string
          description: >
            User Analysis only. The property value or distribution bucket this
            row represents, formatted according to the property's requested
            projection.
          example: '1.0'
    GatewayAuthError:
      type: object
      description: >
        Authentication or authorization failure returned by the API gateway. The
        body is JSON, but the gateway sends it with `Content-Type: text/plain`.
      properties:
        code:
          type: string
          description: >
            A machine-readable code identifying the failure, such as `ER001`
            when credentials are missing or invalid, or `ER007` when the
            credentials do not have access to the route.
          example: ER001
        target:
          type: string
          description: The stage of the request that failed.
          example: Authentication Invalid
        message:
          type: string
          description: A human-readable description of the failure.
          example: Auth validation failed.
    ErrorResponse:
      type: object
      required:
        - error
        - response_id
      description: >
        Standard MoEngage error envelope, returned by the service.
        Authentication and authorization failures (401 and 403) are returned by
        the API gateway in a different format — see those responses for details.
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: A machine-readable error code.
              enum:
                - VALIDATION_FAILED
                - BAD_REQUEST
                - NOT_FOUND
                - QUOTA_EXCEEDED
                - INTERNAL_ERROR
            message:
              type: string
              description: A human-readable description of the error.
            doc_url:
              type: string
              description: A link to documentation about this error, when available.
        response_id:
          $ref: '#/components/schemas/ResponseId'
  responses:
    Unauthorized:
      description: >
        This response is returned when the credentials are missing or invalid.


        The API gateway generates this response before the request reaches the
        service, so it does not use the standard error envelope. The body is
        JSON, but the gateway sends it with `Content-Type: text/plain`. Parse it
        accordingly.
      content:
        text/plain:
          schema:
            $ref: '#/components/schemas/GatewayAuthError'
          example:
            code: ER001
            target: Authentication Invalid
            message: Auth validation failed.
    NotFound:
      description: The query `request_id` does not exist, or is not in this workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: NOT_FOUND
              message: The query request you are looking for does not exist.
              doc_url: https://www.moengage.com/docs/api/analytics-queries/
            response_id: 0998efae-b324-4559-afb0-756961d2e11a
    QueryFailed:
      description: >
        This response is returned when the query did not complete successfully,
        so no results are available. Check the `failure_reason` on [Get Query
        Status](/api/analytics-queries/get-query-status), correct the request,
        and register the query again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: BAD_REQUEST
              message: Query failed as column not found
              doc_url: https://www.moengage.com/docs/api/analytics-queries/
            response_id: b9f26c05-8d43-4e17-a0c9-3b5e7f21d846
    InternalError:
      description: An unexpected server error occurred.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INTERNAL_ERROR
              message: An unexpected error occurred while processing the request.
              doc_url: https://www.moengage.com/docs/api/analytics-queries/
            response_id: dcc4fd00-2980-41a5-94b3-ad4844ae3d72
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >
        Authentication is done via Basic Auth. This requires a Base64-encoded
        string of your credentials in the format `username:password`.


        - **Username**: Use your MoEngage Workspace ID (also known as the App
        ID). Find it in the MoEngage dashboard at **Settings** > **Account** >
        **API keys**.

        - **Password**: Use an API key from **Settings** > **Account** > **API
        keys**.


        Refer to [API Key
        Dashboard](/user-guide/settings/account/api-and-api-keys/api-key-dashboard)
        for details on creating and managing API keys.

````