We’re trying to update the wrap-up code for a completed interaction programmatically to feed metrics into our New Relic custom events. The PUT request to /api/v2/conversations/interactions/{interactionId} fails with a 400 Bad Request. The response body says Invalid wrap-up code id. Here is the JSON payload we are sending:
{
"wrapUpCode": {
"id": "valid-code-id-from-get-call"
}
}
The ID comes directly from a GET request on the interaction, so it should be valid. Is there a specific state required on the interaction before this field can be updated? We’ve tried waiting 5 seconds after the interaction.end event.
-
You’re likely hitting a division mismatch. Docs state: “Wrap-up codes are division-specific.” If your token’s active division doesn’t match the wrap-up code’s division, the API throws Invalid wrap-up code id. Check the divisionId in the GET /api/v2/interaction-wrapup-codes/{wrapUpCodeId} response.
-
Verify the interaction status. You can’t add a wrap-up code to an interaction that isn’t completed. Docs state: “Wrap-up codes can only be applied to interactions that have reached the completed state.” If the interaction is still in-progress or pending, the PUT will fail.
-
Ensure the payload structure is correct. The wrapUpCode object must include the full ID, not just the name. Here’s a working curl example:
curl -X PUT "https://api.genesyscloud.com/api/v2/conversations/interactions/{interactionId}" \
-H "Authorization: Bearer {your_token}" \
-H "Content-Type: application/json" \
-d '{
"wrapUpCode": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
}'
-
Double-check the token scopes. Your OAuth token needs interaction:write scope. Docs state: “The interaction:write scope is required to modify interaction data.” If you’re using client credentials, ensure the client has this scope assigned in the admin portal.
-
Check for concurrent updates. If another process is updating the interaction at the same time, you might hit a conflict. Docs state: “Concurrent updates to the same interaction may result in a 409 Conflict error.” Implement retry logic with exponential backoff if this happens.