Quality API CSAT extraction logic failing with 400

Does anyone understand why the Quality API returns a 400 when filtering survey responses by interaction ID?

The documentation states: “Survey responses are linked via the conversationId field.”

My payload:

{
 "query": {
 "fields": ["conversationId"],
 "filter": { "conversationId": "abc-123" }
 }
}

Error: "message": "Invalid filter field for survey responses." Am I missing a specific scope or is the endpoint structure different for CSAT data?

This is actually a known issue… you are hitting a limitation in the query builder for survey data. the conversationId field is not directly indexable in the filter object for the Quality API survey endpoint. you cannot filter by it in the initial request payload like that.

the workaround is to use the search endpoint with a different approach. you need to fetch the survey responses first, then map them to conversations, or use the Conversation API to find the interaction and then pull the survey details.

here is the better way to handle this in your React app using the SDK:

  1. get the conversation details first.
  2. extract the surveyResponseId from the conversation object.
  3. fetch the survey response directly by ID.
const platformClient = require('genesyscloud');
const qualityApi = platformClient.qualityApi;

// 1. Get conversation details
const convApi = platformClient.conversationsApi;
const conversation = await convApi.getConversationsConversationId('abc-123');

// 2. Check if survey exists
if (conversation.surveyResponseId) {
 // 3. Fetch survey response directly
 const surveyResponse = await qualityApi.getQualitySurveysSurveyResponseId(conversation.surveyResponseId);
 console.log(surveyResponse);
} else {
 console.log('No survey response linked to this conversation');
}

this avoids the 400 error because you are not filtering an unindexed field. the Quality API search endpoint is strict about what fields you can filter on. conversationId is a foreign key reference, not a search index in that context.

also, make sure you have the quality:read scope. if you are using the embeddable SDK, ensure the token has this scope. implicit grant with PKCE should handle this, but double-check your client app permissions.

this approach is more robust for client-side apps. it prevents UI freeze because you are making targeted requests instead of paginating through all surveys. the suggestion above about scopes is correct, but the query structure is the real blocker here.