Declare a JSON endpoint.
| Kind | Keyword |
| Since | 0.1.0 |
| Repeatable | yes |
api <path> [method <verb>] [requires <clause>]
| Name | Type | Required |
|---|---|---|
path |
path |
yes |
An api block defines a JSON-returning HTTP endpoint. Query results and computed values are serialized to JSON automatically. Use api for machine-to-machine integrations or SPA backends; use page for HTML, action for state-changing flows, and fragment for htmx.
api /api/v1/users requires auth
query users: SELECT id, name, email FROM user ORDER BY id
⚠ Implementation touched after spec. Source code changed on
2026-05-20, but this entity's spec was last edited on2026-05-08. The description may be out of date.
| Spec last touched | 5da8498 (2026-05-08) |
| Source last touched | af278bb (2026-05-20) |
| Source files | internal/parser/parser.go |