App data
Records owned by the application rather than by any one user — product catalogues, announcements, feature flags, pricing tables. Every user of the app sees the same rows.
Writes need a secret key
App data has no per-user scoping, so there is nothing for the server to pin a publishable key to. Reading it — get_app_data, iter_app_data, get_single_app_data and search_in_app_data — works with either kind of key. Writing it — add_app_data, update_app_data and delete_app_data — requires a secret key and raises InsufficientScopeError (403) with a publishable one.
That means writes belong on your server, with the secret key in an environment variable.
add_app_data
POST /api/app/:appId/data/:dataCategory
authix.add_app_data(*, data_category: str, data: dict) -> dict| Param | Type | Required | Description |
|---|---|---|---|
| data_category | str | Yes | A namespace — 'products', 'announcements'. Lower-cased and fixed on create. |
| data | dict | Yes | Any JSON-serialisable payload. |
Returns: dict — the created record
1record = authix.add_app_data(
2 data_category="products",
3 data={"sku": "A-1", "name": "Widget", "price": 1200},
4)Throws
get_app_data
GET /api/app/:appId/app-data
authix.get_app_data(
*, category: str | None = None,
limit: int | None = None, cursor: str | None = None,
) -> Page| Param | Type | Required | Description |
|---|---|---|---|
| category | str | No | Restrict to one category. |
| limit | int | No | 1–100. Defaults to 20. |
| cursor | str | No | next_cursor from the previous page. |
Returns: Page
1page = authix.get_app_data(category="products", limit=100)
2
3for product in page:
4 print(product["sku"])iter_app_data
GET /api/app/:appId/app-data (paged)
authix.iter_app_data(
*, category: str | None = None,
limit: int | None = None, max_pages: int | None = None,
) -> Iterator[dict]| Param | Type | Required | Description |
|---|---|---|---|
| category | str | No | Restrict to one category. |
| limit | int | No | Page size while iterating. |
| max_pages | int | No | Bound the traversal. |
Returns: Iterator[dict]
1catalogue = list(authix.iter_app_data(category="products"))get_single_app_data
GET /api/app/:appId/data/:itemId
authix.get_single_app_data(*, data_id: str) -> dict| Param | Type | Required | Description |
|---|---|---|---|
| data_id | str | Yes | The record id. |
Returns: dict
1product = authix.get_single_app_data(data_id=data_id)Throws
search_in_app_data
POST /api/app/:appId/app-data/search
authix.search_in_app_data(
*, q: str | None = None, category: str | None = None,
keys: dict | None = None,
limit: int | None = None, cursor: str | None = None,
) -> Page| Param | Type | Required | Description |
|---|---|---|---|
| q | str | No | Free-text match. |
| category | str | No | Restrict to one category. |
| keys | dict | No | Exact-match filter on payload fields. |
| limit | int | No | 1–100. |
| cursor | str | No | For the next page. |
Returns: Page
1page = authix.search_in_app_data(
2 category="products",
3 keys={"in_stock": True},
4 q="widget",
5)update_app_data
PATCH /api/app/:appId/data/:itemId
authix.update_app_data(
*, data_id: str, data: dict, version: int | None = None,
) -> dict| Param | Type | Required | Description |
|---|---|---|---|
| data_id | str | Yes | Which record. |
| data | dict | Yes | Fields to merge in. |
| version | int | No | The version you read, for optimistic concurrency. |
Returns: dict
1authix.update_app_data(
2 data_id=data_id,
3 data={"price": 1100},
4 version=product["version"],
5)Throws
delete_app_data
DELETE /api/app/:appId/data/:itemId
authix.delete_app_data(*, data_id: str) -> dict| Param | Type | Required | Description |
|---|---|---|---|
| data_id | str | Yes | Which record. |
Returns: dict
1authix.delete_app_data(data_id=data_id)Related