Could someone explain the correct syntax for exporting all Architect flows as JSON using the CX as Code CLI? I am trying to automate this for our nightly backups.
Run nice-cxone export --flow
Receive Error: No flows found. Use --all to export all.
Run nice-cxone export --flow --all
Output is empty or partial.
The documentation is vague on the --all flag behavior with specific resource types. Is there a hidden parameter for bulk export?
nice-cxone export --flow --all --destination ./exports is correct, but you likely hit the 500-flow pagination limit or lack the architect:flow:read scope. Use nice-cxone export --flow --all --destination ./exports --verbose to check for 403s, or switch to the Python SDK’s get_architect_flow with a cursor loop for reliable bulk extraction.
Pretty sure the CLI often fails on bulk exports due to scope limitations. The docs state “architect:flow:read” is required, but you also need “architect:flow:export”. Here is the minimal payload structure the CLI expects for validation.
Yep, this is a known issue… the CLI silently drops flows with invalid JSON references during bulk export. Do not rely on --all for critical backups. Use the REST API directly to ensure integrity.
As far as I remember, the cli export is just a thin wrapper around the standard rest endpoint, and it often fails to handle the cursor pagination correctly for large environments. you are hitting that 500-flow limit mentioned above, but the real issue is usually the token expiration during long-running bulk jobs. instead of relying on the cli flags, use the python sdk to handle the retry logic and token refresh automatically. here is a quick snippet to get all flows with proper cursor handling:
from platformclientv2 import Configuration, ArchitectApi, context
config = Configuration()
config.host = 'api.mypurecloud.com'
context.set_default(config)
architect_api = ArchitectApi()
flows = []
cursor = None
while True:
resp = architect_api.get_architect_flows(page_size=1000, cursor=cursor)
flows.extend(resp.entities)
if not resp.next_uri:
break
cursor = resp.next_uri.split('cursor=')[1]
this ensures you get every single flow without silent drops. the json structure remains consistent, so you can dump it directly to a file.