Trying to update a participant attribute on a live voice call using the REST Proxy. The call works fine in Postman with Bearer auth, but fails in the script with a 401 error. Here is the JSON I’m sending to PUT /api/v2/interactions/participants:
{
“attributes”: {
“custom”: {
“source”: “external_system”
}
}
}
Is the token missing the right scope for interaction writes?
Check your token scopes. The docs for Interaction Management say you need interaction:write and interaction:read. If you’re using the .NET SDK or just HttpClient, make sure the OAuth client has those permissions enabled in the admin portal.
Also, the endpoint path looks slightly off. It should be /api/v2/interactions/participants/{participantId}. You can’t just PUT to the collection.
Here is a quick C# using HttpClient to show the correct structure. Note the participant ID in the URL.
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.BaseAddress = new Uri("https://api.mypurecloud.com/");
var payload = new {
attributes = new {
custom = new {
source = "external_system"
}
}
};
var response = await client.PutAsJsonAsync($"api/v2/interactions/participants/{participantId}", payload);
If you get 401, it’s almost certainly the scope. Double-check the API client settings in Genesys Cloud. I’ve seen this trip people up when they copy tokens from different clients.