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

> ## Agent Instructions
> Read /start/capabilities before choosing an integration. Use the deployed server’s tools/list for current tool inputs.

# Configuration as code

> Read, edit, and save a complete draft.

Use the complete configuration for order, control, and editorial targets, or when you want to review a change as code.

## 1. Read the draft

Call `get_website`:

```json theme={null}
{ "website": "YOUR_WORKSPACE_UUID", "detail": "config" }
```

Keep the returned `version` and fields you are not changing.

## 2. Edit and validate

Validate a `VisitorSite` in this repository with:

```ts theme={null}
import { visitorSiteSchema } from '@ion-design/adaptive/management-schema';
const validatedDraft = visitorSiteSchema.parse(candidateDraft);
```

Outside the repository, use the matching client version or [JSON schemas](https://docs.usedynamite.com/reference/configuration.md). The server also checks relationships that JSON Schema cannot express.

> [accordion] Complete VisitorSite example
>
> ```json theme={null}
> {
>   "id": "example-site",
>   "revision": "draft-1",
>   "objective": "Help visitors find a relevant customer story and request a demo.",
>   "profileTtlMs": 86400000,
>   "halfLifeMs": 21600000,
>   "maxEvents": 60,
>   "products": [],
>   "pages": [{ "id": "home", "path": "/", "targets": ["headline"] }],
>   "targets": [{
>     "id": "headline",
>     "selector": "[data-personalize='headline']",
>     "description": "The homepage heading",
>     "mode": "text",
>     "defaultVariant": "original",
>     "variants": [
>       {
>         "id": "original", "description": "General introduction",
>         "hypothesis": "Use the broad introduction when context is weak.",
>         "audiences": [], "value": "A better way to work."
>       },
>       {
>         "id": "proof-led", "description": "Customer evidence",
>         "hypothesis": "Visitors evaluating the product may want concrete proof.",
>         "audiences": [], "value": "See what teams build with us."
>       }
>     ]
>   }],
>   "actions": []
> }
> ```
>
> This is the `draft` object, not the enclosing workspace. Adapt its site ID and selector to your website.

## 3. Save

Call `update_website` with:

```js theme={null}
const argumentsForUpdate = {
  website: current.website,
  version: current.version,
  config: {
    draft: nextDraft,
    components: current.config.components,
    documents: current.config.documents,
  },
};
```

`draft` and `components` replace those collections. Documents replace only when supplied. On conflict, reread and reconcile.

> [!NOTE]
>
> Goals are live settings. Omit `config.goals` from a content-only edit. If a combined update fails, reread: a draft save may have succeeded before a settings change failed.

Preview and publish the saved draft separately. Coordinate selector changes with the website’s markup, and keep customer configurations outside the Dynamite service repository.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.