
## Calendar resource fields

`GET /v1/calendar-resources/fields`

Returns the calendar resource field schema — use it to check which fields the create and rename requests accept.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/calendar-resources/fields" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/calendar-resources/fields" \
  -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/calendar-resources/fields', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log(Object.keys(data.fields))
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/calendar-resources/fields', {
  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.fields` | object | Field schema: the key is the resource field name, the value is its description |
| `data.fields.<field>.type` | string | Value type: `number` or `string` |
| `data.fields.<field>.readonly` | boolean | `true` — the field is read-only and is not accepted in write requests |
| `data.fields.<field>.required` | boolean | `true` — the field is required on creation. Present only on required fields |
| `data.fields.<field>.label` | string | Field label |
| `data.fields.<field>.description` | string | Field description |
| `data.batch` | array | Write actions accepted by `POST /v1/calendar-resources/batch`: `create` |

Resource fields in `data.fields`:

| Field | Type | RO | Description |
|------|-----|:--:|---------|
| `id` | number | yes | Resource ID |
| `name` | string | no | Resource name. Required on creation and renaming |
| `createdBy` | number | yes | ID of the employee who created the resource. List: [`GET /v1/users`](/docs/entities/users) |

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": {
        "type": "number",
        "readonly": true,
        "label": "Resource ID",
        "description": "Resource ID."
      },
      "name": {
        "type": "string",
        "readonly": false,
        "required": true,
        "label": "Resource name",
        "description": "Resource name."
      },
      "createdBy": {
        "type": "number",
        "readonly": true,
        "label": "Creator ID",
        "description": "Creator ID."
      }
    },
    "batch": [
      "create"
    ]
  }
}
```

## Error response example

403 — no scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'calendar' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | The API key does not have the `calendar` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not passed |
| 429 | `RATE_LIMITED` | Rate limit exceeded |

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

## See also

- [List calendar resources](./list.md)
- [Create calendar resource](./create.md)
- [Rename calendar resource](./update.md)
- [Calendar resources](/docs/entities/calendar-resources)
