I’ve spent hours trying to figure out why the Conversations API rejects my attempt to disconnect a specific agent from an ongoing conference call.
I am building a backend service to manage agent participation dynamically. The goal is to remove an agent from a conference without terminating the entire conversation. I have verified the OAuth token has the conversation:modify scope and the client credentials are valid.
Here is the configuration and request structure:
endpoint: PATCH /api/v2/conversations/{conversationId}/participants/{participantId}
headers:
Content-Type: application/json
Authorization: Bearer <valid_token>
Accept: application/json
body:
state: "DISCONNECTED"
The HTTP response is consistently 400 Bad Request with the following JSON payload:
{
"errors": [
{
"code": "invalid.request",
"message": "Participant cannot be disconnected while in ACTIVE state without a valid reason code."
}
]
}
I have tried adding a reason field, but the API documentation for participant state transitions is sparse regarding required metadata for DISCONNECTED. Does the state update require a specific reasonCode enum value, or is there a different endpoint for forcefully removing participants? I am using Python requests for the integration.