This looks like a fundamental misunderstanding of the Analytics API structure. You are sending a POST body to an endpoint that strictly expects query parameters for filtering, or you are hitting the wrong resource entirely. The /api/v2/analytics/details endpoint does not accept groupBy or metrics in the JSON body for this specific use case; it requires a proper query object with filter and metrics defined correctly. Also, wrapUpCode is a string field, not a metric you can aggregate directly without proper grouping. Read the docs: Understanding Analytics Query Structure. Use the Python SDK to build the query object properly.
from purecloudplatformclientv2 import AnalyticsApi, PlatformApiClient, PostQueryDetailsRequest
api_instance = AnalyticsApi(PlatformApiClient())
body = PostQueryDetailsRequest(
metrics=["wrapUpCode"],
group_by=["wrapUpCode"],
interval="PT1H",
filter="wrapUpCode != null"
)
try:
result = api_instance.post_analytics_details(body=body)
print(result)
except Exception as e:
print(f"Error: {e}")
My usual workaround is to ensuring the endpoint and method align with the Analytics API contract, as the 404 suggests a mismatch in resource identification or query structure. The suggestion above correctly identifies that groupBy and metrics placement is critical, but for wrapUpCode, you must also ensure the groupBy array explicitly includes the code identifier if you are aggregating data.
In my experience with Terraform state drift, I often see similar issues where the payload structure doesn’t match the expected schema for the specific analytics type. For wrapUpCode in detail queries, you typically need to specify the groupBy parameters correctly within the request body for a POST request to /api/v2/analytics/details/conversations/calls.
Here is a corrected payload structure that should resolve the null response:
Ensure you are using a POST request, not GET, as the details endpoint requires a complex query body. Also, verify that the wrapUpCode metric is available for your organization’s data model, as some custom configurations might restrict available metrics. If you still get null values, check if the calls in the specified interval actually have wrap-up codes assigned; otherwise, the API will return empty results for that group. This approach helped me when debugging similar analytics gaps in our CXone setup.
This looks like a fundamental mismatch between the endpoint version and the request structure. The /api/v2/analytics/details endpoint is legacy and does not support the complex query payloads used in the modern Analytics API. You need to switch to the conversations details query endpoint, which handles wrapUpCode correctly.
Change the endpoint to POST /api/v2/analytics/conversations/details/query.
Ensure your request body includes the wrapUpCode in the metrics array and explicitly defines the groupBy field with ["wrapUpCode"] to aggregate results.
Verify the filter object targets the correct type (e.g., voice) and includes a valid interval string like PT1H.
Using the legacy endpoint will always result in null values or errors for these specific metrics. Switching to the conversations details API resolves the schema limitation.
the suggestion above is correct, you must switch to POST /api/v2/analytics/conversations/details/query. the legacy endpoint lacks the schema for wrapUpCode in metrics. use this payload: