Exporting all Architect flows via CX as Code CLI

Trying to get a full dump of our Architect flows using the CX as Code CLI. I’ve been using the Terraform provider for queues and users, but the genesyscloud CLI tool seems to be the way to go for bulk flow exports.

I ran genesyscloud flow export --all in my project root. It started pulling data, but it’s hanging on about 15% of the flows. The terminal just sits there with no output, no error, nothing. I let it run for an hour thinking it was just slow, but nothing happened. I had to kill the process.

Here is the config I’m using in my genesyscloud.yaml:

org_id: my-org-id
api_key: my-api-key
export:
 flows:
 all: true
 output: ./exports/flows

I checked the API directly for one of the flows that was stuck. The GET request to /api/v2/architect/flows/{id} returns a 200 OK with the JSON payload. So the API isn’t rejecting the request. It’s something in the CLI’s processing logic.

I also tried exporting a single flow using genesyscloud flow export --id {flow-id}. That works fine. The JSON file is created in ./exports/flows. The structure looks correct:

{
 "id": "12345",
 "name": "Main IVR",
 "description": "Primary entry point",
 "metadata": {
 "createdBy": "admin",
 "updatedBy": "admin"
 },
 "document": {
 "startNode": "start",
 "nodes": [...] 
 }
}

The issue is only with the bulk export. Is there a limit on how many flows it can process in one go? Or maybe a timeout setting I need to adjust? I didn’t see any documentation on rate limiting for the CLI export command.

Also, the --all flag doesn’t seem to include draft flows. I checked the exported files and they are all published. We have about 20 draft flows that I need to capture too. Is there a flag for that? I tried --include-drafts but the CLI threw an unrecognized flag error.

What’s the right way to do a complete export? I need everything, published and draft, without the process hanging. I’m on version 1.2.3 of the CLI. Maybe I need to update? Or is there a workaround using the API directly to script this? I’d prefer not to write a custom script if the CLI can handle it, but I’m running out of options here.

Try exporting via the REST API directly instead of the CLI. The CLI hangs on complex flows often. Use /api/v2/architect/flows with X-Genesys-Include-Depends: true. Iterate through the list and fetch each flow individually. It’s slower but reliable. Here’s a quick curl example to grab one:

curl -X GET "https://api.mypurecloud.com/api/v2/architect/flows/{flowId}?includeDepends=true" \
 -H "Authorization: Bearer $ACCESS_TOKEN"