I’m trying to drop a specific agent from an active conference call using the Genesys Cloud API. The goal is to keep the call alive for the remaining parties. I’m using the Python SDK and calling the disconnect_participant method on the Conversations API client.
Here is the code I’m running:
client = PureCloudPlatformClientV2.create("my_app", "my_secret")
conversations_api = client.conversations_api
# Attempt to disconnect participant 2
try:
res = conversations_api.disconnect_participant(
conversation_id="abc-123",
participant_id="def-456"
)
except Exception as e:
print(e)
The request returns a 400 Bad Request error. The response body says Participant is not in the conversation. This is confusing because I just queried the conversation and saw this participant ID in the list. The participant state is active.
I have checked the timestamps. The query was done 50ms before the disconnect call. Is there a race condition with the participant state? Or maybe I need to use a different endpoint for conferences specifically? The docs for disconnect_participant don’t mention any special flags for conference bridges. I’m stuck on this one.
Docs state: “To disconnect a participant from a conversation, use the DELETE /api/v2/conversations/{conversationId}/participants/{participantId} endpoint.” You’re using disconnect_participant which might be mapping to the wrong HTTP verb or expecting a different payload structure depending on the SDK version. The Python SDK v2 is strict about this.
The method you want is actually delete_conversation_participant. disconnect usually implies hanging up the whole line or a specific softphone action, whereas delete removes the participant resource from the conversation context.
Try this:
from purecloud_platform_client import PureCloudPlatformClientV2
client = PureCloudPlatformClientV2.create("my_app", "my_secret")
conversations_api = client.conversations_api
try:
# Ensure you have the correct Conversation ID and Participant ID
# Participant ID is NOT the user ID. It's the UUID of the participant object in that specific conversation.
conversation_id = "your-conversation-uuid"
participant_id = "your-participant-uuid"
# This performs the DELETE request
conversations_api.delete_conversation_participant(
conversation_id=conversation_id,
participant_id=participant_id
)
print("Participant removed successfully.")
except Exception as e:
print(f"Failed to remove participant: {e}")
Make sure you’re grabbing the id from the participant object returned by get_conversation_participant, not the user.id field. They are different. The API needs the participant identifier to know which leg to cut. If you pass the user ID, it’ll 404.