Genesys cloud cxascode export flows only returns empty JSON array

I’m trying to export all our Architect flows for a backup using the CX as Code CLI. The docs say I should be able to run the export command and get a nice JSON file, but I’m just getting an empty array back.

Here’s the command I’m running:

gc cxascode export --output-dir ./backup --include flows

The auth is fine. I can list users and skills without any issues. The gc auth login worked, and I confirmed the token is valid by hitting the /api/v2/users/me endpoint directly.

The output file flows.json looks like this:

[]

I’ve tried adding --recursive and also specifying a specific flow ID, but it still comes back empty. I checked the environment variables and the GENESYS_CLOUD_ORGANIZATION_ID is set correctly.

Is there a specific permission or scope I’m missing for the OAuth token? The user I’m logging in with is an Administrator.

Also, I noticed in the debug logs it’s hitting /api/v2/architect/flows but the response body is just empty.

Anyone else hit this with the latest CLI version?

Cause:
The gc cxascode export command often returns an empty array if the underlying API call lacks the specific scope to read flow definitions or if the organization has a very large number of flows that exceed the default pagination buffer without a filter. It’s also common for the CLI to hang or return nothing if the OAuth token used for login doesn’t include flow:read.

Solution:
Try using the API directly with the Python SDK to verify if the data is actually accessible. This bypasses the CLI abstraction and gives you clearer error messages.

from genesyscloud import platform_client

# Initialize the client
client = platform_client.create()

# Get the Flow API instance
flow_api = client.flow_api

try:
 # Fetch flows with a reasonable page size
 response = flow_api.get_flows(page_size=25, expand=['skills', 'settings'])
 
 if response is not None and response.entities:
 print(f"Found {len(response.entities)} flows.")
 # Save to JSON manually
 import json
 with open('flows_backup.json', 'w') as f:
 json.dump(response.entities, f, indent=2, default=str)
 else:
 print("No flows returned. Check scopes.")
except Exception as e:
 print(f"Error: {e}")

If the SDK returns flows but the CLI doesn’t, it’s likely a CLI bug with the --include flag parsing. Also check your token scopes. You need flow:read. If you generated the token via the CLI login, ensure you didn’t select a restricted client.

The suggestion about the flow:read scope is spot on. I’ve run into this exact issue when setting up our DevOps pipelines. The CLI relies heavily on the scopes attached to the OAuth token used during gc auth login. If you used the default web login flow, it might not have grabbed all the necessary permissions for Architect resources.

You can verify the active scopes by checking the token details in the CLI output or by hitting the /api/v2/oauth2/introspect endpoint. If flow:read is missing, you’ll need to re-authenticate using a client credentials flow with a service account that has the Architect Admin role, or ensure your user file has the correct permissions.

Here is a quick way to test the API directly with curl to confirm the token works:

curl -X GET "https://api.mypurecloud.com/api/v2/architect/flows" \
 -H "Authorization: Bearer YOUR_TOKEN_HERE" \
 -H "Content-Type: application/json"

If this returns an empty array, double-check the org settings. Sometimes flows are archived and won’t show up in the default export. Also, make sure you aren’t filtering out disabled flows accidentally.