Token and secret management. access mints, lists, reveals and revokes access tokens (and identity tokens); secret stores encrypted values; expose and revoke manage identities; syncStore copies a store between environments. Owner/master only.
Manage store access tokens (master/owner only). The op field selects the operation - create (default), list, update, delete, reveal, reroll, identity, identity_update. The token is keyed by its HMAC id; list/update/delete/reveal/reroll address a token by that id (the hash). Tokens created after the reveal feature store an AES-encrypted copy of the raw value, so the reveal op can return it (legacy tokens predating this return a null token). The list op never includes the raw value. The reroll op replaces a token's raw value - a new token (new id) with the same role / access / scope / customer / note / metadata is written and the old value is revoked in the same batch; identity tokens minted from the old value are moved to the new one; a non-revealable token stays non-revealable. It answers {token, id, previous, identities, data} - the new raw token is shown here once (re-readable later through reveal when revealable). Platform-custodied tokens refuse it - module tokens with 409 managed_token, the tenant serving token (note CORE - Autogenerated, reroll through /project/hosting/reroll) and console member tokens (note MEMBER - Autogenerated) with 409 custodied_token. The identity op mints a user-level identity token derived from a parent access token (access_token override, or the caller's own token - a master token works as the parent too, so a master caller can mint directly); the new token inherits the parent's access tree with customer forced to user, is stored raw, and dies with the parent. The identity_update op edits an existing identity token's metadata in place (addressed by its raw identity token) - only note / meta / origins are mutable; an empty note or origins clears the field. Identity-token callers cannot mint or manage identity tokens. Module install tokens (note MODULE - {id}, minted by /api/module/install) are platform-managed - update, delete and reroll on one answer 409 managed_token; they change only through /api/module/{update,reroll,uninstall}.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | optional | Preferred in header, but store ID can be also used in request body. |
op | string | optional | Operation - create (default) | list | update | delete | reveal | reroll | identity | identity_update. |
id | string | optional | Token id (the stored hash, as returned by list). Required for update, delete, reveal and reroll. |
token | string | optional | Raw token to use on create (instead of auto-generating one). |
role | string | optional | Role tag - owner | editor | service (master requires a master caller). Used on create/update. |
access | object | optional | Tree of per-route grants. Used on create/update. |
scope | object | optional | Path scope - a second ACL tree matched against the ENTITY PATH a request targets (body.path on /admin/*, the path /public/web, /public/content and /admin/upload + /admin/folder build from their params), after the route tree passes. Keys are store subcollections (data, setup, orders, files, ...) plus the reserved roots $store (the store/{sid} doc), $promo (promo/{sid}/...) and $stock; under data the locale level is skipped, so data: {articles: true} means the collection in every locale; '*' matches one segment. Leaves - true = read + write, 'read' = read only, false = deny; fallback at any level is the default for unlisted keys, deny at the root. Reads = admin read/list/batch/count/aggregate + every /public route, everything else is a write. Absent = unrestricted (legacy). Used on create/update; pass null on update to clear it. Ignored for master sessions (store header *). A denied path answers 403 'Path not in token scope'. |
revealable | boolean | optional | Create only. Pass false to mint WITHOUT the stored reveal copy - the raw token exists only in this response; list shows revealable false and op reveal answers token null (like a legacy token). For platform-custodied tokens (the admin proxy's per-member tokens) that a store owner must not be able to reveal. Default true. |
customer | string | optional | Customer UID - used in B2B segment. |
user | string | optional | Customer ID the identity token acts as. Required for op=identity. |
access_token | string | optional | Raw parent access token override for op=identity - must belong to this store. |
identity | string | optional | Raw identity token to edit. Required for op=identity_update. |
metadata | string | optional | Set of developer data. |
meta | object | optional | Free-form developer data attached to a minted identity token (op=identity). |
origins | array | optional | op=identity only - allowlist of web origins the minted token is bound to. When set, the API only accepts the token when the request's Origin header matches one of them (use when embedding the token in an iframe so a leak can't be replayed from another page). |
note | string | optional | User description. |
Sample request
{
"note": "Blog editor (articles only)",
"role": "editor",
"access": {
"fallback": false,
"admin": true
},
"scope": {
"fallback": false,
"data": {
"fallback": false,
"articles": true,
"pages": "read"
},
"files": true,
"$store": "read"
}
}Creates a token (op defaults to create) that may call every admin/* verb, but only on the articles collection (any locale), read pages, write the files tree and read the store settings - every other path answers 403. Omit scope for an unrestricted token. Use op: list to see existing tokens.
Sync a single store's data between the Prod and Demo Firebase projects (master only). Copies Firestore documents under store/{sid}, Cloud Storage files under the store/{sid}/ prefix, and optionally the store's access tokens and secrets (admin-eur3) from the CURRENT environment to the target environment. Use mode to either mirror (wipe the target store first) or merge (upsert). Target env must differ from the current one. Access tokens and secrets only work in the target env when both share the same DROP_KEY.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | optional | Preferred in header, but store ID (sid) can also be used in request body as sid. |
target_env | string | required | Destination environment - prod | demo. Must differ from the current env. |
mode | string | optional | wipe (mirror - delete target store first) | merge (upsert, default). |
include | object | optional | Which data to copy - object with optional firestore, storage, access and secrets boolean flags. firestore and storage default to true; access and secrets default to false. Optional collections (string array) limits the Firestore copy to specific top-level parts of the store - each entry is a subcollection name (orders, data, customers, invoices, products, schemas, slug, members, files, setup) or the $store sentinel for the store root doc; omit for a full store copy. In selective mode wipe only clears the chosen parts. Optional docs (string array) scopes the copy to individual documents instead - each entry is a store-relative document path (even segment count, e.g. products/abc or data/cs_CZ/templates/welcome); only those docs and their subtrees are copied (wipe clears only each named doc tree). docs takes precedence over collections. Optional files (string array) copies specific files referenced by a document - each entry is a store-relative file metadata doc path (e.g. files/pages/files/hero); for each, its metadata doc plus its Storage object and resized variants are copied. docs/files power the admin "sync this document (and its files) to the other env" action. |
Sample request
{
"sid": "{storeId}",
"target_env": "demo",
"mode": "merge",
"include": {
"firestore": true,
"storage": true
}
}Copies the store from the current environment to target_env. Scope with include.docs (store-relative document paths) to sync single documents.
Process user managed secrets. This storage is typically used to handle api keys for third party services (like Stripe). A module install token (.dev/plans/custom-modules.md D30) reaches only its own keys - key must start with module_{id}_ and * is refused (403 module_secret_scope); the platform's custody of the token itself lives in another namespace this route never reads.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | optional | Preferred in header, but store ID can be also used in request body. |
key | string | list | required | Keys to process. Use * to return all keys. |
value | string | null | optional | Secret to store. Can be used only when single key is provided. When value is explicitly set to null, secret is removed. |
params | object | optional | Additional params for given key. |
Sample request
{
"key": "stripe_key",
"value": "sk_test_123abc",
"params": {
"note": "Stripe secret key (test mode)"
}
}Omit value to read the key's params, or set it to null to delete the secret. Use key: "*" to list all keys.
Exposes a secret, an access token, or a list of identity tokens. Pass secret (key) or access (raw token) to reveal one. Pass identities to list identity tokens instead - */true for all, or a customer id to scope to that user; an explicit user plus the standard list-query options narrow the result. Identity tokens are stored raw, so each item's id is a usable token value. Identity listing is admin-only (access-token caller, gated by the secure access tree); identity-token callers are rejected.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | optional | Preferred in header, but store ID can be also used in request body. |
access | string | optional | Actual token to retrieve. |
secret | string | optional | Actual secret to retrieve. |
identities | string | optional | List identity tokens - * (or true) for all, or a customer id to scope to that user. |
user | string | optional | Filter identity listing by customer id (when identities=*). |
query | object | optional | Firestore query filter for identity listing (field -> operator/value). |
limit | number | optional | Maximum number of identity tokens to return. |
order_by | object | optional | Ordering for identity listing (field -> 'asc' | 'desc'). |
offset | string | optional | Identity token id to start after (pagination). |
Sample request
{
"secret": "stripe_key"
}Revokes a secret, an access token, or identity tokens. Pass secret (key) or access (raw token) to delete one. Pass identity (a raw identity token), user (every identity token of that customer), or both to revoke identity tokens - the response carries the number of tokens revoked. Identity revocation is admin-only (access-token caller, gated by the secure access tree); identity-token callers are rejected.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
store | string | optional | Preferred in header, but store ID can be also used in request body. |
access | string | optional | Actual token to revoke. |
secret | string | optional | Actual secret to revoke. |
identity | string | optional | Raw identity token to revoke. |
user | string | optional | Customer id whose identity tokens are all revoked. |
Sample request
{
"secret": "stripe_key"
}