CX as Code CLI: Architect flow export truncating JSON payloads

Running genesys cloud architect flows export via the CX as Code CLI is giving me incomplete JSON files for anything over 500 nodes. The command finishes with a 200 OK status, but when I open the resulting .json file, the blocks array cuts off mid-object. No error is thrown in the terminal.

Here is the command I am running:

genesys cloud architect flows export --flow-id 12345678-1234-1234-1234-123456789abc --out ./flows/

The output JSON looks like this near the end:

{
 "id": "12345678-1234-1234-1234-123456789abc",
 "name": "Main Routing Logic",
 "blocks": [
 {
 "id": "start",
 "type": "start"
 },
 {
 "id": "conditional_1",
 "type": "conditional",
 "conditions": [
 {
 "expression": "{{contact.queue}} == 'sales'"
 }
 ],
 "edges": [
 {
 "to": "queue_sales",
 "condition": 0
 },
 {
 "to": "queue_support",
 "condition": 1
 }
 ]
 },
 {
 "id": "queue_sales",
 "type": "queue",
 "settings": {
 "queueId": "98765432-9876-9876-9876-987654321abc",
 "timeout": 600,
 "callbackEnabled": true,
 "callbackSettings": {
 "callbackNumber": "{{contact.c"

It just stops. No closing brackets. No syntax error. Just a cut-off string. I have tried increasing the buffer size in the CLI config, but there isn’t a clear flag for that. The API endpoint /api/v2/architect/flows/{flowId} returns the full payload in Postman, so the issue seems isolated to the CLI export function.

Is there a known limit on the CLI tool for large flows? Or am I missing a flag like --full or --no-truncate? I’ve checked the docs and the help text (genesys cloud architect flows export --help), but nothing mentions payload size limits. We have a few complex flows with deep nesting that are all failing this way. Need to get these into our Terraform state without manual editing.

The CLI is likely hitting a buffer limit or just choking on the payload size. The raw API endpoint /api/v2/architect/flows/{id} handles this fine, so I usually bypass the CLI for big exports.

Here is how I do it in C# using the official SDK. It’s way more reliable than wrestling with CLI flags.

var platformClient = PlatformClientFactory.CreateClient();
await platformClient.Authorize().AuthenticateAsync("client_id", "client_secret", "https://your-domain.genesyscloud.com/oauth/token");

var flowResponse = await platformClient.Architect.FlowsApi.GetArchitectFlowAsync(flowId, expand: new[] { "all" });
var json = JsonSerializer.Serialize(flowResponse.Entity, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText("flow.json", json);

You gotta make sure you include the expand: ["all"] parameter. Without it, you only get the skeleton, which might explain why your blocks array looks cut off or incomplete. The CLI documentation doesn’t explicitly warn about this truncation behavior for large flows, which is annoying.

Also, check if your flow has any massive script blocks. Sometimes the JSON serializer in the CLI tool has a hardcoded limit. If the API call above works, you know it’s a CLI bug, not your flow.