Trying to transfer a call to a different queue via the Conversations API.
PATCH /api/v2/conversations/calls/{id}
Payload:
{
"routing": {
"queueId": "new-queue-id"
}
}
Getting a 400 Bad Request. The docs say routing is optional but I’m not sure if I need to pass the full media state or if the queueId format is wrong. Anyone got this working?
the issue is that you’re trying to update routing on an active call. that field isn’t writable during the conversation. the docs actually state:
“The routing object is read-only for active conversations.”
if you want to transfer, you need to use the wrapup endpoint after the current interaction closes, or better yet, use the specific transfer API. for a queue transfer, you don’t patch the conversation. you initiate a transfer.
in .NET, you’d use TransferParticipantRequest. here’s how it looks with the SDK. note that you need the conversationId and the participantId of the agent doing the transfer.
var client = new PureCloudPlatformClientV2.PureCloudPlatformClient();
client.AuthClient.SetCredentials("your-client-id", "your-client-secret");
await client.AuthClient.AuthenticateAsync();
var conversationsApi = new ConversationsApi(client);
// The participant transferring the call
var participantId = "agent-participant-id";
var conversationId = "call-conversation-id";
// Define the transfer target
var transferTo = new ConversationTransferRequest
{
From = new ConversationTransferRequestFrom
{
ParticipantId = participantId
},
To = new List<ConversationTransferRequestTo>
{
new ConversationTransferRequestTo
{
QueueId = "new-queue-id", // This is the queue you want to transfer TO
WrapUpCode = new List<string> { "transferred" } // Optional but good practice
}
}
};
try
{
// This performs the actual transfer action
var result = await conversationsApi.PostConversationsCallsConversationIdTransferAsync(conversationId, transferTo);
Console.WriteLine($"Transfer initiated. Status: {result.Status}");
}
catch (ApiException e)
{
Console.WriteLine($"Error: {e.Message}");
Console.WriteLine($"Body: {e.ResponseAsString}");
}
don’t try to patch the routing object. it’s metadata for analytics, not a control plane for active calls. if you really need to update attributes for reporting, you do that via PATCH /api/v2/conversations/calls/{id}/participants/{participantId} but that won’t move the call. stick to the transfer endpoint. it’s the only way that won’t throw a 400.