Skip to content

SmartRouting

Source: src/Cloudflare/Argo/SmartRouting.ts

Argo Smart Routing for a Cloudflare zone (/zones/{zone_id}/argo/smart_routing).

Argo Smart Routing routes traffic across Cloudflare’s network over the least-congested, most-reliable paths instead of standard BGP routes, reducing time to first byte for origin-bound requests.

The setting is a singleton — it always exists on every zone with a Cloudflare default, so this resource never creates or deletes anything physical. Reconcile patches the setting when the observed value differs from the desired one; destroy restores the value the setting had before Alchemy first managed it (captured as initialValue).

Argo Smart Routing is a paid, usage-billed add-on. On a zone without the Argo subscription every read or patch of this setting fails with the typed NotAuthorized error (Cloudflare code 1015) — purchase the add-on on the zone before managing this resource.

Enable Argo Smart Routing on a zone

const zone = yield* Cloudflare.Zone("Site", { name: "example.com" });
yield* Cloudflare.SmartRouting("SmartRouting", {
zoneId: zone.zoneId,
});

Explicitly disable Argo Smart Routing

yield* Cloudflare.SmartRouting("SmartRouting", {
zoneId: zone.zoneId,
enabled: false,
});