Setting wrap-up code via API after interaction ends - 409 Conflict

Hey everyone,

We’re trying to automate the assignment of wrap-up codes for WFM adherence tracking. The goal is to set the code programmatically right after an interaction ends, so our metrics stay clean without agent input.

I’m using the Python SDK and calling update_interaction on the conversation object. Here’s the snippet:

client = ApiClient(configuration)
interaction_api = InteractionApi(client)

# Attempting to update the interaction after it's marked as ended
body = {
 "wrap_up_code_id": "12345-abcde-67890" # Valid code ID
}
try:
 response = interaction_api.update_interaction(interaction_id, body)
except ApiException as e:
 print(f"Exception: {e}")

The issue is that the API returns a 409 Conflict error every time. The error message says the interaction is already completed. I know I can’t change the disposition after the fact, but I thought update_interaction would allow setting metadata fields like the wrap-up code.

Is there a different endpoint I should be hitting? Or is there a specific flag I need to set in the request body to bypass the state check? I’ve checked the docs but they’re pretty vague on post-completion updates.

Thanks for any help.