POST /interactions/wrapup returns 409 Conflict when setting wrap-up codes via API

We’re trying to programmatically set wrap-up codes after a conversation ends to capture the disposition in our OpenTelemetry trace. The goal is to close the loop on the interaction lifecycle in Jaeger.

We use the POST /api/v2/conversations/interactions/{interactionId}/wrapup endpoint. The payload looks like this:

{
 "wrapupCode": {
 "id": "123e4567-e89b-12d3-a456-426614174000"
 }
}

The request fails with a 409 Conflict status. The error message says Interaction is not in a state that allows wrapup. We’ve verified the interaction ID is correct and the conversation status is closed.

Is there a specific state we need to wait for? Or does the API require the agentId field to be included in the payload? We’re using the Java SDK InteractionApi client.

try {
 wrapupApi.setInteractionWrapup(interactionId, wrapupRequest);
} catch (ApiException e) {
 logger.error("Failed to set wrapup: {}", e.getMessage());
}