# Follow a build's events

Returns the same stored log page as the log operation by default, newest first. Send `Accept: text/event-stream` to follow the build live instead: a `build.log` event carries each new log line and a `build` event carries each status change, and the stream ends when the build settles. Resume a dropped stream with `Last-Event-ID`.

**GET** `/v1/builds/{buildId}/events`

## Authorization

`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

`buildId` string required

## Query parameters

`limit` integer required

min 1 · max 100 · default: 20

`cursor` string

min length 1 · max length 4096

## Responses

### 200 Response for status 200

```json
{
  "$schema": "string<uri>",
  "data": [
    {
      "timestamp": "string<date-time>",
      "level": "string",
      "code": "string",
      "message": "string"
    }
  ],
  "pagination": {
    "nextCursor": "string | any",
    "hasMore": true
  }
}
```

### Default Error
Every 4xx and 5xx response is one RFC 9457 problem document served as `application/problem+json`.

```json
{
  "$schema": "string<uri>",
  "type": "string",
  "title": "string",
  "status": -9007199254740991,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": [
    "string"
  ],
  "next": [
    "string"
  ],
  "requestId": "string"
}
```

## Try it

### Server
Base URL https://api.spacefast.com

### Parameters
`buildId` path * `limit` query * `cursor` query

### Send

#### Request

**cURL**

```bash
curl -X GET "https://api.spacefast.com/v1/builds/string/events?limit=20" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

**JavaScript**

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

**Python**

```python
import requests

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

### Response

#### 200 default

```json
{
  "$schema": "http://example.com",
  "data": [
    {
      "timestamp": "2019-08-24T14:15:22Z",
      "level": "string",
      "code": "string",
      "message": "string"
    }
  ],
  "pagination": {
    "nextCursor": "string",
    "hasMore": true
  }
}
```

#### Error example

```json
{
  "$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"
}
```
