Get a Space's analytics - Spacefast Docs
Get a Space's analytics
Returns traffic for one Space over window, which defaults to the last 7 days: a request, view, and bandwidth series, the top 10 paths and hostnames, and daily unique visitors. Buckets are hourly for 48h and daily for 7d and 30d. A view is a request that answered under 400 and did not come from a crawler, assets included. Figures are read at request time from the box serving the Space, so a Space whose runtime is not provisioned yet fails.
GET/v1/spaces/{spaceId}/analytics
Authorization
AuthorizationBearer token · headerrequired
`Authorization: Bearer
or
AuthorizationBearer token · headerrequired
`Authorization: Bearer
Path parameters
spaceIdstringrequired
min length 1
Query parameters
windowstring
Allowed:48h``7d``30d
Responses
200Response for status 200
$schemastring
Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
dataobjectrequired
Show propertiesHide properties
spaceIdstringrequired
Space ID the traffic was aggregated for.
windowstringrequired
Window the summary covers.
Allowed:48h``7d``30d
sincestringrequired
Start of the window as an ISO 8601 timestamp.
untilstringrequired
End of the window as an ISO 8601 timestamp.
granularitystringrequired
Bucket width of series: hourly for 48h, daily for 7d and 30d.
Allowed:hourly``daily
viewsnumberrequired
Requests answered below status 400 that were not identified as crawler traffic, assets included.
bandwidthBytesnumberrequired
Response bytes served over the window.
visitorsByDayobject[]required
Unique visitors per UTC day. A day is the finest resolution the estimate is produced at, and the numbers are never summed across days.
Show propertiesHide properties
Array of object
datestringrequired
Start of the UTC day as an ISO 8601 timestamp.
visitorsnumberrequired
Estimated unique visitors that day.
topPathsobject[]required
The ten most requested paths over the window, largest first.
Show propertiesHide properties
Array of object
pathstringrequiredviewsnumberrequiredtopHostsobject[]required
The ten most requested hostnames over the window, largest first.
Show propertiesHide properties
Array of object
hoststringrequiredviewsnumberrequiredseriesobject[]required
Per-bucket traffic across the window, oldest bucket first.
Show propertiesHide properties
Array of object
bucketstringrequired
Start of the bucket as an ISO 8601 timestamp.
requestsnumberrequired
All requests in the bucket, crawlers and errors included.
viewsnumberrequired
Requests in the bucket that count as views.
bandwidthBytesnumberrequired
Response bytes served in the bucket.
defaultError. Every 4xx and 5xx response is one RFC 9457 problem document served as `application/problem+json`.
$schemastring
Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
typestringrequired
URL of the documentation page for this error. Derived from `code`.
titlestringrequired
Human-readable name of the error type. Derived from `code`.
statusintegerrequired
HTTP status of the response, repeated in the body.
min -9007199254740991 · max 9007199254740991
detailstringrequired
What went wrong in this request.
codestringrequired
Stable snake_case error code. Match on this, not on `detail`.
pointerstring
RFC 6901 JSON Pointer to the request field or batch entry that failed, for example `/files/37/path`. Present on validation failures.
detailsobject
Machine-readable context keyed by the error code.
suggestionsstring[]
Recovery steps safe to show to a person.
nextstring[]
Commands or API requests to run next, usable as written.
requestIdstringrequired
ID of this request, from the `X-Request-Id` header or generated. Quote it when contacting support.
Try it
Server
Base URLhttps://api.spacefast.com
Custom base URLOverrides the selected server when set.
Authorization
Bearer tokenRemember on this deviceInclude my values in samples
Parameters
spaceIdpath*windowquery—48h7d30d
Send
Request
cURL
curl -X GET "https://api.spacefast.com/v1/spaces/string/analytics" \
-H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch("https://api.spacefast.com/v1/spaces/string/analytics", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_TOKEN"
}
});
Python
import requests
response = requests.get(
"https://api.spacefast.com/v1/spaces/string/analytics",
headers={
"Authorization": "Bearer YOUR_TOKEN"
},
)
Response
200default
{
"$schema": "http://example.com",
"data": {
"spaceId": "string",
"window": "48h",
"since": "string",
"until": "string",
"granularity": "hourly",
"views": 0,
"bandwidthBytes": 0,
"visitorsByDay": [
{
"date": "string",
"visitors": 0
}
],
"topPaths": [
{
"path": "string",
"views": 0
}
],
"topHosts": [
{
"host": "string",
"views": 0
}
],
"series": [
{
"bucket": "string",
"requests": 0,
"views": 0,
"bandwidthBytes": 0
}
]
}
}
{
"$schema": "http://example.com",
"type": "string",
"title": "string",
"status": -9007199254740991,
"detail": "string",
"code": "string",
"pointer": "string",
"details": {
"property1": null,
"property2": null
},
"suggestions": [
"string"
],
"next": [
"string"
],
"requestId": "string"
}