---
title: "Settings, secrets and storage"
description: "Schema-driven plugin settings, encrypted secrets, and per-install storage."
---

> Documentation Index
> Fetch the complete documentation index at: https://edgecart.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Settings, secrets and storage

Plugins can expose merchant-configurable settings and keep per-install data.
Settings are declared in the manifest; storage collections are declared and
indexed there too.

## Settings schema

`admin.settings` is an array of fields:

```json
{
  "admin": {
    "settings": [
      {
        "name": "percent",
        "label": "Discount percent",
        "type": "number",
        "required": true,
        "min": 1,
        "max": 50,
        "default": 5
      }
    ]
  }
}
```

Supported field types: `string`, `number`, `boolean`, `select`, and `secret`.
Limits: at most 50 fields and 32 KiB of settings.

- Names are `snake_case`.
- `select` fields declare `label`/`value` options.
- `secret` fields are write-only. They can declare `egressHosts` for
  host-side HTTP header injection.

## Secrets

- Secret values are encrypted at rest with AES-256-GCM.
- The admin API never returns a stored secret; it returns a redaction sentinel
  and a `secret_configured` flag.
- An omitted or sentinel value preserves the stored secret; an empty string
  clears it.
- A plugin never receives stored plaintext. For outbound calls, the host
  injects the secret into a declared egress host's header.
- `PLUGIN_ENCRYPTION_KEY` is optional and falls back to a key derived from
  `TOKEN_SECRET`. During rotation, set `PLUGIN_ENCRYPTION_KEY_PREVIOUS`.

## Storage

Declare collections in the manifest:

```json
{
  "storage": {
    "loyalty_members": {
      "indexes": [["customer_id"]],
      "uniqueIndexes": [["customer_id", "store_id"]]
    }
  }
}
```

- Storage is scoped to the installation.
- The host enforces declared indexes and unique indexes.
- Use `ctx.storage.get/put/delete`; do not expect direct database access.

## Updating settings

Settings are updated through the Admin API:

```http
PATCH /api/plugins/installs/:id
Content-Type: application/json

{ "settings": { "percent": 10 } }
```

The request is validated against the manifest schema, capped at 32 KiB, and
uses the write-only secret rules above.

## Related

- [PluginContext](https://edgecart.dev/plugins/context)
- [Plugin manifest](https://edgecart.dev/plugins/manifest)
- [Capabilities and hooks](https://edgecart.dev/plugins/capabilities-hooks)

Source: https://edgecart.dev/plugins/settings-storage/index.mdx
