# Configure a Prefbook client

This guide configures an authorized client for Prefbook. Prefbook remains owner-only. The owner must create and approve any credential in Settings > Connect tools after recent interactive sign-in.

1. Use the Prefbook origin at which this guide was retrieved. Production is https://prefbook.uppercut-labs.com. A loopback origin is a synthetic local test environment.
2. Read GET /api/capabilities (send your token; it requires sign-in) and GET /api/openapi.json. Suite contract is 1.0.2. Discover actual product operations and scopes; do not invent generic CRUD routes.
3. Ask the owner to configure a named PAT with only prefbook:read selected. New PATs default to 90 elapsed days and accept 1 through 365 days. Prefbook shows the secret only once. Never copy it into a prompt, chat, URL, Git file or command argument.
4. Use PREFBOOK_TOKEN or an owner-only PREFBOOK_TOKEN_FILE through the Prefbook CLI, or the equivalent private Authorization header in an authorized client. Use environment/file references; never print a credential.
5. Verify GET /api/v1/session identifies the intended subject and authKind pat. Verify its effective scopes include only the deliberate permissions. GET /api/v1/snapshot is a read-only portfolio operation.
6. Hosted MCP is /mcp and requires the same app-specific PAT. Do not forward a token from another app. Capture-only, AI, export or write access must be separately selected. A PAT cannot manage PATs, restore backups, change provider keys or correct purchases as the owner.

Completion: demonstrate read-only session/capability discovery and an authorized snapshot without disclosing private records in logs. Explain the configured origin and narrow scopes; retain token values only in the approved private credential source.

Problem responses use application/problem+json with code, requestId, detail and retryable. Handle stale_revision by refreshing and preserving unsaved input. Never automatically retry a business mutation with a new idempotency key. Production deploys, credential rotation, data replacement and paid inference require separate owner authorization. This guide does not grant any of them.

After a restoration, read the current snapshot's datasetRevision and record writeRevision before making any separately authorized mutation. Pass datasetRevision in operation input or x-dataset-revision (CLI call also accepts --dataset-revision EPOCH); use the opaque writeRevision as the operation revision or matching If-Match. Do not reuse an old editor, cached token or queued creation from a prior restore generation. Numeric revisions alone are accepted only before the first restore. Backup preview/restore remains an interactive operator flow and ordinary PAT/MCP credentials cannot perform it.
