CX as Code CLI export fails on complex Architect flows

Trying to dump our entire Architect environment to JSON for backup using the CX as Code CLI. The command genesys-cloud-cx-as-code export architect --output ./backup works fine for simple IVRs, but it bails on our main sales flow. It throws a validation error about missing data action references. Here’s the snippet from the error log:

Error: Failed to export flow 'Sales_Q1_2024'. 
Validation error: Data action 'Get_CRM_Data' not found in scope.

The flow exists in the UI and works perfectly. I’ve tried adding --include-data-actions but that flag doesn’t seem to do anything. The JSON output stops halfway through the flow nodes. We’re using version 3.5.1 of the CLI. Is there a way to force export even if references are broken? Or do I have to manually patch the JSON? This is blocking our weekly backup process.

The CLI expects data actions to be in the same export scope. Try adding --include-data-actions to your command. If that’s already set, check if Get_CRM_Data relies on an external API definition that’s missing from the backup. You’ll need to export those dependencies too.

is spot on about the scope issue. I’ve hit this exact wall twice this month. The CLI is strict about dependency chains. If your data action calls an external API definition, that definition needs to be in the export bucket too.

Here’s what I do to stop the validation errors from spewing. First, check the data action config. If it references an API definition, you need to export that definition explicitly. The --include-data-actions flag helps, but it doesn’t always pull in the underlying API def unless you specify the scope correctly.

Try running the export with the --include-dependencies flag if your CLI version supports it. It’s newer but catches these nested refs.

genesys-cloud-cx-as-code export architect \
 --output ./backup \
 --include-data-actions \
 --include-dependencies

If that still fails, check the Get_CRM_Data action in Architect. Look at the “API Definition” field. Is it pointing to a custom def? If so, run this to grab the def first:

genesys-cloud-cx-as-code export api-definitions \
 --output ./backup/apis

Then run the architect export again. The CLI looks for the def in the local output folder. If it’s not there, it bombs out.

Also, watch out for environment variables in the data action. If the action uses a dynamic endpoint built from a variable, the CLI might flag it as invalid if the variable isn’t defined in the export context. I had to hardcode a dummy value just to get the export to pass validation, then swap it back in the JSON later.

It’s a pain, but once you get the dependency chain right, the export works. The error log usually points to the specific missing ref. Just follow that trail.