Skip to main content
The network module is only available on website applications. Narrow the type with app.isWebsite() first:

Custom domain

app.network.setCustomDomain(domain) sets or removes the custom domain bound to the website.
Custom domains require a Senior plan or higher. There is a daily per-user limit on how many times you can change a custom domain.
Attaching a custom domain beyond your plan’s load balancer limit (see Account-wide domains and load balancers below) fails with LOAD_BALANCER_LIMIT_REACHED (403).

DNS records

After attaching a custom domain you need to configure DNS at your registrar. app.network.dns() returns an array of DNS records to create.
Each record is { type, name, value, status }:
  • type is "txt" or "cname". TXT records cover domain ownership and SSL validation; the CNAME record carries traffic and always points value at cname.squareweb.app.
  • status reflects the current validation state, e.g. "pending", "pending_validation", or "active".

Analytics

app.network.analytics({ start, end }) returns aggregated edge analytics. start and end accept either ISO 8601 strings or Date objects. Maximum retention window is 7 days.
For empty windows (e.g. before the app was created) the API returns {}. Guard with "visits" in analytics before reading.

Drill-down filters

Beyond start/end, analytics() accepts optional filters. Each filter narrows every breakdown in the response at once, not just one of them:

Breakdowns

Alongside the existing time-series and top-N breakdowns, the response includes four breakdowns computed over the whole window (no time series): ips (IPs originating from Square Cloud’s own network are masked), status_codes, bots, and content_types. Each entry has the shape { type, visits, requests, bytes }.

Error tracking

app.network.errors({ start, end, include4xx? }) returns the edge error breakdown. By default only 5xx errors are included.

Per-request logs

app.network.logs({ start, end }) returns the per-request edge logs.
Per-request logs require a Pro plan or higher.

Latency percentiles

app.network.performance({ start, end }) returns p50 / p95 / p99 latencies for the edge and origin layers.
Performance metrics require a Pro plan or higher.

Purging the edge cache

app.network.purgeCache() invalidates the entire edge cache for the application’s domains.

Account-wide domains and load balancers

domains() and loadBalancers() live on api.applications, not app.network — they operate across every application in the account rather than a single website.

Listing every domain

api.applications.domains() returns every domain configured across all of the account’s applications.
Custom domains are listed first; applications without a web domain are omitted. Results are served from cache and rate limited to 20 requests/60s per user, which does not count toward the per-application network rate limits described above.

Load balancers

api.applications.loadBalancers() groups applications that share a custom domain.
A group with 2 or more apps is an active load balancer: traffic is balanced at the edge with automatic failover when one of the apps is offline. limit is the maximum number of applications that can share one domain on the account’s plan: 2 (Standard), 5 (Pro), 10 (Enterprise). Rate limited to 20 requests/60s per user.