User preferences
Preferences are a per-reader key/value store. Use it for things like a reader's favourite teams or
display choices. A value can be any JSON. A key can also hold an ordered list of items, which you
change with push, pop and the item routes.
Authentication
Send X-API-Key plus the reader's identity, either an HMAC assertion or an OIDC ID
token. Only end-user callers can use these routes. Other callers get 403.
A key is 1-255 characters. Write bodies take only { "value": … }.
Endpoints
| Method and path | Status | Returns |
|---|---|---|
GET /api/v1/preferences | 200 | [{ key, value }], cursor paging, limit 1-100 (default 20) |
GET /api/v1/preferences/{key} | 200 | { key, value }, or 404 if missing |
PUT /api/v1/preferences/{key} | 200 | { key, value } |
DELETE /api/v1/preferences/{key} | 200 | { key, deleted: true }, or 404 if missing |
GET /api/v1/preferences/{key}/items | 200 | { items: [{ id, value }] }, or 404 if empty |
POST /api/v1/preferences/{key}/push | 202 | { id } |
POST /api/v1/preferences/{key}/pop | 202 | {}, or 404 if missing |
PUT /api/v1/preferences/{key}/items/{itemId} | 202 | { id }, or 404 if the item is missing |
DELETE /api/v1/preferences/{key}/items/{itemId} | 202 | { id }, or 404 if the item is missing |
GET /api/v1/preferences/{key}/length | 200 | { length }, 0 if the key is missing |
GET /api/v1/preferences/{key}/search?value=<json> | 200 | [{ id, value }] |
Things to know
- Some writes are queued. A
202means the change was accepted, not applied yet. A read right after it may not show the change. PUTreplaces. It sets the value and clears any list items under that key.pushis not safe to retry. Each call creates a new item with a newid, so a retry adds a duplicate. There is noIdempotency-Keysupport on these routes.searchfilters by JSON. Pass thevaluequery parameter as URL-encoded JSON. It returns items whose value contains that JSON. Each search counts double against the rate limit.- Size. Requests are limited to 1 MiB.
- No events. Preference changes do not send webhooks or SSE events.
- Data export. Preferences are part of the user data export.