Hit a 400 Bad Request with INVALID_VALUE when posting to /api/v2/outbound/contactlists. The payload looks standard, just a name and description, but the API rejects it every time. I’m using Kotlin with OkHttp and have verified the OAuth token is valid via the auth endpoint.
Here’s the JSON I’m sending:
{"name": "Test List v2", "description": "Auto-generated test"}
The error message is vague. Does the name field have hidden regex constraints or character limits I’m missing?
The docs are a bit light on the specifics for the POST payload structure, but the schema requires more than just name and description. You’re missing the type field.
From the ContactListEntity definition:
“type”: string - The type of the contact list.
If you don’t specify it, the API defaults to something or fails validation depending on the version. Usually, you want type to be “uploaded” or “static”. Also, make sure your Content-Type is application/json and not application/x-www-form-urlencoded.
Here is a working C# example using the .NET SDK PureCloudPlatformClientV2. It explicitly sets the type and handles the async response.
using PlatformClient;
using PlatformClient.Models;
public async Task<ContactList> CreateContactListAsync(string name, string description)
{
var api = new ContactListsApi();
var contactList = new ContactList
{
Name = name,
Description = description,
Type = "uploaded" // This is the key field you're likely missing
};
try
{
var result = await api.PostOutboundContactlists(contactList);
return result;
}
catch (ApiException ex)
{
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Response: {ex.ResponseContent}");
throw;
}
}
If you are using raw HttpClient, the JSON should look like this:
{
"name": "Test List v2",
"description": "Auto-generated test",
"type": "uploaded"
}
Try adding the type field. The error INVALID_VALUE is generic but often points to missing required schema properties that aren’t marked as strict in the Swagger UI by default.