# Create a variable

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

## `POST /variables`

**Create a variable**

Creates a new variable. The `key` must be unique per site and locale,
and is used to reference the variable in templates.

Required permissions: `variables.create`

### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | "text" \| "calendar" | No | Resource type. One of: text, calendar |
| `key` | string | Yes | Required. 1-100 characters |
| `label` | string | Yes | Required. 1-255 characters |
| `value` | string | Yes | Required. Amount value. 1-100000 characters |
| `description` | string | No | Description text. Max 500 characters |
| `locale` | string | No | BCP 47 locale code (e.g. "en", "fr") |


### Responses

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


### Examples

```bash
curl -X POST https://api.lynkow.com/v1/variables \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "support_email",
    "value": "support@acme.com",
    "type": "text"
  }'
```

### Response Example

```json
{
  "data": {
    "id": 4,
    "key": "support_email",
    "value": "support@acme.com",
    "type": "text",
    "locale": "en",
    "createdAt": "2025-04-06T12:00:00.000Z",
    "updatedAt": "2025-04-06T12:00:00.000Z"
  }
}
```

---