## Reset card layout

`DELETE /v1/crm/card-config/:entityTypeId`

Removes the explicit layout of the chosen scope. After the reset the card returns to the built-in default layout, and [`GET`](./get.md) for that scope returns `data: null`.

## Path parameter

| Parameter | Type | Description |
|----------|-----|---------|
| `entityTypeId` | number | CRM object type:<br>`1` — lead<br>`2` — deal<br>`3` — contact<br>`4` — company<br>`7` — quote<br>`31` — invoice<br>smart process — numeric type ID from [`GET /v1/smart-processes`](/docs/entities/smart-processes), field `entityTypeId` |

## Query or body parameters

Accepted in the query string or in the body. On a match the body value takes precedence.

| Parameter | Type | Description |
|----------|-----|---------|
| `scope` | string | Layout scope: `P` — personal (default), `C` — common |
| `userId` | number | Employee whose personal layout to reset. Defaults to the API key owner. Only meaningful with `scope=P`. Source: [`GET /v1/users`](/docs/entities/users) |
| `dealCategoryId` | number | Deal pipeline, deals only (`entityTypeId=2`). Source: [`GET /v1/categories/2`](/docs/entities/categories) |
| `categoryId` | number | Smart process pipeline, smart processes only. Source: [`GET /v1/categories/:entityTypeId`](/docs/entities/categories) |
| `leadCustomerType` | number | Lead type, leads only (`entityTypeId=1`): `1` — simple, `2` — repeat |

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm/card-config/2?scope=C&dealCategoryId=9" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/crm/card-config/2?scope=C&dealCategoryId=9" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm/card-config/2?scope=C&dealCategoryId=9', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { success, data } = await res.json()
console.log('Layout reset:', data.reset)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm/card-config/2?scope=C&dealCategoryId=9', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Reset result |
| `data.entityTypeId` | number | Object type from the path |
| `data.scope` | string | Scope that was reset: `P` or `C` |
| `data.reset` | boolean | Always `true` on success |

## Response example

```json
{
  "success": true,
  "data": {
    "entityTypeId": 2,
    "scope": "C",
    "reset": true
  }
}
```

## Error response example

400 — invalid `scope` value:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_SCOPE",
    "message": "scope must be \"P\" (personal) or \"C\" (common)."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_ENTITY_TYPE_ID` | `entityTypeId` in the path is not a positive integer |
| 400 | `INVALID_SCOPE` | `scope` is not `P` or `C` |
| 400 | `INVALID_USER_ID` | `userId` is not a positive integer |
| 400 | `INVALID_DEAL_CATEGORY_ID` | `dealCategoryId` is not a positive integer |
| 400 | `INVALID_CATEGORY_ID` | `categoryId` is not a positive integer |
| 400 | `INVALID_LEAD_CUSTOMER_TYPE` | `leadCustomerType` is not `1` or `2` |
| 502 | `CRM_CARD_CONFIG_RESET_FAILED` | Bitrix24 did not confirm the reset — for example, insufficient permissions or the target scope is unavailable |
| 422 | `BITRIX_ERROR` | Bitrix24 did not recognize the object type. The message is in `error.message` |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The app key is in read-only mode — writes are blocked |
| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

For the full list of common API errors, see [Errors](/docs/errors).

## Known specifics

**Resetting a nonexistent layout succeeds.** If there was no explicit configuration for the scope, the method still returns `reset: true`. No separate "was there a layout" check is required.

**After a reset `GET` returns `null`.** The scope again shows the built-in default layout, and [`GET`](./get.md) for it returns `data: null`.

## See also

- [Get layout](/docs/entities/crm-card-config/get)
- [Set layout](/docs/entities/crm-card-config/set)
- [Common layout for everyone](/docs/entities/crm-card-config/force-common)
