Skip to main content
The endpoints on this page apply only to website applications — apps with a web domain. Calling them on a non-web application fails.

Custom domain

api.SetApplicationCustomDomain(appID, domain) sets the custom domain bound to the website.

DNS records

After attaching a custom domain you need to configure DNS at your registrar. api.GetApplicationDNS(appID) returns the records to create as a []squarecloud.DNSRecord.

Analytics

api.GetApplicationAnalytics(appID, start, end) returns aggregated edge analytics for the given window as a squarecloud.NetworkAnalytics. The window is required, and the maximum retention is 7 days.
The response carries 15-minute time series (Visits, Countries, Devices, OS, Browsers, Protocols, Methods, Paths, Referers, Providers) and whole-window buckets (IPs, StatusCodes, Bots, ContentTypes).
For a window entirely before the application was created, the API returns an empty object — every slice in the response is nil. Check lengths before indexing.

Drill-down filters

Beyond the window, the endpoint accepts optional filters as query parameters — pass them with rest.WithQueryParam. Each filter narrows every breakdown in the response at once:

Error tracking

api.GetApplicationNetworkErrors(appID, start, end) returns the edge error breakdown. By default only 5xx errors are included — add include_4xx=true to include 4xx.

Per-request logs

api.GetApplicationNetworkLogs(appID, start, end) returns the per-request edge logs.
Per-request logs require a Pro plan or higher.

Latency percentiles

api.GetApplicationNetworkPerformance(appID, 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

api.PurgeApplicationCache(appID) invalidates the entire edge cache for the application’s domains.

Account-wide domains and load balancers

These two methods operate across every application in the account rather than a single website.

Listing every domain

api.GetApplicationDomains() returns every domain configured across all of the account’s applications as a []squarecloud.AppDomain. Custom domains are listed first; applications without a web domain are omitted.

Load balancers

api.GetLoadBalancers() groups applications that share a custom domain, returning a squarecloud.LoadBalancers.
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).