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.
| Field | Type | Description |
|---|---|---|
Type | string | "txt" or "cname" — TXT records cover ownership and SSL validation; the CNAME carries traffic and always points at cname.squareweb.app |
Name | string | Record name to create |
Value | string | Record value |
Status | string | Validation state: "pending", "pending_validation" or "active" |
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.
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 withrest.WithQueryParam. Each filter narrows every breakdown in the response at once:
| 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) |
content_type | Use "Unknown" for unclassified content types |
bot | Use "Unverified" for normal (non-bot) traffic |
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.
Limit is the maximum number of applications that can share one domain on the account’s plan: 2 (Standard), 5 (Pro), 10 (Enterprise).
