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.
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.
{ type, name, value, status }:
typeis"txt"or"cname". TXT records cover domain ownership and SSL validation; the CNAME record carries traffic and always pointsvalueatcname.squareweb.app.statusreflects 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.
Drill-down filters
Beyondstart/end, analytics() accepts optional filters. Each filter narrows every breakdown in the response at once, not just one of them:
| Filter | Notes |
|---|---|
country | 2-letter country code, e.g. "BR" |
ip | Exact IP match |
path | Prefix match, e.g. "/api" |
status | HTTP status code, e.g. "404" |
os | Operating system |
browser | Browser name |
protocol | Request protocol |
referer | Use "Direct" for requests with no referer |
provider | Network provider, e.g. "GOOGLE (15169)" (ASN) or "SQUARE-CLOUD-PLATFORM" |
contentType | Use "Unknown" for unclassified content types |
bot | Use "Unverified" for normal (non-bot) traffic |
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.
Load balancers
api.applications.loadBalancers() groups applications that share a custom domain.
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.
