# 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.

A draft keeps the logs of each call. The live site keeps the logs of 1
call in 10, with all the lines of that call. So find a fault on a draft.

## 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": "Error: no such table: orders: SQLITE_ERROR" }
  ],
  "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. On the live site, the call can
be one whose logs were not kept.

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.party/api/logs.
Every page has a `.md` address, and https://docs.heyclave.party/llms.txt lists them all.

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