I’m automating the creation of outbound contact lists via the Genesys Cloud API as part of our Terraform workflow. The goal is to spin up a fresh list, push a CSV via the records endpoint, and then kick off a campaign. We’ve got this working fine in the UI, but the API is throwing a fit.
I’m hitting POST /api/v2/outbound/contactlists with the following payload. The docs say type is required, and I’m setting it to upload.
{
"name": "Marketing_Campaign_Q3",
"type": "upload",
"description": "Q3 Leads",
"contactFields": [
{
"name": "phone",
"type": "phone",
"required": true
},
{
"name": "email",
"type": "email",
"required": false
}
]
}
The response is a 400 Bad Request with the code INVALID_VALUE. The message isn’t super helpful, just saying “Validation failed for one or more fields.” I’ve checked the auth token, it’s good. I’ve tried removing the description field, no luck. I’ve tried swapping phone for phoneNumber in the name, still nothing.
It feels like it might be the contactFields structure. In the Terraform provider, we usually just define the schema implicitly, but the API seems to want explicit field definitions. Is there a specific format for the contactFields array that I’m missing? I’ve seen examples where id is included, but this is a new list, so there’s no ID yet.
Also, I’m in US/Eastern, so maybe there’s a region-specific quirk? Doubt it, but worth a shot. I’ve been staring at this for an hour and my brain is mush. Any idea what’s tripping up the validator? I’ve got a deployment window closing in an hour and I’d rather not do this manually.
Here’s the raw response header for good measure:
x-cx-one-request-id: 9f8e7d6c-5b4a-3210-fedc-ba9876543210
I’ve also tried using the Python SDK genesyscloud_outbound_contact_list_create method with the same dict, same error. So it’s not a curl thing. It’s the payload. Just can’t see the wood for the trees.