CX as Code CLI export failing on complex Architect flows with 400 error

I’m trying to get a full snapshot of our Architect flows using the CX as Code CLI for a backup process. We have over 200 flows, and I need them in JSON format to store in our git repo. I’m running the export command from the CLI tooling provided in the documentation, but it’s choking on a few specific flows.

The command I’m using is:

genesyscloud cx:ascode:export --resource-type architect-flow --output-dir ./flows

It processes about 30 flows fine, then hits a wall. The logs show a 400 Bad Request for a flow that uses a complex IVR structure with nested data actions. The error message in the console is pretty vague:

Error exporting flow 'Customer_Support_Enhanced': Failed to parse resource definition. Status: 400.

I’ve checked the flow in the UI and it’s valid. I can import it just fine manually. Is there a known issue with the CLI exporter handling certain data action types or large flow graphs? I tried exporting just that one flow using the --resource-id flag, but it fails with the same 400.

I’m on US/Pacific timezone, so maybe it’s a regional API issue, but the other flows export fine. Has anyone seen this behavior with the architect-flow resource type specifically?

The 400 error usually hits when the CLI tries to serialize a flow with circular dependencies or extremely complex sub-flow references that break the default JSON exporter. It’s not a bug in the tool, just a limitation in how it handles certain nested objects.

Try exporting those specific flows individually via the API instead of relying on the bulk CLI command. You can script this quickly. Here is a curl example to grab a single flow by ID:

curl -X GET "https://api.mypurecloud.com/api/v2/architect/flows/{flowId}" \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Accept: application/json"

If that works, you know the issue is the batch export logic. You might also want to check the --ignore-errors flag in the CLI, though it won’t fix the data corruption risk. Sometimes disabling the “include dependencies” option helps too.