# Create: Booking resource types

`POST /v1/booking-resource-types`

Creates a booking resource type — a category of online booking resources with the settings for client messages about bookings.

Fields go at the root of the JSON, without a `fields` wrapper.

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `code` | string | yes | Symbolic code of the type. Unique among the types of the Bitrix24 account: a duplicate code is rejected with `422 BITRIX_ERROR` |
| `name` | string | yes | Type name |
| `isInfoNotificationOn` | boolean \| string | no | Booking info message to the client. `true` / `false` or `"Y"` / `"N"`. Default `true` |
| `isConfirmationNotificationOn` | boolean \| string | no | Booking confirmation request. Default `true` |
| `isReminderNotificationOn` | boolean \| string | no | Booking reminder. Default `true` |
| `isFeedbackNotificationOn` | boolean \| string | no | Feedback request. Default `true` |
| `isDelayedNotificationOn` | boolean \| string | no | Message to a client who is running late. Default `true` |
| `isCancellationNotificationOn` | boolean \| string | no | Booking cancellation message to the client. Default `true` |
| `senderCode` | string \| null | no | Service that sends messages to the client, for example `bitrix24`. Default `null` |
| `infoNotificationDelay` | number \| null | no | How many seconds after the booking is made to send the booking info message. Default `null` |
| `confirmationNotificationDelay` | number \| null | no | How many seconds before the booking to send the first confirmation request. Default `86400` |
| `confirmationNotificationRepetitions` | number \| null | no | How many times to repeat the confirmation request, not counting the first one. Default `null` |
| `confirmationNotificationRepetitionsInterval` | number \| null | no | Interval between repeats of the confirmation request, in seconds. Default `10800` |
| `confirmationCounterDelay` | number \| null | no | How many seconds before the booking an unconfirmed booking enters the counter. Default `10800` |
| `reminderNotificationDelay` | number \| null | no | How many seconds before the booking to send the reminder. `-1` — on the morning of the booking day. Default `-1` |
| `delayedNotificationDelay` | number \| null | no | After how many seconds of lateness to send the message to the client. Default `300` |
| `delayedCounterDelay` | number \| null | no | After how many seconds of lateness the booking enters the calendar counter. Default `300` |
| `cancellationNotificationDelay` | number \| null | no | Delay of the booking cancellation message, in seconds. Default `600` |
| `templateTypeInfo` | string | no | Booking message template: `inanimate`, `animate`, `inanimate_long`. Default `inanimate`. Saved, but not returned in the type card |
| `templateTypeConfirmation` | string | no | Confirmation request template: `inanimate`, `animate`, `inanimate_long`. Default `inanimate` |
| `templateTypeReminder` | string | no | Reminder template. The only value is `base` |
| `templateTypeFeedback` | string | no | Feedback request template: `inanimate`, `animate`. Default `inanimate` |
| `templateTypeDelayed` | string | no | Late-arrival message template: `inanimate`, `animate`. Default `inanimate` |

The built-in "Expert" type uses the `animate` templates; the "Equipment", "Car" and "Property" types use `inanimate`.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/booking-resource-types" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Technicians",
    "code": "master",
    "isInfoNotificationOn": false,
    "isConfirmationNotificationOn": false,
    "isReminderNotificationOn": false,
    "isFeedbackNotificationOn": false,
    "isDelayedNotificationOn": false,
    "isCancellationNotificationOn": false
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/booking-resource-types" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Technicians",
    "code": "master",
    "isInfoNotificationOn": false,
    "isConfirmationNotificationOn": false,
    "isReminderNotificationOn": false,
    "isFeedbackNotificationOn": false,
    "isDelayedNotificationOn": false,
    "isCancellationNotificationOn": false
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resource-types', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Technicians',
    code: 'master',
    isInfoNotificationOn: false,
    isConfirmationNotificationOn: false,
    isReminderNotificationOn: false,
    isFeedbackNotificationOn: false,
    isDelayedNotificationOn: false,
    isCancellationNotificationOn: false,
  }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resource-types', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Technicians',
    code: 'master',
    isInfoNotificationOn: false,
    isConfirmationNotificationOn: false,
    isReminderNotificationOn: false,
    isFeedbackNotificationOn: false,
    isDelayedNotificationOn: false,
    isCancellationNotificationOn: false,
  }),
})

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

## Response fields

On success, the HTTP status is `201 Created`.

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data` | object | Card of the created type. The card fields are listed in the "Response fields" section of the [Get a booking resource type](/docs/entities/booking-resource-types/get) page |
| `data.id` | number | Type identifier. Pass it in `typeId` when [creating a booking resource](/docs/entities/booking-resources/create) |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 31,
    "code": "master",
    "name": "Technicians",
    "senderCode": null,
    "isInfoNotificationOn": false,
    "isConfirmationNotificationOn": false,
    "isReminderNotificationOn": false,
    "isFeedbackNotificationOn": false,
    "isDelayedNotificationOn": false,
    "isCancellationNotificationOn": false,
    "infoNotificationDelay": null,
    "confirmationNotificationDelay": 86400,
    "confirmationNotificationRepetitions": null,
    "confirmationNotificationRepetitionsInterval": 10800,
    "confirmationCounterDelay": 10800,
    "reminderNotificationDelay": -1,
    "delayedNotificationDelay": 300,
    "delayedCounterDelay": 300,
    "cancellationNotificationDelay": 600,
    "templateTypeConfirmation": "inanimate",
    "templateTypeReminder": "base",
    "templateTypeFeedback": "inanimate",
    "templateTypeDelayed": "inanimate"
  }
}
```

## Error response example

422 — a type with this code already exists:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Resource type with code \"master\" already exists",
    "b24Code": "1010"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `MISSING_REQUIRED_FIELDS` | `code` is not passed. Message `code is required` |
| 400 | `READONLY_FIELD` | `id` is passed in the body. Message `id is read-only` |
| 400 | `INVALID_PARAMS` | Empty body. Message `Provide a non-empty object of fields` |
| 400 | `INVALID_PARAMS` | A field not listed in the "Request fields (body)" table. Message `Unknown booking field` |
| 400 | `INVALID_PARAMS` | A field value is an object or an array. Message `Fields must contain scalar values` |
| 422 | `BITRIX_ERROR` | A type with this `code` already exists, `b24Code` `1010` |
| 422 | `BITRIX_ERROR` | `name` is not passed. Message `Required fields: name` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not passed |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key does not have the `booking` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 429 | `RATE_LIMITED` | Request rate exceeded. The effective cap is in the `x-ratelimit-limit` header |
| 502 | `BITRIX_RESPONSE_INVALID` | Bitrix24 returned a response of an unexpected shape. If this happened while re-reading the card after the write, the type has already been created — find it in the [list](/docs/entities/booking-resource-types/list) before retrying |

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

## See also

- [List booking resource types](/docs/entities/booking-resource-types/list)
- [Update a booking resource type](/docs/entities/booking-resource-types/update)
- [Delete a booking resource type](/docs/entities/booking-resource-types/delete)
- [Create a booking resource](/docs/entities/booking-resources/create)
- [Errors](/docs/errors)
