409 Conflict when setting wrap-up code via PUT /api/v2/conversations/{conversationId}/wrapup

Quick question about programmatically setting wrap-up codes after an interaction ends. i’m hitting a persistent 409 conflict error when trying to update the wrap-up state via the conversations api. my postman collection is set up to trigger this immediately after the state changes to wrapup in the websocket event stream, but the platform refuses the update.

here’s the payload i’m sending to put /api/v2/conversations/{conversationId}/wrapup:

{
 "wrapupCode": {
 "id": "my-wrapup-code-id-from-api-v2",
 "name": "Data Entry"
 },
 "wrapupText": "Updated via api"
}

the response body says "code":"conflict","message":"conversation is not in a valid state for wrap-up". i’ve verified the conversation id is correct and the user making the request has the conversation:conversation:wrapup permission. i’m using the same oauth token that successfully creates the initial conversation record. is there a race condition where i need to wait for a specific internal state change before this endpoint accepts the payload? or am i missing a required header in my pre-request script?

The best way to fix this is to ensure the wrapupcode object includes the correct code ID, not just the name. The 409 usually means the code doesn’t exist in the agent’s assigned set.

{
 "wrapupcode": {
 "code": "12345678-1234-1234-1234-123456789012"
 }
}

Validate the ID in staging first.