# Logs

`GET /v1/sites/{id}/logs` reads what the site's code wrote with `console`,
and the errors it threw, in the last hour. Newest first.

A site that is files only has no code, so it has no logs.

## Ask

| Parameter | Means |
|---|---|
| `slot` | read a draft's code, not the live code. `slot=1` is the first draft. |
| `limit` | the most lines to return, from 1 to 2000. The default is 200. |

## What the answer says

```json
{
  "lines": [
    { "time": "2026-09-30T12:00:03Z", "level": "error", "message": "D1_ERROR: no such table: orders" }
  ],
  "from": "2026-09-30T11:00:05Z",
  "to": "2026-09-30T12:00:05Z"
}
```

Lines can arrive some seconds after the request that wrote them. If a
line you expect is not there, ask again.

An error in the site's code is the site's to fix. Read the line, change the
code, and publish again.

---

## Where this page sits

This is one page of the Clave documentation.
Read it as a web page at https://docs.heyclave.com/api/logs.
Every page has a `.md` address, and https://docs.heyclave.com/llms.txt lists them all.

- Previous: [Analytics](https://docs.heyclave.com/api/analytics.md)
- Next: [Egress](https://docs.heyclave.com/api/egress.md)
- Index: [Overview](https://docs.heyclave.com/index.md)
