# List a Space's request logs

Returns HTTP access log entries for one Space, read live from the box serving it, restricted to the Space’s own hostnames and with share secrets stripped out of `path`. The window ends at the request and starts 24 hours before it unless `since` and `until` say otherwise, and it is raised to the plan’s access log retention when it reaches back further; a raised window is reported in `warnings`. The answer is a single page, so `pagination.nextCursor` is always null. A Space whose runtime is not provisioned yet has nothing to read and fails.

## API Endpoint

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

## 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>` 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) min length 1

## Query parameters

- `limit`: integer (required) min 1 · max 100 · default: 20
- `cursor`: string (optional) min length 1 · max length 4096
- `since`: string<date-time> (optional) - matches specific date-time format
- `until`: string<date-time> (optional) - matches specific date-time format

## Responses

### 200 Response for status 200

- `$schema`: string<uri> - Canonical JSON Schema URL for this response body.
- `data`: object[] (required)

- Array of `object`
    - `ts`: string<date-time> (required) - Same instant as `timestamp`.
    - `timestamp`: string<date-time> (required) - When the request was served.
    - `host`: string (required) - Same value as `hostname`.
    - `hostname`: string (required) - Hostname the request arrived on.
    - `method`: string (required) - HTTP method, default to `GET`.
    - `path`: string (required) - Request path with share secrets redacted from the query string.
    - `status`: integer (required) - Response status code.
    - `bytes`: integer (required) - Response size in bytes.

- `pagination`: object (required)
    - `nextCursor`: string | any (required) - Cursor for the next page. Null on the last page.
    - `hasMore`: boolean (required) - True when another page exists.

- `warnings`: object[] (optional) - Diagnostics about the list itself.
    - `code`: string (required) - Stable snake_case code for this diagnostic.
    - `severity`: string (required) - How serious the diagnostic is.
    - `message`: string (required) - What happened, in a sentence a person can act on.
    - `path`: string | any (optional) - File or artifact path the diagnostic refers to.
    - `provider`: string | any (optional) - Upstream system that raised the diagnostic.
    - `details`: object | any (optional) - Context keyed by the diagnostic code.
    - `fix`: string | any (optional) - What to change to clear the diagnostic.
    - `retryable`: boolean | any (optional) - True when repeating the same operation unchanged can clear the diagnostic.

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

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

```python
# Python Example
import requests

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

### 200 Default Response Example
```
{
  "$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
    }
  ]
}
```

### Error Response Example
```
{
  "$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"
}
```
