---
title: "Compute journey scalar analytics"
method: POST
path: "/api/v2/product-analytics/journey/scalar"
tags: ["Product Analytics"]
---

# Compute journey scalar analytics

`POST /api/v2/product-analytics/journey/scalar`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/product-analytics/journey/scalar`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token`
- TypeScript: <https://skmtc.dev/datadog/apis/datadog-api-v2-collection/docs/api/v2/product-analytics/journey/scalar/post.ts> (a function with typed inputs; its response is checked against the schema)

Compute scalar results for a journey query, such as the conversion count,
the conversion rate, or the time to convert, optionally segmented by group-by facets.

## Request body

- ProductAnalyticsJourneyScalarRequest: Request body for a journey scalar query.
  - `data` ProductAnalyticsJourneyScalarRequestData, required: The single JSON:API resource carrying a journey scalar query. Its attributes hold the time window and the journey metric to reduce to one value over that window.
    - `attributes` ProductAnalyticsJourneyScalarRequestAttributes, required: Attributes of a journey scalar request.
      - `from` integer, required: Start of the query window, in epoch milliseconds.
      - `query` ProductAnalyticsJourneyScalarQuery, required: Query definition for a journey scalar request.
        - `compute` ProductAnalyticsJourneyScalarCompute, required: Defines the metric computed over the journey for a scalar query.
          - `aggregation` string, required: Aggregation function: `count`, `cardinality`, `avg`, `median`, `min`, `max`, `sum`, or a percentile of the form `pc<N>` such as `pc95`. Defaults to `cardinality`.
          - `metric` string: Metric to aggregate on. Use a facet path such as `@view.time_spent`, or one of the journey metrics `__dd.conversion`, `__dd.conversion_rate`, `__dd.time_to_convert`, or `__dd.dropoff_rate`. Defaults to `__dd.conversion`.
          - `target` union: A reference to a step, or a range of steps, in the journey. Use a `node` target to name a single step, or a `path` target to name the range between two steps.
            - ProductAnalyticsJourneyNodeTarget: A reference to a single step of the journey.
              - …
            - ProductAnalyticsJourneyPathTarget: A reference to the range of steps between two nodes of the journey.
              - …
        - `group_by` ProductAnalyticsGraphQueryGroupBy[]: Segments the results by the values of one or more facets.
          - `facet` string, required: Attribute path to group by.
          - `limit` integer: Maximum number of groups to return. Omit it to let the service choose.
          - `should_exclude_missing` boolean: Whether to exclude entities that have no value for this facet.
          - `sort` ProductAnalyticsGroupBySort: Sort configuration for group-by results.
            - `aggregation` string: The aggregation function to sort by.
            - `metric` string: The metric to sort by.
            - `order` 'asc' | 'desc': Direction of sort.
          - `source` 'product_analytics_audience_filters.users' | 'product_analytics_audience_filters.accounts': Audience dimension to group by, instead of an event facet.
          - `target` union: A reference to a step, or a range of steps, in the journey. Use a `node` target to name a single step, or a `path` target to name the range between two steps.
            - ProductAnalyticsJourneyNodeTarget: A reference to a single step of the journey.
              - …
            - ProductAnalyticsJourneyPathTarget: A reference to the range of steps between two nodes of the journey.
              - …
          - `value_filters` string[]: Restricts the results to these facet values.
        - `query_id` string: Caller-defined identifier echoed back in the results.
        - `search` ProductAnalyticsJourneySearch, required: Defines the steps of the journey and the filters applied to it.
          - `expression` string, required: Expression combining the node aliases in order, for example `A -> B -> C`.
          - `filters` ProductAnalyticsJourneySearchFilters: Filters applied on top of the journey step expression.
            - `audience_filters` ProductAnalyticsJourneyAudienceFilters: Restricts the journey to an audience built from named sub-queries. Sub-query names must be unique across `users`, `segments`, and `accounts`.
              - …
            - `graph_filters` ProductAnalyticsJourneySearchGraphFilter[]: Filters on journey-level metrics such as time to convert.
              - …
            - `string_filter` string: Free-text search query applied to the whole journey.
          - `join_keys` ProductAnalyticsJoinKeys: Identity join keys used to stitch events belonging to the same user or session.
            - `primary` string: Primary identity join key. Defaults to `@session.id`.
            - `secondary` string[]: Additional identity join keys.
          - `node_objects` object, required: Map of node alias to the query matching that step of the journey. Every alias used in `expression` must have an entry here.
      - `to` integer, required: End of the query window, in epoch milliseconds.
    - `type` 'formula_journey_request', required: The resource type identifier for a journey timeseries or scalar request.

## Response `200`

OK

- ProductAnalyticsJourneyScalarResponse: Response for a journey scalar query.
  - `data` ProductAnalyticsJourneyScalarResponseData, required: The single JSON:API resource holding journey scalar results. Its attributes contain one value per group, suitable for a query value or top list widget.
    - `attributes` ProductAnalyticsScalarResponseAttributes, required: Attributes of a scalar analytics response, containing the result columns.
      - `columns` ProductAnalyticsScalarColumn[]: The list of result columns, each containing values and metadata.
        - `meta` ProductAnalyticsScalarColumnMeta: Metadata associated with a scalar response column, including optional unit information.
          - `unit` ProductAnalyticsUnit[], nullable: Unit definitions for the column values, if applicable.
            - `family` string: The unit family (e.g., time, bytes).
            - `id` integer: Numeric identifier for the unit.
            - `name` string: The full name of the unit (e.g., nanosecond).
            - `plural` string: Plural form of the unit name (e.g., nanoseconds).
            - `scale_factor` number, double: Conversion factor relative to the base unit of the family.
            - `short_name` string: Abbreviated unit name (e.g., ns).
        - `name` string: Column name (facet name for group-by, or "query").
        - `type` 'number' | 'group': Column type.
        - `values` unknown[]: Column values.
          - unknown
    - `id` string, required: Identifier of this result.
    - `type` 'journey_scalar_response', required: The resource type identifier for a journey scalar response.

## Other responses

- `400`: Bad Request
- `403`: Not Authorized
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/3f70db624329?raw)
