lll Documentation Source
Browse documentation

The lll board API

Use the configured API URL for PocketBase REST requests. LLL_URL or the effective url setting selects it; lll config list shows the value and its source. Local servers normally have separate API and board listeners. Hosted boards can serve the API at the board’s address through the /api/ proxy. The browser address is configured separately with web_url or LLL_WEB_URL.

Auth

Requests authenticate with a member token as a Bearer header:

Authorization: Bearer <token>

lll login stores your token from an interactive login; lll token create mints a long-lived one for an agent (superuser only). Both live wherever the CLI reads them. Scripts should authenticate too. Member access depends on the collection rules, team grants and server hooks; a token does not grant access to every collection or operation. Database superusers are separate from members with the workspace Admin role. See Permissions and the generated schema for each operation’s access rules.

The schema

lll api --schema prints the collection/field reference: every collection and field, its type, whether it is required, and the access rules a member token answers to. It is generated from the migrations (their end state — what the server actually enforces), not hand-typed; regenerate after schema changes with mise run api-schema. The gate runs gen_api_schema.py --check in e2e to detect differences between the generated reference and schema (LLL-435).

The raw passthrough

lll api METHOD PATH [--body TEXT] sends the request for you: it uses the configured URL and token, prints the response body to stdout and the status line to stderr, and shows non-200 responses as-is rather than as command errors:

lll api GET "/api/collections/issues/records?filter=(state='todo')"
lll api POST /api/collections/comments/records --body '{"issue":"...","body":"hi"}'

Optimistic writes

PATCH /api/collections/issues/records/{id} honours an If-Unmodified-Since header: pass the updated stamp your read returned, and the server answers 412 — without applying the write — when the record has changed since. The refusal body names the current stamp to retry with. Without the header the PATCH skips this timestamp precondition; other access and validation checks still apply. (lll issue update --if-unchanged-since sends it for you.) The header applies to the issues collection only.

Retried issue creation

POST /api/collections/issues/records accepts Idempotency-Key: <stable-key> for JSON requests. Keys are scoped per team. The first request creates an issue; matching retries return the current issue with reused: true and do not apply the creation again. A changed payload returns 409 with a conflict message. Fingerprints use canonical JSON, including origin and the enforced member creator; object key order is irrelevant. Key/fingerprint fields are server-owned and retain their creation values through subsequent edits. Deleting the issue removes its key reservation. Requests without a key keep ordinary creation behavior. Non-JSON keyed requests are explicitly refused.

Authenticate and check GET /api/lll/issues/idempotency for {"supported":true} before relying on the header: older servers can ignore unknown headers. lll issue create --idempotency-key KEY checks this before writing and reports Reused for matching retries. The lll skill gives a recipe for deriving a stable key.

Retried comments

POST /api/collections/comments/records accepts the same Idempotency-Key: <stable-key> header, with the same rules as issue creation, except that keys are scoped per issue. The same key on another issue makes a separate comment. A comment cannot move to another issue, so its key stays reserved on the issue it was written on. The fingerprint uses canonical JSON, including the agent label and the enforced member author. A matching retry returns the current comment with reused: true; a changed body returns 409.

Check GET /api/lll/comments/idempotency for {"supported":true} before relying on the header. A server that supports keyed issues may predate keyed comments, so the issue endpoint does not answer for comments. lll issue comment --idempotency-key KEY checks this before writing and reports Reused the comment for matching retries.

Asks

An ask is a question on an issue that a person has to answer. The asks collection holds them: issue, question, asker, agent, for_member, status (open, answered or unanswered), answer, answered_by, answered_agent and closed. asker_name and answered_by_name keep the names as they were when written, for an ask whose member is deleted later. An issue needs a human exactly while it has an ask with status open; nothing stores that as a field. Read asks through the collection, or on the issue with expand=asks_via_issue. The filter asks_via_issue.status ?= 'open' on issues selects the ones that need a human.

No member creates, updates or deletes an ask through the collection. Two routes write them, for any member who can write the issue’s team:

  • POST /api/lll/issues/{id}/asks with {"question": "...", "for_member": "<member id or empty>", "agent": "<label>"} opens an ask and returns it. A done or cancelled issue answers 409 with code issue_finished.
  • POST /api/lll/issues/{id}/asks/{ask}/answer with {"answer": "...", "agent": "<label>"} closes it and returns it. An ask that is already closed answers 409 with code ask_closed. The actor that opened the ask, the same member under the same agent label, answers 409 with code own_ask: someone else has to answer.

Moving an issue to done or cancelled while it has an open ask answers 409 with code open_asks and the questions in the message. Force with a reason finishes anyway: ?force=true&reason=... on the PATCH, or "force": true with "reason" on /close and /assignment. Force without a reason is refused with the same code; forcing past open descendants alone still needs none. Each open ask becomes unanswered, and the server writes a comment naming who forced it, the questions, any open descendants the same force overrode, and the reason.

Every ask write appends an audit row with collection asks: the create, the answer, and the forced change to unanswered.

Evidence

An evidence record is one command that was run for an issue. The evidence collection holds them: issue, command, exit_code (an integer), artifact (the stored name of one optional file, at most 20 MiB), member, agent and created. member_name keeps the member’s name as it was when written, for a record whose member is deleted later. Read records through the collection, or on the issue with expand=evidence_via_issue. A filter on issues can read them through the same back-relation: evidence_via_issue.exit_code ?= 0 selects the issues with at least one passing run. The artifact is a protected file: read it at /api/files/evidence/{record}/{artifact}?token=... with a token from POST /api/files/token.

No member creates, updates or deletes a record through the collection. One route writes them, for any member who can write the issue’s team:

  • POST /api/lll/issues/{id}/evidence with {"command": "...", "exit_code": 0, "agent": "<label>"} records one and returns it. To store an artifact, send multipart/form-data with the same fields as text and the file as artifact. command and exit_code are required: a request without an integer exit_code answers 400, because 0 is never assumed.

member is the member of the request’s token; a member in the body is ignored. agent is self-asserted, as on a claim. The server does not run the command and does not judge the exit code: a nonzero one is stored like any other, and a done or cancelled issue still accepts a record. A record never changes once written. There is no update route, and a create or an update through the records API answers 403 for a superuser too. A superuser may delete a record, which is audited. A record is deleted with its issue.

Every record appends an audit row with collection evidence. A create’s changes leave out a field left at its zero value, so a row without exit_code records exit code 0.

The audit log

Every create, update and delete of an issue, comment, claim, ask or evidence record appends one audit_events row in the same transaction as the write, whichever path made it: the records API, an /api/lll route, the claim-expiry sweep. A row names the collection, record and action, the issue (issue, number, team, project), who asked (actor member id, actor_kind person, bot, superuser or system, agent, origin_host) and changes: each changed field as {"from": ..., "to": ...}.

Read rows in order with sort=seq&filter=seq > N. seq is the cursor: it is assigned inside the write’s transaction, so a reader that has seen seq N has seen every row below it. Rows follow the issues read rule, so a scoped member reads only its teams’. No member and no superuser can create or edit a row; a superuser may delete one (retention).

The agent label and origin host are self-asserted: the CLI sends X-LLL-Agent (from LLL_AGENT) and X-LLL-Origin-Host on every request, and a comment’s or claim’s own agent label wins. lll activity reads the log.

Webhooks

POST /api/collections/webhooks/records registers a URL that receives the team’s issue events. lll webhook --help describes the payload and retries.

  • The secret is write-only. Send it in the create body as secret. No response, realtime event or expansion returns it, and a filter or sort on it is refused. Reads carry secret_set instead.
  • The creator is the caller. The server sets creator to the member who sent the create and ignores a body value. A webhook delivers only while its creator can read the webhook’s team. Webhooks created before this field existed, or by a superuser, have no creator; they deliver while their team exists. Deleting the creator deletes its webhooks.
  • Members cannot edit webhooks. PATCH is superuser-only, including when the member has the workspace Admin role. Members must delete the webhook and create it again.
  • Deliveries are not queued. A delivery waiting to be sent or retried when the server stops is lost.

Comment and claim event delivery

Existing webhook registrations and plain lll watch remain issue-only. Use lll watch --activity --json for live comment and claim events, or lll webhook add URL --activity for a receiver in the selected team/project. The CLI checks authenticated GET /api/lll/activity ({"supported":true}) before creating an activity webhook. An older server is refused before POST. Raw API registrations opt in with activity:true; omitted or false keeps the legacy default. Check support before relying on that field on an old server.

Activity envelopes carry topic, action, raw record, issue key, actor member id/name/kind and agent label. A claim’s holder is separate from its releasing actor. Scope rules apply to subscriptions; shared webhook names use the team’s shared roster. Webhook delivery is live-only, with no replay or durable outbox. lll watch reads the audit log instead and resumes with --after; see the CLI contract.

GET /api/lll/activity also names the log a cursor belongs to: {"supported":true,"log":"<id>","floor":N,"head":M}. log identifies this board’s audit log. floor and head are the lowest and highest seq it holds, both 0 while it is empty. A scoped member cannot read these bounds from the collection, whose rule hides other teams’ rows. A realtime subscription to audit_events delivers a create event per row under the same read rule; delivery order across writes is not guaranteed, so read rows in seq order rather than trusting the pushed order.

Accepting an invite as an existing person

POST /api/lll/invites/redeem with a valid member Authorization token applies its code to that authenticated person; any supplied name is ignored. The transaction unions authorized teams, consumes the code and records the same member as redeemed_by. No new token is minted (token is empty and existing is true); existing tokens retain the account’s updated access. joined_teams identifies the invitation’s teams for navigation. Anonymous redemption continues creating a new person and returns its token.

Bots, owned identities and incompatible member-wide access modes are refused without consuming the code. Identity comes from authentication, never an ID in the request body. Invite validity and creator access are rechecked in the same transaction as for a new person.