## Create a price type

`POST /v1/catalog-price-types`

Creates a catalog price type for separate product prices on the Bitrix24 account. The request body is flat, without a `fields` wrapper.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|-------|----------|
| `name` | string | yes | Price type name. |
| `sort` | number | no | Sort order in the Bitrix24 interface. |
| `xmlId` | string \| null | no | External identifier for import and export integrations. |
| `id` | number | no | `RO`. Price type ID. List: [List price types](./list.md). |
| `base` | string | no | `RO`. Base price type flag, set by the system. |
| `createdBy` | number \| null | no | `RO`. ID of the user who created the record. List: [List users](/docs/entities/users/list). |
| `modifiedBy` | number \| null | no | `RO`. ID of the user who last updated the record. List: [List users](/docs/entities/users/list). |
| `dateCreate` | string \| null | no | `RO`. Creation date and time in ISO 8601 format. |
| `timestampX` | string \| null | no | `RO`. Last update date and time in ISO 8601 format. |

Fields marked `RO` are read-only. Do not include them in the request body.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-price-types" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Wholesale", "sort": 200, "xmlId": "WHOLESALE"}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-price-types" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Wholesale", "sort": 200, "xmlId": "WHOLESALE"}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-price-types', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name": "Wholesale", "sort": 200, "xmlId": "WHOLESALE"}),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-price-types', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"name": "Wholesale", "sort": 200, "xmlId": "WHOLESALE"}),
})

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

## Response fields

The response has status `201` and contains the complete created price type.

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success. |
| `data` | object | Price type object. |
| `data.id` | number | `RO`. Price type ID. List: [List price types](./list.md). Pass this value in `catalogGroupId` when working with [catalog prices](/docs/entities/catalog-prices). |
| `data.name` | string | Price type name. |
| `data.base` | string | `RO`. `Y` — the account's base price type, `N` — another type. |
| `data.xmlId` | string \| null | External identifier for integrations. |
| `data.sort` | number | Sort order in the Bitrix24 interface. |
| `data.createdBy` | number \| null | `RO`. ID of the user who created the record. List: [List users](/docs/entities/users/list). |
| `data.modifiedBy` | number \| null | `RO`. ID of the user who last updated the record. List: [List users](/docs/entities/users/list). |
| `data.dateCreate` | string \| null | `RO`. Creation date and time in ISO 8601 format. |
| `data.timestampX` | string \| null | `RO`. Last update date and time in ISO 8601 format. |

## Response example

```json
{
  "success": true,
  "data": {
    "base": "N",
    "createdBy": 1295,
    "dateCreate": "2026-10-14T17:18:58.000Z",
    "id": 19,
    "modifiedBy": 1295,
    "name": "Wholesale",
    "sort": 200,
    "timestampX": "2026-10-14T17:18:58.000Z",
    "xmlId": "WHOLESALE"
  }
}
```

## Error response example

400 — `name` was omitted, so the price type was not created:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELDS",
    "message": "Body field \"name\" is required to create catalogPriceType."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `MISSING_REQUIRED_FIELDS` | `name` was omitted, or its value is `null` or an empty string. |
| 400 | `READONLY_FIELD` | The body contains a field marked `RO`. Remove it from the request. |
| 400 | `INVALID_PARAMS` | An object or array was passed in a string or numeric field. |
| 400 | `INVALID_PARAMS` | Bitrix24 rejected the request parameters. |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request. The reason is in `error.message`. |
| 403 | `BITRIX_ACCESS_DENIED` | The user does not have the Bitrix24 “Manage price types” permission. |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode. |
| 403 | `SCOPE_DENIED` | The key does not have the `catalog` scope. |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was omitted. |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens configured. For an OAuth application key, check the user session. |

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

## Known specifics

On creation, the viewing and buying groups are set to `[1, 2]` — administrators and all users. This method cannot manage these groups.

## See also

- [List price types](./list.md)
- [Get a price type](./get.md)
- [Update a price type](./update.md)
- [Delete a price type](./delete.md)
- [Price type fields](./fields.md)
- [Catalog prices](/docs/entities/catalog-prices)
