# Layers

Tradly Layers is a CMS for defining custom content types and managing their content. Use it for Stories, Reels, or any other content type your app needs.

The Layer object represents a content entity and is returned by the Layer list and detail APIs.

**Sample Layer Object (full)**

```json
{
  "id": 1001,
  "type": "layers",
  "domain_id": 0,
  "category_id": [12, 44],
  "author_staff_id": 12,
  "author": {
    "id": 12,
    "employee_code": "EMP-012",
    "job_title": "Content editor",
    "user": {
      "id": "692ee113-310b-4e66-b5b5-33796f9616e3",
      "first_name": "Charles",
      "last_name": "Pearson"
    }
  },
  "tags": ["homepage", "featured"],
  "cover_image_path": "https://cdn.example.com/layers/banner.jpg",
  "slug": "home-banner",
  "meta_title": "Home Banner",
  "meta_description": "Homepage highlighted banner layer",
  "meta_keyword": "home,banner,featured",
  "title": "Home Banner",
  "content": "Welcome to our marketplace",
  "summary": "Highlighted homepage block",
  "metadata": {
    "layout": "hero"
  },
  "active": true,
  "created_by": "admin@example.com",
  "updated_by": "admin@example.com",
  "created_at": 1721063688,
  "updated_at": 1721064740,
  "account": {
    "id": 26,
    "name": "Urth Cafe"
  },
  "user": {
    "id": "692ee113-310b-4e66-b5b5-33796f9616e3",
    "first_name": "Charles",
    "last_name": "Pearson"
  }
}
```

**Sample Layer Object (minified)**

```json
{
  "id": 1001,
  "title": "Home Banner",
  "slug": "home-banner"
}
```

## Layer Object (full)

| **attribute** | **type** | **description** |
| --- | --- | --- |
| `id` | `integer` | Public layer identifier (`unique_id`) used in API paths. |
| `type` | `string` | Layer type/domain classification (for example `layers`). |
| `domain_id` | `integer` | Domain identifier when multi-domain mapping is enabled. |
| `category_id` | `array<integer>` | Category IDs attached to this layer. |
| `author_staff_id` | `integer|null` | ID of the active tenant Staff profile author, when assigned. If omitted on create by a user with an active Staff profile, that profile is assigned automatically. |
| `author` | `object|null` | Public author summary from the linked Staff profile, including employee code, job title, and public linked-user name fields. |
| `tags` | `array<string>` | Tag labels configured for filtering and grouping. |
| `cover_image_path` | `string` | Layer cover image URL. Empty when not set. |
| `slug` | `string` | Locale-resolved slug value for the requested language or tenant default language. |
| `meta_title` | `string` | Locale-resolved SEO title. |
| `meta_description` | `string` | Locale-resolved SEO description. |
| `meta_keyword` | `string` | Locale-resolved SEO keywords. |
| `title` | `string` | Locale-resolved layer title translation. |
| `content` | `string` | Locale-resolved layer content translation. |
| `summary` | `string` | Locale-resolved layer summary translation. |
| `metadata` | `object` | Custom tenant metadata stored against the layer. |
| `active` | `boolean` | Whether the layer is active. |
| `created_by` | `string` | Actor identifier that created the layer record. |
| `updated_by` | `string` | Actor identifier that last updated the layer record. |
| `created_at` | `integer` | Unix timestamp when the layer was created. |
| `updated_at` | `integer` | Unix timestamp when the layer was last updated. |
| `account` | `object` | Included when the layer is tied to an account. |
| `user` | `object` | Included when the layer is tied to a user. |

## Layer Object (minified)

| **attribute** | **type** | **description** |
| --- | --- | --- |
| `id` | `integer` | Public layer identifier (`unique_id`). |
| `title` | `string` | Locale-resolved title. |
| `slug` | `string` | Locale-resolved slug. |

## Notes

- `GET /v1/layers?minified=1` returns the minified object shape (`id`, `title`, `slug`).
- `GET /v1/layers` and `GET /v1/layers/{layer_id}` return the full object shape.
- The previous `name` field is not part of the current ArcticOwl layer response object.
- Create and update requests may set `layer.author_staff_id` to an active Staff profile in the same tenant. Tenant admins may select another staff member; other users may select only their own profile. Send `null` when updating to clear the author.

```sh
curl -X POST "$API/v1/layers" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
    "layer": {
      "title": "Summer collection story",
      "type": "layers",
      "author_staff_id": 12
    }
  }'
```
