# Update block schema

**Publié le** : 2026-05-08
**Catégorie** : Core CMS

## `PUT /site-blocks/:slug/schema`

**Update block schema**

Replaces the field schema for a site block. Existing data is preserved
but fields not in the new schema become orphaned (accessible but not
validated).

Required permissions: `site_blocks.schema`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `slug` | path | string | Yes | URL-friendly identifier, unique per site and locale |


### Responses

| Status | Description |
| --- | --- |
| `200` | Successful response |
| `401` | Unauthorized — invalid or missing API token |
| `403` | Forbidden — insufficient permissions |
| `404` | Not found |
| `422` | Validation error |


> **Notes:** - Maximum 250 fields per level, 5 nesting levels.
> 
> - Changing schema does NOT delete existing data.

### Examples

```bash
curl -X PUT https://api.lynkow.com/v1/site-blocks/header/schema \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "schema": [
      {"name": "logo", "type": "image", "label": "Logo"},
      {"name": "tagline", "type": "string", "label": "Tagline"},
      {"name": "navLinks", "type": "array", "label": "Navigation Links"}
    ]
  }'
```

### Response Example

```json
{
  "data": {
    "message": "Schema updated successfully"
  }
}
```

---