# phibac: full reference for AI coding agents phibac is a personal backend. Every end user has one private database on this server, and the apps that user approves share it. You build a web app as static files (any framework or none); the app stores and reads the user's data through the phibac SDK. You do not run a server, write SQL or handle passwords: users sign in with a passkey or a password in a popup on https://phibac.com, and the SDK keeps a local cache and an offline write queue. Server: https://phibac.com (mode: selfhost) Short index: https://phibac.com/llms.txt This document: https://phibac.com/llms-full.txt Remote MCP endpoint for agents: https://phibac.com/mcp Hard rule: developer tokens and agent tools manage apps and schemas only. They can never read, write, export or delete any user's data, and nothing can delete an app or a published collection. User data is reached only by an app running in the user's browser after the user signs in and consents. How to build an app, in order: 1. Get a developer token (pbd_...) from https://phibac.com/account/developer. On the local server (phibac dev) you need none: the CLI uses the server's own key in ./.pb/developer-token. 2. Create the app with its origins (create_app, or phibac init). 3. Define collections in pb.config.ts and publish them (publish_schema, or phibac deploy). Preview first (preview_schema, or the dry run phibac deploy does). 4. Generate TypeScript types (generate_types, or phibac generate). 5. In the app, call connect() from a click handler, then use collections. Sections below: quickstart, config, schemas, errors, consent, limits, sdk, cli, tools (the get_docs tool returns one section by these names). ## Quick start Interface spec (SDK and CLI): the code below uses the SDK and CLI interfaces described in the sdk, cli and config sections. 1. Install the SDK and the CLI in the project if they are not installed yet, then create the app and its config (the CLI reads PB_BASE_URL, and PB_TOKEN for this server). npx phibac runs the CLI installed in the project. On the local server that npx phibac dev runs (http://localhost:8787, the default when PB_BASE_URL is unset) no token is needed: init, deploy and native use the server's own key in ./.pb/developer-token. Never open, print or copy that file. npm install @phibac/sdk npm install --save-dev phibac export PB_BASE_URL=https://phibac.com export PB_TOKEN=pbd_... # from https://phibac.com/account/developer; not needed on the local server npx phibac init --name "Journal" --origin https://journal.example.com This creates the app (its ID starts with app_) and writes pb.config.ts. Register every origin the app is served from; http://localhost: may also be registered for development. 2. Describe the data in pb.config.ts (see the config section), then publish: npx phibac deploy deploy previews every collection first and publishes nothing if any change is breaking. 3. Generate types: npx phibac generate --out src/pb-types.ts 4. Use the SDK in the app: import { connect } from "@phibac/sdk"; import { SCHEMA_MAJORS, type ComExampleJournalEntryV1 } from "./pb-types"; button.onclick = async () => { // connect() may open the sign-in popup, so call it from a click handler. const backend = await connect({ app: "app_...", baseUrl: "https://phibac.com", schemaMajors: SCHEMA_MAJORS }); const entries = backend.collection("com.example.journal.entry"); await entries.create({ text: "Hello", mood: 4 }); // queued if offline entries.where("mood", ">=", 3).orderBy("createdAt", "desc").subscribe(render); }; create returns at once with status "pending"; the record becomes "synced" when the server confirms it. 5. Read another app's collection (read-only, after the user consents): const checkins = backend.collection("com.example.habits.checkin", { versions: [1] }); if (await checkins.requestAccess()) render(await checkins.list()); ## The app config file (pb.config.ts) Interface spec (SDK and CLI): the helpers below are exported by the CLI package; phibac deploy compiles this file to the wire JSON shown in the schemas section. import { defineApp, collection, string, number, integer, boolean, datetime, enumOf, json, fileRef, recordRef } from "phibac"; export default defineApp({ app: "app_...", // the app ID from phibac init or create_app collections: { "com.example.journal.entry": collection({ version: 1, // the major version description: "A journal entry written by the user", fields: { text: string({ description: "Entry text", maxLength: 20000, required: true }), mood: integer({ description: "Mood from 1 to 5", min: 1, max: 5, sensitive: true, indexed: true }), photo: fileRef({ description: "Optional photo" }), }, }), }, }); Helpers, one per field type; every one takes an options object with a required description: - string({ description, maxLength?, required?, indexed?, sensitive? }) - number({ description, min?, max?, required?, indexed?, sensitive? }) and integer({ ... }) (whole numbers) - boolean({ description, ... }) - datetime({ description, ... }): an RFC 3339 string - enumOf(["a", "b"], { description, ... }): one of the listed strings (wire type "enum", key "values") - json({ description, ... }): any JSON value; cannot be indexed - fileRef({ description, ... }): a file ID returned by files.upload - recordRef({ description, ... }): a record ID - collection({ version, description, fields }) and defineApp({ app, collections }) Mistakes the server would reject (a missing description, a bad name, enumOf with no values, maxLength on a non-string, indexed on json) are errors from phibac deploy that name the collection and field, before anything is sent. ## Schema rules Every collection except sandbox ones has a published schema. The wire JSON (what publish_schema, preview_schema and PUT /v1/apps/{appId}/collections/{name} take) is: {"name": "com.example.journal.entry", "version": 1, "description": "A journal entry written by the user", "fields": { "text": {"type": "string", "description": "Entry text", "maxLength": 20000, "required": true}, "mood": {"type": "integer", "description": "Mood from 1 to 5", "min": 1, "max": 5, "indexed": true, "sensitive": true}, "photo": {"type": "fileRef", "description": "Optional photo"}}} Allowed collection keys: name, version, description, fields (minor is assigned by the server). Allowed field keys: type, description, required, maxLength, min, max, values, indexed, sensitive. Unknown keys are refused. Naming: - Reverse-domain style, at least three dot-separated lower-case segments of letters, digits and -, each starting with a letter, at most 128 characters: com.example.journal.entry. - First come, first served: the app that first publishes a name owns it, and only that app can publish new versions. Use a namespace you control. - core.* and sandbox.* are reserved. core.profile (displayName, avatar, bio) is the platform's own collection; every app may request read access to it. - Field names start with a letter and use letters, digits and _ (at most 64 characters). createdAt and updatedAt are reserved. Field types: string, number, integer, boolean, datetime (RFC 3339 string), enum (needs "values": unique non-empty strings), json (any JSON; cannot be indexed), fileRef (a file ID), recordRef (a record ID). Options: required, maxLength (string only), min and max (number and integer only), indexed (lets queries filter and sort on the field), sensitive (named as sensitive on consent pages). Descriptions are required on the collection and on every field. Consent pages and these docs are generated from them, so say plainly what the data is. Versions: - version is the major version. The first publish of a name must be version 1. The next major is the latest + 1; you cannot skip. - Within a major version only additive changes are accepted, as a new minor version: adding an optional field, or changing descriptions, indexed or sensitive, widening a range, raising maxLength, adding enum values. - Everything else is breaking and must be published as the next major version: removing or renaming a field, changing a field's type, making a field required or no longer required, adding a required field, lowering maxLength, narrowing min or max, removing an enum value. A breaking change within a major fails with schema_incompatible and a "reasons" list such as "type changed: mood". - Publishing the same definition again changes nothing (kind "same"). - Nothing is ever deleted: old majors stay published, and records keep the major they were written with. A writing app writes its current major; a reading app declares which majors it accepts and receives only records of those majors. Publish result: {"collection", "major", "minor", "kind": "same" | "additive", "dryRun"}. A preview (dry run) returns the same shape and publishes nothing. Sandbox collections: a collection named sandbox. needs no schema and accepts any JSON object within the record size limit. It is private to the app that writes it, can never be shared with another app, and counts toward the user's storage. Publish a schema under a real name when the data should be shareable. Records: every record has an rkey (a UUIDv7 the device generates) and a global ID pb:////. Updates are shallow merges; a null value removes a field. When two devices write the same record, the server applies writes in the order it receives them; the replaced version is kept in the record's history for 30 days, and the user can restore it from the account page. ## Error codes Every error has the body {"error": {"code": "...", "message": "...", "hint": "...", ...extra}}. The message says what went wrong and the hint says how to fix the call; read both. Agent tools return the same JSON as their error text. The SDK throws errors with code, hint and the extra fields. - `invalid_request` (400): the request is malformed: bad JSON, an unknown key, a schema rule broken (missing description, bad name, wrong version number), a bad origin, an unknown query field. Fix the request as the message and hint say; do not retry it unchanged. - `unauthorized` (401): the token is missing, expired, revoked or of the wrong kind. Apps: the SDK refreshes tokens itself; if it still fails, call connect() again from a click so the user signs in. Developer API and agent tools: send "Authorization: Bearer pbd_..." with an active developer token (create one at https://phibac.com/account/developer). App tokens cannot call developer routes and developer tokens cannot call app routes. - `trial_ended` (402): the account's trial ended or its subscription lapsed (hosted servers only). For a user, their data is read-only until they subscribe: show a message, keep reads working, retry writes later. For a developer, publishing schemas (including previews) is refused until the account subscribes; existing apps and schemas keep working and apps can still be created and edited. - `forbidden` (403): the caller may not do this: writing another app's collection (cross-app access is read-only), changing an app another account owns or an app with no owner, publishing a collection name another app owns, or calling from an origin the app has not registered. Use your own collection names, the owning account's token, or add the origin with update_app_origins. - `consent_required` (403): the app has no read grant for another app's collection (or a file in it). The error carries consentUrl. Call collection.requestAccess() from a click (it opens the consent popup and resolves true when the user allows), then retry. Never loop on it: if the user denies, show the app without that data. - `app_suspended` (403): the operator suspended this app; every call fails and live updates close. Nothing in the app can fix it; show a message. The developer should contact the operator. - `not_found` (404): the app, collection, major version, record, file or route does not exist. Check the name or ID; get_schema and search_schemas list what is published. - `schema_incompatible` (409): a breaking change was published within a major version. The error has reasons (for example "field removed: title", "now required: mood"). Either make the change additive (add optional fields only) or publish it as the next major version ("version": latest + 1), and update the app to write the new major. - `record_deleted` (410): the record was deleted, possibly by another device. Drop it locally; to write again, create a new record with a new rkey. The SDK reports queued writes that hit this through onConflict. - `payload_too_large` (413): the record is over 256 KB, the file over 100 MB, or the request body over its limit. Store large content as a file and reference it with a fileRef field, or split a batch. - `schema_violation` (422): the record data does not match the collection's schema. The error has fields: [{path, reason}] with path the field name. Fix those fields (type, required, maxLength, min/max, enum values) or publish a new schema version. - `version_unsupported` (422): the write or query named a major version of the collection that is not published (the message lists the published ones). Use a published major, regenerate types, or omit the version to use the latest. - `rate_limited` (429): too many requests. Wait the number of seconds in the Retry-After header, then retry; the SDK's queue backs off by itself. Do not retry in a tight loop. - `internal` (500): a server error. Retry later with backoff; report it if it persists. - `storage_full` (507): the user's storage allowance is used up. Creates, updates and uploads fail; reads, deletes and export keep working. Deleting files frees space at once (DELETE /v1/files/{fileId}, or the user deletes files on their account's storage page). Deleted records free space only after their history is removed, 30 days later. Otherwise the user upgrades their plan. ## Consent and cross-app access - First connection: when the user first signs in to an app, they are asked " () will store data in your backend", Allow or Cancel. - An app may read and write the collections it owns (published by that app) and its own sandbox collections without asking. - Cross-app access is read-only. An app may read another app's collection only with the user's read grant, and can never write, update or delete another app's records (that is forbidden, always). - To ask for a grant, call collection.requestAccess() from a click handler. The consent page names the requesting app and its origin and the collection's description, says that allowing covers every entry in the collection in every version (including fields added later), lists the fields it currently includes with sensitive fields marked, and warns that the app could keep a copy of what it reads. It resolves true if the user allows. A consent request expires after 15 minutes. - A read grant covers the whole collection: every record, in every major version, including fields the owner adds later. The consent page says so and lists the fields the collection currently includes. Declare the majors your code understands with collection(name, { versions: [1] }); queries return only records of those majors, and the SDK drops records of other majors from the changes feed and live updates. - Users can revoke a grant on their account page at any time. It takes effect on the app's next request and closes its live subscriptions to that collection; the app then gets consent_required. - Files: a file is readable by the app that uploaded it and by apps that may read the collection it belongs to. - Every read of another app's data is shown in the user's activity log. When one app reads more than 1,000 records of another app's data in a day, the user is emailed. - The core.profile collection (displayName, avatar, bio) can be requested by any app the same way. ## Limits These are this server's settings. Records and queries: - Record data: at most 256 KB of JSON per record. - File: at most 100 MB. An upload link is valid for 10 minutes; a download link for 5 minutes. - Query page: 50 records by default, at most 500; use the cursor for more. - Batch: at most 100 operations and 4 MB per batch (the SDK splits its queue). - Changes feed: at most 1,000 changes per page. - Record history: previous versions are kept for 30 days. - Collection names: at most 128 characters; field names at most 64. - Apps: names of 1 to 100 characters, at most 20 origins. Sign-in tokens (the SDK manages them): - Access token: 15 minutes, bound to the browser's key. - Refresh token: 30 days, renewed at each use; reusing an old one ends the session. - Live-update ticket: 30 seconds, single use. Plans (hosted servers only; this server runs in selfhost mode, so no plan limits apply): - Trial: 14 days, 100 MB of storage, 5,000 requests per day, 1 GB of downloads per month. - Paid (10 USD per month or 100 USD per year): 25 GB of storage, 50,000 requests per day, 100 GB of downloads per month (fair use). - Bursts above 20 requests per second are slowed with rate_limited. - Over storage: creates, updates and uploads fail with storage_full; reads, deletes and export work; deleting files frees space at once. - Trial ended or payment lapsed: the account is read-only (trial_ended on writes and on publishing schemas); export works. The data is deleted 90 days after the lapse, after reminder emails and a final notice. ## SDK reference Interface spec (SDK and CLI): this section is the specified interface of the SDK package @phibac/sdk. import { connect } from "@phibac/sdk"; connect({ app, baseUrl?, schemaMajors? }): Promise - app: the app ID. baseUrl: this server (https://phibac.com). schemaMajors: the SCHEMA_MAJORS object from the generated types, so writes carry the major the app was built for. - Signs the user in if needed, which may open a popup on https://phibac.com. Call it from a click handler, or the browser blocks the popup (the SDK then throws popup_blocked). When the user is already signed in it needs no network, so the app starts offline too. Backend: - collection(name, { versions?, schemaMajor? }): Collection. versions: the majors the app reads (for another app's collection, list the ones your code understands). schemaMajor: the major to write (default: schemaMajors[name], else the latest). - files.upload(blob, { collection, rkey? }): Promise. Store the ID in a fileRef field. Uploads are not queued: offline or on any failure it rejects. - files.url(fileId): Promise, a short-lived download URL. - files.delete(fileId): Promise. Calls DELETE https://phibac.com/v1/files/{fileId} (with the app's token, like the other file calls), which removes the file and frees its storage at once, also when the account is full or read-only. Only the app that owns the file's collection (or whose sandbox it is) may delete it (otherwise it rejects with forbidden); the server answers {"fileId", "status": "deleted"}, and an unknown or already deleted file is not_found. File deletes are not queued: offline it rejects with a network error. Records whose fields name the file are not changed: clear or update those fields yourself. The user can also delete any of their files on their account's storage page. - onConflict(cb): cb({ op, error, localData }) runs when the server permanently rejects a queued write (record_deleted, forbidden, schema_violation, version_unsupported, not_found, invalid_request, payload_too_large, consent_required); the write is dropped and the cache reverted to the server's state, so show or re-create the data (localData is what the app had). Writes queued after a refused create of the same record are dropped the same way. A refusal of the whole batch request that no write caused (for example forbidden because the page's origin is not registered) drops nothing: the queue is kept, retried and shown in status().problem. Returns an unsubscribe function. - The queue replays in order through /v1/batch whenever the device is online, from one tab at a time. Network errors, 5xx, rate_limited, storage_full, trial_ended, unauthorized and app_suspended keep the write and everything after it queued and retry with backoff (1 s doubling to 60 s, at least Retry-After). - status(): { online, pending, problem? }: whether the server is reachable, how many writes are queued, and, while the queue or live updates are held up by something the user must fix (storage_full, trial_ended, app_suspended, account_closed, or consent_required for a subscribed collection the app may not read), that error, to show the user. - signOut(): Promise. Also deletes this user's cached records and queued writes for the app. Collection: - create(data): Promise>. Generates the rkey; works offline (queued). - update(rkey, patch): Promise>. Shallow merge; null removes a field. - delete(rkey): Promise. - get(rkey): Promise | null>. Reads the local cache at once, never waiting for the network. The first use of a collection in a session (and each reconnect, and a granted requestAccess) brings its cache up to date in the background; subscribe to be called when it lands. - list(): Promise[]>. Same, every cached record, oldest first. - where(field, op, value): Query, op one of "==", "!=", "<", "<=", ">", ">=", "in". Only indexed fields, createdAt and updatedAt can be filtered or sorted. - orderBy(field, dir?): Query, dir "asc" (default) or "desc". - subscribe(cb): calls cb(records) now and whenever the matching records change (live updates); returns an unsubscribe function. - requestAccess(): Promise. For another app's collection: opens the consent popup (call it from a click) and resolves true when read access is granted, false when denied or the popup is closed; popup_blocked when the browser blocks it. Query: where, orderBy, limit(n), get(): Promise[]>, subscribe(cb). Without limit(n) a query returns at most 500 records (online and offline alike); with limit(n) up to n, across as many server pages as needed. Online, get() runs on the server; offline it runs on the local cache with the same filter and sort rules (records lacking the order field come last, ties are broken by rkey, and no operator, not even "!=", matches a missing field). Queued local writes are included either way. subscribe(cb) evaluates on the local cache, kept current by live updates; a subscribed collection the app may not read (no consent yet) is left out of live updates until requestAccess() is granted, and the others keep theirs. Query limits (what a query cannot do) and workarounds. Read this before designing a screen: the SDK has no such features, so build them in your code as shown. - Filters combine with AND only. Every where() narrows the result; there is no OR and no grouping. Two where() calls on one field are both applied, which gives a range: where("score", ">=", 3).where("score", "<", 6). Workarounds: for one field equal to A or B, use the "in" operator (at most 500 values). For an OR across different fields, run one query per condition and merge the results by rkey in your code. Or store a derived indexed field (for example status: "open" or "done", updated whenever the record changes) and filter on that. - Results can be sorted by one field only. A second orderBy replaces the first, without an error. Only indexed fields, createdAt and updatedAt can be sorted, and records lacking the field come last. Workarounds: sort by the main field in the query, then sort the returned records by the second field in your code (ties already come back in rkey order). Or store a combined sortable string in an indexed field (for example "2026-11-14#0042": zero-pad numbers, write dates as RFC 3339) and order by that. - There is no text search: no contains, no case-insensitive match, no ranking. Workarounds: for "starts with", store a lowercase copy of the text in an indexed string field (titleLower) and use where("titleLower", ">=", "abc").where("titleLower", "<", "abd"). For "contains" on a small collection, read it with list() or a limit(n) query and filter in your code. For a large collection, keep a second collection with one record per keyword (an indexed keyword string and a recordRef to the record) and query it with "==". - There are no counts or totals: no count, sum, average or group-by, on the server or in the SDK. Workarounds: read the records and compute in your code. Without limit(n) a query stops at 500 records, so a count of get() results is wrong above that: pass a limit(n) larger than the collection can ever be (it pages through the server for you), or use list() for everything in the cache. This downloads every matching record, so narrow it with where() first. Avoid a stored counter or total in a record: when two devices change it offline, the server applies the writes in the order it receives them and the last one wins, so increments are lost. If you keep one, recompute it from the records when accuracy matters. - Linked records are not fetched automatically. A recordRef field holds the other record's id (pb:////), and reading a record never returns the record it points to. Workarounds: take the last part of the id (the rkey) and call collection().get(rkey), which reads the cache and returns null when the record is missing or deleted, so handle null (subscribe to be told when the cache catches up). For many links, read the other collection once with list() and look records up in a Map by rkey. To go from a parent to its children, mark the child's recordRef field indexed and query where("parent", "==", parentId). Another app's collection needs the user's consent first (requestAccess()). Deleting a record does not change the records that point to it. PbRecord: { id, collection, rkey, data: T, rev, status: "pending" | "synced", createdAt, updatedAt } - id is pb:////. rev increases with every change. createdAt and updatedAt are RFC 3339 strings. - status is "pending" until the server confirms the write, then "synced". The queue replays in order when the device is back online. Errors are thrown as PbError (exported by the package; an Error with code, hint and extra fields; see the errors section). The SDK's own codes: network (the server could not be reached, or did not answer within 30 seconds: every API request times out then; queued writes stay queued and are retried), invalid_response, popup_blocked, sign_in_cancelled, access_denied. ## CLI reference Interface spec (SDK and CLI): this section is the specified interface of the command-line tool. Every command reads PB_BASE_URL (this server: https://phibac.com; the default is http://localhost:8787). On the local server (PB_BASE_URL unset, or http://localhost:8787, http://127.0.0.1:8787 or http://[::1]:8787) init, deploy and native need no token: they use the key that phibac dev writes to ./.pb/developer-token in the folder it runs in (run them from that folder; they wait up to about 10 seconds for a server that is still starting). For any other server they need PB_TOKEN (a developer token, pbd_..., from that server's /account/developer page, such as https://phibac.com/account/developer), and mcp always needs PB_TOKEN, for the local server too. Exit codes: 0 success, 1 failure, 2 usage error. Errors say what to do next, with the server's code, message and hint. The token is never printed. - phibac init --name [--origin ]: creates the app and writes pb.config.ts with its app ID and a commented example collection. It will not overwrite an existing pb.config.ts. - phibac deploy: checks pb.config.ts, previews every collection (a dry run), prints each one as same, additive (with the new version) or breaking (with the reasons), and exits 1 without publishing anything if any is breaking or fails; otherwise it publishes the collections that changed. A breaking change needs the next major version: raise that collection's version in pb.config.ts. - phibac generate [--out ]: writes TypeScript types for the collections in pb.config.ts at the major versions it names (default src/pb-types.ts), from GET /v1/types. Needs no token. Run phibac deploy first. - phibac dev: runs a local server for development (billing off, data in ./.pb, http://localhost:8787; a PB_BASE_URL set for phibac deploy is not passed to it). It sets PB_LOCAL_DEV=1: the server writes its own developer key to ./.pb/developer-token before it listens, accepts connections only from this computer, and sends no email: sign-up goes straight to the confirm page, any email address works, and pages that would say "check your email" show that email instead. It also adds a .pb/ line to .gitignore (creating the file if needed). It keeps running: start it in the background. It runs the server that comes with the CLI: npm installs @phibac/server-- (darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64) with phibac as an optional dependency, at the CLI's version. PB_SERVER_BIN (a path) runs another build instead; PB_RELEASES_URL downloads one (https only, checked against a SHA-256 checksum) when no package is installed. With none it says why (no package for this computer, or installed with --omit=optional) and exits 1. - phibac native set [--ios .]... [--android =[,]...]..., phibac native show: registers, or prints, the iOS and Android apps that are the app in pb.config.ts. Each platform named is replaced as a whole; "none" clears it. The server has this; the mobile SDK is not released yet, so do not build a native app on it. - phibac mcp: a local MCP bridge (stdio, one JSON-RPC message per line) to https://phibac.com/mcp, for agents that cannot call a remote MCP endpoint. ## Agent tools (MCP) and the developer API The MCP endpoint is https://phibac.com/mcp (streamable HTTP). Every request needs "Authorization: Bearer pbd_..." with a developer token; the token's account is the acting developer. A missing or bad token gets 401 unauthorized. Tool errors are returned as tool errors whose text is the standard error JSON. A required argument that is missing or null is invalid_request. Tools (no tool reads, writes, exports or deletes user data, and none deletes an app or a collection): - create_app {name, origins[]}: creates an app owned by your account. Origins must be bare http(s) origins (scheme, host, optional port). - list_apps {}: the apps your account owns. - update_app_origins {appId, origins[]}: replaces an app's origins with the full list given (at least one). Owner only. - update_app_native {appId, ios?[], android?[]}: sets the iOS apps ({teamId, bundleId}) and Android apps ({package, sha256[]}) that are an app. Each list given replaces that platform's list; a list left out is not changed. Owner only. - preview_schema {appId, schema}: what publish_schema would do, publishing nothing. Same result and errors, including schema_incompatible with reasons. - publish_schema {appId, schema}: publishes a collection definition (the wire JSON in the schemas section). Owner only; within a major only additive changes; a breaking change must be the next major. - list_schemas {appId}: the collections the app owns with their published versions. Owner only. - get_schema {collection, major?}: a published schema (the latest major if major is omitted). Public. - search_schemas {query}: the latest version of each published collection whose name contains query. Public. - generate_types {collections[]}: TypeScript types; each item is "name" (latest major) or "name@"; at most 500 distinct items. - get_docs {topic}: one section of this document: quickstart, config, schemas, errors, consent, limits, sdk, cli or tools. Developer HTTP API (same token, same rules): - POST /v1/apps {name, origins}: 201 with {id, name, origins, status}. - PATCH /v1/apps/{appId} {name?, origins?}: the updated app. Owner only. - PUT /v1/apps/{appId}/collections/{collection}[?dryRun=true]: body is the collection definition; the URL must name the definition's collection. Returns the publish result. Public routes (no token): - GET /v1/schemas/{collection}[?major=N]: a published schema. - GET /v1/schemas?search=[&limit=N]: matching collections, latest version of each. - GET /v1/types?collections=a,b@2: TypeScript declarations (application/typescript), at most 500 distinct collections per request: one interface per collection and major, named after the name's segments in PascalCase plus V (com.example.journal.entry major 1 is ComExampleJournalEntryV1), and SCHEMA_MAJORS, the highest major of each name. - GET /llms.txt and GET /llms-full.txt: these docs.