List a Space's access logs - Spacefast Docs

List a Space's access logs

Returns the HTTP requests the Space served, newest first, across every hostname it has answered on, including ones it stopped serving. Covers the last 24 hours unless since and until move the window, and a start older than the plan’s log retention is clamped with a log_retention_clamped warning naming the effective start. Page with cursor; a page can come back short or empty while hasMore is true. Share link tokens and signed blob paths are redacted out of path.

GET /v1/spaces/{spaceId}/logs/access

Authorization

Authorization Bearer token · header required

Authorization: Bearer <key> with the Space key (sfc_ prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's /_/<key> sign-in URL.

or

Authorization Bearer token · header required

Authorization: Bearer <token> with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).

Path parameters

spaceId string required

Query parameters

limit integer required

min 1 · max 100 · default: 20

cursor string

min length 1 · max length 4096

since string

matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:.\d+)?)?(?:Z))$

until string

Responses

200 Response for status 200

$schema string

Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.

data object[] required

Array of object

Same instant as timestamp. Read timestamp.

When the request was served.

Same value as hostname. Read hostname.

Hostname the request arrived on.

HTTP method, falling back to GET when the log omits it.

Request path with share secrets redacted out of the query string.

Response status code.

Response size in bytes.

pagination object required

Cursor for the next page. Null on the last page.

True when another page exists.

Diagnostics about the list itself. log_retention_clamped gives the since actually used when the requested window reaches back past the plan's log retention.

Example CURL Request:

curl -X GET "https://api.spacefast.com/v1/spaces/string/logs/access?limit=20" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example of JavaScript Request:

const response = await fetch("https://api.spacefast.com/v1/spaces/string/logs/access?limit=20", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  }
});

Example of Python Request:

import requests

response = requests.get(
    "https://api.spacefast.com/v1/spaces/string/logs/access?limit=20",
    headers={
        "Authorization": "Bearer YOUR_TOKEN"
    },
)

Sample Response:

{
  "$schema": "http://example.com",
  "data": [
    {
      "ts": "2019-08-24T14:15:22Z",
      "timestamp": "2019-08-24T14:15:22Z",
      "host": "string",
      "hostname": "string",
      "method": "string",
      "path": "string",
      "status": -9007199254740991,
      "bytes": 9007199254740991
    }
  ],
  "pagination": {
    "nextCursor": "string",
    "hasMore": true
  },
  "warnings": [
    {
      "code": "string",
      "severity": "info",
      "message": "string",
      "path": "string",
      "provider": "infra",
      "details": {
        "property1": null,
        "property2": null
      },
      "fix": "string",
      "retryable": true
    }
  ]
}