*Cloud › Logs and shell*

# List logs

```http
GET https://devapi.dispralabs.com/v1/cloud/projects/:prj/logs
```

Searches the project's logs: build output and what its services write, newest first, in pages of up to 750 lines. Filter by service, deployment, level, time and text. Without `from`, the last 7 days. Page back with `next_cursor`.

Needs a key with `read` access or more.

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

## Parameters

- `prj` (string, required): The project's id. Example: `prj_01jdk3m9x2v7c4q8w5n6b1t0ra`
- `svc` (string, optional): Only this service. Example: `svc_01jdk3n2f4g6h8j0k2l4z6x8ca`
- `dep` (string, optional): Only this deployment.
- `level` (string, optional): Levels, comma separated. Example: `warn,error`
- `q` (string, optional): Text to search for. Example: `timeout`
- `from` (timestamp, optional): From this time (RFC 3339).
- `to` (timestamp, optional): Until this time (RFC 3339).
- `cursor` (string, optional): The next_cursor of the previous page.
- `limit` (number, optional): Lines per page, 1 to 750 (default 50). Example: `200`

## Returns

- **200** [The log page object](https://docs.dispralabs.com/objects/the-log-page-object.md): A page of lines.

## Errors

| Status | Code | When |
|---|---|---|
| 400 | [invalid_limit](https://docs.dispralabs.com/errors.md#invalid_limit) | limit is 1 to 750. |
| 404 | [not_found](https://docs.dispralabs.com/errors.md#not_found) | No such object in the key's project (or environment). |
| 503 | [logs_unavailable](https://docs.dispralabs.com/errors.md#logs_unavailable) | Logs can't be read right now. Retry shortly. |

## Request samples

### Dispra Cloud CLI

```bash
dcloud logs api --page --limit 200 --search timeout
```

### cURL

```bash
curl "https://devapi.dispralabs.com/v1/cloud/projects/prj_01jdk3m9x2v7c4q8w5n6b1t0ra/logs?svc=svc_01jdk3n2f4g6h8j0k2l4z6x8ca&level=warn%2Cerror&q=timeout&limit=200" \
  -H "Authorization: Bearer dsp_live_YOUR_KEY"
```

### Node

```javascript
const res = await fetch("https://devapi.dispralabs.com/v1/cloud/projects/prj_01jdk3m9x2v7c4q8w5n6b1t0ra/logs?svc=svc_01jdk3n2f4g6h8j0k2l4z6x8ca&level=warn%2Cerror&q=timeout&limit=200", {
  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/projects/prj_01jdk3m9x2v7c4q8w5n6b1t0ra/logs", headers={"Authorization": "Bearer dsp_live_YOUR_KEY"}, params={"svc": "svc_01jdk3n2f4g6h8j0k2l4z6x8ca", "level": "warn,error", "q": "timeout", "limit": "200"})
print(res.json())
```

### Go

```go
req, _ := http.NewRequest("GET", "https://devapi.dispralabs.com/v1/cloud/projects/prj_01jdk3m9x2v7c4q8w5n6b1t0ra/logs?svc=svc_01jdk3n2f4g6h8j0k2l4z6x8ca&level=warn%2Cerror&q=timeout&limit=200", nil)
req.Header.Set("Authorization", "Bearer dsp_live_YOUR_KEY")
res, _ := http.DefaultClient.Do(req)
```

## Responses

### 200

```json
{
  "data": {
    "items": [{"id":"ln_8f2c1a","ts":"2026-12-05T10:15:02Z","level":"info","message":"GET /healthz 200 3ms"}],
    "next_cursor": "c_1764324999_8f2c1a",
    "total": 1832,
    "total_cap": 10000
  }
}
```

### 400 invalid_limit

```json
{
  "error": {
    "code": "invalid_limit",
    "message": "limit is 1 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"
  }
}
```

### 503 logs_unavailable

```json
{
  "error": {
    "code": "logs_unavailable",
    "message": "Logs can't be read right now. Retry shortly.",
    "request_id": "req_7f3a9c21d84be056"
  }
}
```

## Related

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