Setting wrap-up code via API after conversation ends returns 409

We are trying to set a wrap-up code programmatically using a PATCH request to /api/v2/conversations/{conversationId}/wrapup after the interaction status is closed. The request body contains the correct wrapupCodeId and wrapupData, but the API returns a 409 Conflict with the message “Conversation is not in a state that allows wrapup”. The conversation is already closed and we have verified the agent’s permissions. Is there a specific state transition we are missing or a delay required before this endpoint works?