---
title: "List a function's execution logs"
method: GET
path: "/functions/{id}/logs"
tags: ["Functions"]
---

# List a function's execution logs

`GET /functions/{id}/logs`

Returns the most recent `function_logs` rows for the function,
newest first. Each row is a single `console.log` / `console.error`
invocation captured from the running handler.

Page through history with the opaque `cursor` returned as
`next_cursor`; pass it back as the `cursor` query param on the
next call. `next_cursor` is `null` when there are no further
rows. The cursor format is an implementation detail and should
not be parsed by callers.

## Query parameters

- `limit` integer
- `cursor` string

## Response `200`

List of log rows (newest first) plus pagination cursor.

- object
  - `success` true, required
  - `data` object, required
    - `items` object[], required
      - `id` string, uuid, required — Unique log row id (stable across pages).
      - `function_id` string, uuid, required — The function this log row belongs to.
      - `level` 'debug' | 'log' | 'info' | 'warn' | 'error', required — Severity. `log` is the runtime's default for unannotated `console.log` calls; the other levels match standard `console.*` methods.
      - `message` string, required — The textual message body. The runtime stringifies non-string arguments before persisting, so this is always a plain string.
      - `ts` string, date-time, required — When the handler emitted this line. Newest-first ordering on this column drives pagination; clock is the runtime's, not the gateway's.
      - `metadata` object, nullable — Optional structured payload the runtime attaches alongside the message (e.g. extra args passed to `console.log`). Shape is opaque; treat keys as untyped.
    - `next_cursor` string, nullable, required — Pass back as `cursor` to fetch the next page. `null` when no further rows exist.

## Other responses

- `400` — Invalid request parameters
- `401` — Invalid or missing API key
- `403` — Authenticated caller lacks permission for the operation
- `404` — Resource not found

---

[API](https://skmtc.dev/primitive/apis/primitive-api.md) · [All operations](https://skmtc.dev/primitive/apis/primitive-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/primitive/primitive-api/revisions/c2299d28022c/schema)
