
## Create dictionary record

`POST /v1/statuses`

Creates a new record in a CRM dictionary.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `entityId` | string | yes | Dictionary type, for example `SOURCE` or `DEAL_STAGE`. List: [`GET /v1/statuses/entity-types`](/docs/entities/statuses/entity-types) |
| `statusId` | string | yes | Symbolic code of the value, unique within the dictionary |
| `name` | string | yes | Name |
| `description` | string | no | Record description. The field is not available on every Bitrix24 account |
| `sort` | number | no | Sort order |
| `color` | string | no | Color in HEX, for example `#22B9FF`. The `#` may be omitted |
| `semantics` | string | no | Semantics: `S` — success, `F` — failure |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/statuses" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entityId": "SOURCE", "statusId": "PARTNER", "name": "Partner", "sort": 50}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/statuses" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"entityId": "SOURCE", "statusId": "PARTNER", "name": "Partner", "sort": 50}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/statuses', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ entityId: 'SOURCE', statusId: 'PARTNER', name: 'Partner', sort: 50 }),
})
const { success, data } = await res.json()
console.log('ID:', data.id)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/statuses', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ entityId: 'SOURCE', statusId: 'PARTNER', name: 'Partner', sort: 50 }),
})
const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | The created dictionary record |
| `data.id` | number | Record ID |
| `data.entityId` | string | Dictionary type |
| `data.statusId` | string | Symbolic code |
| `data.name` | string | Name |
| `data.nameInit` | string/null | Original name |
| `data.description` | string/null | Record description. Not returned on every Bitrix24 account. Where it is missing, the field arrives as `null` |
| `data.sort` | number | Sort order |
| `data.system` | boolean | System value. Read-only |
| `data.categoryId` | number/null | Pipeline ID. Set for dictionaries of the form `DEAL_STAGE_N`, otherwise `0` or `null` |
| `data.color` | string/null | Color in HEX with a leading `#` |
| `data.semantics` | string/null | Semantics: `S` — success, `F` — failure. `null` — an in-progress stage or a dictionary without semantics |
| `data.extra` | object/null | Additional data for dictionaries with stages — `STATUS`, `DEAL_STAGE`, `DEAL_STAGE_N`, `QUOTE_STATUS`. Nested keys `SEMANTICS` and `COLOR`. The `SEMANTICS` values are listed in [Dictionary fields](/docs/entities/statuses/fields). Read-only, absent for other dictionaries |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 801,
    "entityId": "SOURCE",
    "statusId": "PARTNER",
    "name": "Partner",
    "nameInit": null,
    "description": "",
    "sort": 50,
    "system": false,
    "categoryId": 0,
    "color": null,
    "semantics": null
  }
}
```

## Error response example

422 — duplicate code:

```json
{
  "success": false,
  "error": { "code": "BITRIX_ERROR", "message": "The specified status ID already exists.", "b24Code": "ERROR_CORE" }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 422 | `BITRIX_ERROR` | The dictionary already has a record with this `statusId` |
| 422 | `BITRIX_ERROR` | `entityId` or `statusId` is missing. The message names the field: `The field ENTITY_ID is required.` |
| 422 | `BITRIX_ERROR` | `name` is missing. The message names the required field |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](/docs/access-rights) |
| 403 | `SCOPE_DENIED` | API key does not have the `crm` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |

Full list of errors — [Errors](/docs/errors).

## See also

- [List of dictionaries](/docs/entities/statuses/list)
- [Dictionary fields](/docs/entities/statuses/fields)
- [CRM dictionaries](/docs/entities/statuses)
