Null wrapUpCode in analytics detail query despite SDK usage

Running a detail query via the Genesys Cloud Analytics API. I’m using the Node.js SDK to fetch interaction data for the last hour. The response returns 200, but wrapUpCode is consistently null, even for completed interactions. I’ve verified the users have wrap-up codes assigned in the platform. Is this a known limitation of the detail API, or am I missing a specific field expansion in the request body? The query payload looks standard.

you’re hitting a known quirk with how the analytics detail endpoint handles interaction metadata. the wrapUpCode field isn’t always populated in the immediate detail response because it depends on the interaction lifecycle state at the exact moment of query execution. if the interaction just closed, the analytics engine might not have indexed the wrap-up code yet.

the more reliable approach is to query the interactions endpoint directly via the Conversations API, which gives you real-time data, or use the Analytics API with a specific filter for interactionType: "media" and ensure you’re requesting the wrapUpCode explicitly in the fields array.

here’s a minimal repro using the Node.js SDK to fetch interactions with wrap-up codes included:

const { PureCloudPlatformClientV2 } = require('@genesyscloud/genesyscloud');
const platformClient = PureCloudPlatformClientV2.init();

async function getInteractionsWithWrapUp() {
 await platformClient.loginOAuthClientCredentials('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET');
 const analyticsApi = new platformClient.AnalyticsApi();
 
 const body = {
 queryType: 'detail',
 interval: 'PT1H', // Last hour
 view: 'interaction',
 fields: ['interactionId', 'wrapUpCode', 'wrapUpCodeName', 'startTime', 'endTime'], // Explicitly request wrap-up fields
 filterGroups: [
 {
 filters: [
 {
 dimension: 'interactionType',
 operator: 'eq',
 value: 'media'
 }
 ]
 }
 ]
 };

 try {
 const response = await analyticsApi.postAnalyticsConversationsDetails(body);
 console.log('Interactions:', response.body.entities);
 } catch (error) {
 console.error('Error fetching interactions:', error);
 }
}

getInteractionsWithWrapUp();

if you still see nulls, check if the wrap-up codes are actually set in the platform UI and not just assigned to a skill. the analytics engine only pulls what’s explicitly stored in the interaction record. also, make sure your user has analytics:read scope. if you’re seeing nulls for completed interactions, it’s likely a timing issue with the analytics aggregation process.