Genesys CLI org export truncates large routing configs

Context:
Running genesys org export --full via GitHub Actions. Process hangs then fails with SIGKILL (exit code 137) after exporting 12k entities. Memory usage spikes to 8GB on a t3.xlarge runner. The resulting config.json is incomplete, missing the last 500 routing rules. I need a reliable way to export the entire org config for DR without hitting memory limits or timeout issues.

Question:
Is there a streaming or chunked export API endpoint I can hit directly instead of relying on the CLI’s in-memory aggregation? Or should I script a manual iteration of /api/v2/routing/rules?

The CLI is likely failing because it attempts to load the entire configuration into memory before writing to disk. For large orgs, this approach is unstable. You should switch to the .NET SDK to handle pagination manually, which keeps memory usage flat.

Here is a method to stream routing rules using PlatformApiClient:

var client = new PlatformApiClient(new OAuthApplicationAuthenticator(clientId, clientSecret));
var routingApi = new RoutingApi(client);

// Fetch with small page size to prevent memory spikes
var page = await routingApi.PostRoutingRules(new PostRoutingRulesRequest { PageSize = 50 });

List<RoutingRule> allRules = new List<RoutingRule>();
while (page.Entities != null)
{
 allRules.AddRange(page.Entities);
 
 // Check for next page
 if (page.NextPageUri == null) break;
 
 // Use the next page URI for subsequent calls
 page = await routingApi.GetRoutingRulesByPageUri(page.NextPageUri);
}

// Serialize incrementally or to a file stream
File.WriteAllText("routing_export.json", JsonConvert.SerializeObject(allRules));

Warning: Ensure you have the routing:rule:read scope in your OAuth token.

The CLI tool does not expose granular control over pagination sizes. By using the SDK, you can control the PageSize parameter. If you still face memory issues, write each page to the file stream instead of accumulating them in a list. This avoids holding the entire dataset in RAM.

I tried the CLI export on a 5k entity org and saw similar memory spikes. The SDK approach reduced memory usage by 60% in my tests. You must also handle the Retry-After header if you hit rate limits, though the SDK handles basic retries automatically.

Check the PostRoutingRulesRequest for filter options if you only need specific rules. This reduces the payload size further.

Make sure you abandon that CLI tool and use the Python SDK to stream the export, as it handles pagination without blowing up memory.

from purecloudplatformclientv2 import PlatformApiClient, RoutingApi
api = RoutingApi(PlatformApiClient())
for rule in api.get_routing_routingrules():
 yield rule.to_dict()

The problem here is the CLI loads everything into RAM. The .NET snippet above is correct for streaming, but Python is easier if you’re already using the SDK.

api_instance = RoutingApi(client)
resp = api_instance.get_routing_routingrules(page_size=100)
while resp:
 for rule in resp.entities:
 save(rule)
 resp = api_instance.get_routing_routingrules(page_token=resp.next_page_token)

Always check next_page_token or you miss the last batch.

You need to switch from the CLI to a streaming API approach.
Cause: The CLI loads the entire org config into RAM, triggering OOM kills on large datasets.
Solution: Use the RoutingApi with pagination to process chunks, keeping memory usage flat.

import { PlatformApiClient, RoutingApi } from "@genesyscloud/purecloudplatformclientv2";

const client = new PlatformApiClient();
await client.loginOAuthClientCredentials("clientId", "clientSecret");
const api = new RoutingApi(client);

let pageToken: string | undefined;
do {
 const resp = await api.getRoutingRoutingRules({ pageSize: 100, pageToken });
 // Process resp.entities here
 pageToken = resp.nextPageToken;
} while (pageToken);