# Help4 Template Spec (v1)

Designers can copy and paste this JSON format to move reusable builder templates between sites and versions.

## Core Shape

```json
{
  "version": "1.0",
  "name": "Template Name",
  "viewport": "8k-ready",
  "assets": {
    "images": [
      {
        "id": "hero-main",
        "attachment_id": 123,
        "src": "https://example.com/uploads/hero.jpg",
        "alt": "Hero image alt text"
      }
    ],
    "fonts": [
      {
        "family": "Trebuchet MS",
        "weight": "700"
      }
    ],
    "icons": []
  },
  "sections": [
    {
      "id": "hero",
      "component": "hero-banner",
      "settings": {
        "headline": "Your Headline",
        "subheadline": "Optional text"
      },
      "children": []
    }
  ]
}
```

## Best Practices

- Keep a stable `id` for each section/component so diffs stay clean in version control.
- Save image references with both `attachment_id` and `src` when possible.
- Put business-specific values in `settings`; keep structural choices in `component` and `children`.
- For multi-screen control, add breakpoint keys inside each `settings` object (for example: `desktop`, `tablet`, `mobile`, `ultra_8k`).

## Import/Export APIs

- `GET /wp-json/h4bs/v1/templates`
- `GET /wp-json/h4bs/v1/templates/{id}/export`
- `POST /wp-json/h4bs/v1/templates/import`

`POST /templates/import` accepts:

```json
{
  "title": "Imported Layout",
  "content": "<!-- optional builder markup -->",
  "spec": { "...": "template spec object" }
}
```
