## Create a CRM card layout

`POST /v1/crm/card-layouts/:entityType`

Create a named set of CRM card sections and fields for the selected audience.

> **These methods are rolling out — introduced in `crm 26.1700.0`.** Cloud availability also depends on Bitrix24 enabling this capability. Until it is enabled for your Bitrix24 account, the API returns `422 METHOD_NOT_YET_AVAILABLE` with `error.release`.

Requires `crm` scope. Writes require `READWRITE`.

## Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `entityType` (path) | string | yes | — | Type from the [section index](/docs/entities/crm-card-layouts). |

## Request body fields

| Field | Type | Required | Description |
|---|---|---|---|
| `categoryId` | integer | yes | Category from [`GET /v1/categories`](/docs/entities/categories), `0` is accepted. |
| `fields` | object | yes | Writable fields. |
| `fields.name` | string | yes | Layout name. |
| `fields.configuration` | object[] | yes | Sections `{name,title,elements}`. Elements `{name,optionFlags?,options?}`, where `options` is an object. |
| `fields.audience` | object[] | yes | Audience `{type,id}`. Bitrix24 checks types and permissions. Employee IDs come from the [user list](/docs/entities/users). |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/crm/card-layouts/deal" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"categoryId": 0, "fields": {"name": "VIBE-PROBE", "configuration": [{"name": "main", "title": "VIBE-PROBE", "elements": [{"name": "TITLE"}]}], "audience": [{"type": "user", "id": 1}]}}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/crm/card-layouts/deal" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"categoryId": 0, "fields": {"name": "VIBE-PROBE", "configuration": [{"name": "main", "title": "VIBE-PROBE", "elements": [{"name": "TITLE"}]}], "audience": [{"type": "user", "id": 1}]}}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm/card-layouts/deal', {
  method: 'POST',
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({"categoryId": 0, "fields": {"name": "VIBE-PROBE", "configuration": [{"name": "main", "title": "VIBE-PROBE", "elements": [{"name": "TITLE"}]}], "audience": [{"type": "user", "id": 1}]}}),
});
console.log(await res.json());
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm/card-layouts/deal', {
  method: 'POST',
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({"categoryId": 0, "fields": {"name": "VIBE-PROBE", "configuration": [{"name": "main", "title": "VIBE-PROBE", "elements": [{"name": "TITLE"}]}], "audience": [{"type": "user", "id": 1}]}}),
});
console.log(await res.json());
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | `true` |
| `data.id` | number | Numeric ID of the created layout. |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 11
  }
}
```

## Error response example

`400` — category omitted:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELDS",
    "message": "categoryId is required"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 400 | `MISSING_REQUIRED_FIELDS` | Category or required body fields missing. |
| 400 | `INVALID_PARAMS` | Unsupported entity selector or malformed parameters. |
| 400 | `UNKNOWN_FILTER_FIELD` | Unknown query parameter. |
| 401 | `MISSING_API_KEY` | API key missing. |
| 401 | `TOKEN_MISSING` | Bitrix24 credentials missing. |
| 403 | `SCOPE_DENIED` | The key lacks `crm` scope. |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key blocks writes to Bitrix24. |
| 422 | `METHOD_NOT_YET_AVAILABLE` | Capability disabled or method unavailable. `error.release` names the release. |
| 422 | `BITRIX_ERROR` | Bitrix24 refusal. Original code in `error.b24Code`, text in `error.message`. |
| 502 | `BITRIX_UNAVAILABLE` | No valid response from Bitrix24. After a write error, reread before retrying. |

Common errors: [Errors](/docs/errors).

## Known specifics

Supplied arrays replace their previous contents. Bitrix24 may refuse an empty array as a missing field, and the original refusal is included in the response.

## See also

- [Named CRM card layouts](/docs/entities/crm-card-layouts)
