*Cloud › Logs and shell*

# Stream a deployment's logs

```http
GET https://devapi.dispralabs.com/v1/cloud/deployments/:dep/logs/stream
```

Streams a deployment's build log (`kind=build`, the default) or its live output (`kind=live`), as Server-Sent Events. A build stream ends with `event: end` and the deployment's final state. Same lines, `tail`, gaps and resuming as the service stream.

Needs a key with `read` access or more.

- **Authentication:** Secret key (send it as `Authorization: Bearer <key>`)

## Parameters

- `dep` (string, required): The deployment's id. Example: `dep_01jdk4p7q9w1e3r5t7y9u1i3ob`
- `kind` (string, optional): build or live (default build). Example: `build`
- `tail` (number, optional): Start with the newest N lines, 0 to 750.
- `since` (timestamp, optional): Continue after this line's time.

## Returns

- **200**: A text/event-stream.

## Errors

| Status | Code | When |
|---|---|---|
| 400 | [invalid_tail](https://docs.dispralabs.com/errors.md#invalid_tail) | tail is 0 to 750. |
| 404 | [not_found](https://docs.dispralabs.com/errors.md#not_found) | No such object in the key's project (or environment). |

## Request samples

### Dispra Cloud CLI

```bash
dcloud logs --build dep_01jdk4p7q9w1e3r5t7y9u1i3ob
```

### cURL

```bash
curl "https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream?kind=build" \
  -H "Authorization: Bearer dsp_live_YOUR_KEY"
```

### Node

```javascript
const res = await fetch("https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream?kind=build", {
  method: "GET",
  headers: { Authorization: "Bearer dsp_live_YOUR_KEY" },
});
console.log(await res.json());
```

### Python

```python
import requests
res = requests.request("GET", "https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream", headers={"Authorization": "Bearer dsp_live_YOUR_KEY"}, params={"kind": "build"})
print(res.json())
```

### Go

```go
req, _ := http.NewRequest("GET", "https://devapi.dispralabs.com/v1/cloud/deployments/dep_01jdk4p7q9w1e3r5t7y9u1i3ob/logs/stream?kind=build", nil)
req.Header.Set("Authorization", "Bearer dsp_live_YOUR_KEY")
res, _ := http.DefaultClient.Do(req)
```

## Responses

### 200

```json
{}
```

### 400 invalid_tail

```json
{
  "error": {
    "code": "invalid_tail",
    "message": "tail is 0 to 750.",
    "request_id": "req_7f3a9c21d84be056"
  }
}
```

### 404 not_found

```json
{
  "error": {
    "code": "not_found",
    "message": "No such object in the key's project (or environment).",
    "request_id": "req_7f3a9c21d84be056"
  }
}
```

## Related

- [Log search and streaming](https://docs.dispralabs.com/features/log-search-and-streaming.md)
- [deploy.lifecycle](https://docs.dispralabs.com/flows/deploy-lifecycle.md)
