422 Unprocessable Entity on POST /api/v2/agent-scripts/scripts with valid XML

Running into a weird validation snag when pushing agent scripts through the v2 API. We’ve got a pretty standard outbound scripting flow built in the UI, works fine when saved manually. Trying to automate the deployment with a Python script though, and the POST to /api/v2/agent-scripts/scripts keeps rejecting the payload. Returns a 422 Unprocessable Entity. The error response points to a malformed XML structure around the DynamicDataBinding node, but the exact same XML exports cleanly from the Architect UI.

Payload looks something like this:

{
 "name": "Q3-Collection-Script-v2",
 "description": "Updated dynamic fields for east coast region",
 "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Script version=\"1.0\"><Nodes><Node id=\"start\" type=\"start\"><Transitions><Transition id=\"t1\" target=\"dataBind\"/></Transitions></Node><Node id=\"dataBind\" type=\"dataBinding\"><Binding target=\"customer.balance\" source=\"{{externalData.accountBalance}}\"/></Node></Nodes></Script>"
}

Console logs show the request hits the endpoint. Auth token is valid, scope has Agent-Script:Write. The validation error specifically calls out Line 7, Column 12: unexpected token. Environment is running the latest Cloud Patch, SDK Version 2.41.0. Already tried stripping out the CDATA wrapper, adjusting the namespace prefixes, even rebuilt the XML string from scratch. Doing jack all to fix it. The UI exports it with a slightly different indentation, maybe the parser is choking on whitespace? Or maybe the API expects a specific Schema Version that isn’t documented anywhere. East Coast Queues are already complaining about the missing prompts, so this deployment is stuck in limbo.

Here’s the exact response body coming back:

{
 "code": "invalidRequest",
 "message": "XML validation failed: element 'dataBinding' not allowed here",
 "status": 422
}