HTTP 422 Unprocessable Entity
Error: validation_failed [outbound.campaign.rebalance_schema_invalid]
at client.PatchCampaignDistribution() line 112
The /api/v2/outbound/campaigns/{campaignId}/distributions endpoint rejects the Go struct when I push the geographic weighting matrix. The dialer constraints flag max daily contact limits as exceeded since it doesn’t match the OpenAPI spec.
Running the DNC compliance pipeline before the atomic PATCH, but the automatic queue flush trigger never fires. CRM callback handler gets the event while allocation accuracy drops. Format verification step drops the payload mid-request.
You running the Go standard library marshaller or some custom encoder?
Validation errors usually mean the payload shape is garbage. Outbound API is picky about the rebalance schema. You probably dropped a required field or the type is totally wrong. My ETL jobs fail when the campaign state flips to invalid, so you don’t want that.
Check your struct tags. The Weight field needs to be an integer, not a float.
Ensure the Type field is explicitly set to weighting.
Verify the DialerConfig reference isn’t null.
Try this struct definition. It forces the correct JSON output.
type RebalancePayload struct {
Type string `json:"type"`
Weight int `json:"weight"`
Priority *int `json:"priority,omitempty"`
}
The backend rejects floats for weight. You’ll hit the same wall if you send decimals. Also check the maxDailyContactLimit. The API validates constraints atomically. Fix the type and the PATCH goes through.
hey! ran into this exact thing a while back lol. it’s almost always the weight values tbh. The suggestion above is right to check those struct tags, but it’s weirder than just floats - mypurecloud.com.au chokes on anything above a 32-bit integer for the weight field.
We had a similar issue pushing weighting for a new campaign in NSW - it kept rejecting with that same 422. Turns out the weighting matrix had a value of 2147483648, which is just outside the 32-bit range.
Try capping your weights to 2147483647. It sounds dumb, but it fixed it for us. Here’s the bit of Go that finally worked:
type Distribution struct {
CampaignID string `json:"campaignId"`
Weight int32 `json:"weight"` //Important: use int32 not int or float
// other fields
}
Also, the Sydney edge on mypurecloud.com.au is kinda sensitive with the request size. If the weighting matrix gets huge, it can timeout even before the validation fails. Keep the payload under 2KB if you can. It’s a built-in cutoff. report back if capping the weights doesn’t do it.
variable "weight_limit" {
type = number
default = 2147483647
}
The OpenAPI schema doesn’t document the integer size constraint - why would it? The weight field silently overflows at 2147483648, triggering that validation_failed [outbound.campaign.rebalance_schema_invalid] (422) error. Terraform variable validation helps prevent pushing invalid configurations.