Trying to update a custom attribute on an active call using the REST API. Sending a PATCH request to /api/v2/conversations/voice/ with the participant ID and a JSON body containing the attribute map.
Getting a 400 Bad Request with "reason": "Bad Request" and "message": "Invalid input.".
Here’s the payload:
{
"customAttributes": {
"wem_segment": "vip"
}
}
What am I missing?
The endpoint you listed is incomplete. You need the specific conversation ID. Also, setting custom attributes on a participant requires the PATCH method on the participant resource, not the conversation root.
Here is the correct structure for the request:
PATCH /api/v2/conversations/voice/{conversationId}/participants/{participantId}
Authorization: Bearer <access_token>
Content-Type: application/json
Payload:
{
"customAttributes": {
"wem_segment": "vip"
}
}
Make sure you have the conversation:write scope. If you are using the Python SDK, it looks like this:
from platformclientv2 import ApiClient, Configuration, ConversationApi
configuration = Configuration()
api_client = ApiClient(configuration)
conversation_api = ConversationApi(api_client)
patch_req = PatchableParticipant(
custom_attributes={"wem_segment": "vip"}
)
# Replace with actual IDs
resp = conversation_api.patch_conversation_participant(
conversation_id="your-conversation-id",
participant_id="your-participant-id",
body=patch_req
)
Check the 400 error details. Usually, it’s a missing ID or a scope issue.