# Layer Configuration (/docs/layers/config)



Each layer has a `config` JSON document. The settings tab is a UI on top
of that JSON; advanced users can edit JSON directly.

## Settings UI [#settings-ui]

The standard way. Each template renders its own form using shadcn primitives

* react-hook-form. Changes are validated against the template's
  `config_schema` and applied immediately on save.

## Raw JSON editor [#raw-json-editor]

For Project Admins, click **View as JSON** at the bottom of the settings
tab. You can edit the raw config and save. Validation still applies.

## Per-layer cron [#per-layer-cron]

Most templates have at least one `*-scheduled` command. The default cron
comes from the template; you can override per-layer:

```json
{
  "schedule": { "cron": "37 9 * * *" }
}
```

The scheduler uses `COALESCE(pl.schedule->>'cron', template_default_cron)`
to ensure exactly one cron per layer — no double execution.

Useful for:

* **Timezone-specific batching** — your project's timezone is `Asia/Tokyo`
  but the template default is UTC.
* **Spreading load** — many projects share the default cron; override busy
  ones.
* **Per-client SLAs** — premium clients on faster cadence.

## Common config patterns [#common-config-patterns]

### Distribution mode (Social Distribution) [#distribution-mode-social-distribution]

```json
{
  "distributionMode": "automatic" | "custom" | "manual",
  "willPublish": true | false
}
```

`automatic` lets the system schedule and publish on its own. `custom` lets
you control the scheduling cadence. `manual` queues posts for a human
approval step before they can be scheduled.

### CAPI (Meta / TikTok Ads) [#capi-meta--tiktok-ads]

```json
{
  "capi": {
    "enabled": true,
    "pixel_id": "1234567890",
    "access_token_vault_id": "vault_abc"
  }
}
```

`access_token_vault_id` references an entry in the
[Layers credential vault](/docs/trust/vault) — the actual token never
appears in config.

## Diff & rollback [#diff--rollback]

Every config change is recorded. Click **History** in the settings tab to
see prior versions and rollback.
