
## Funnel fields

`GET /v1/categories/:entityTypeId/fields`

Returns the funnel field schema for the specified CRM entity type: names, types, and the read-only flag.

## Parameters

| Parameter | Type | Description |
|----------|-----|---------|
| `entityTypeId` (path) | number | CRM entity type ID. Deals — `2`, invoices — `31`, smart processes — from `GET /v1/smart-processes` |

## Examples

The examples use `entityTypeId = 2` (deals); replace it with the type you need.

### curl — personal key

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

### curl — OAuth application

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

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/categories/2/fields', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

The response contains the funnel field schema and available operations.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Funnel schema and available operations |
| `data.fields` | object | Dictionary of funnel fields: the key is the field name, and the value is an object describing it. The dictionary fields are listed below |
| `data.fields.<field>` | object | Object describing one field: `type`, `readonly`, `label`, and `description` |
| `data.batch` | array | Write operations available in [batch calls](/docs/batch): `create`, `update`, `delete` |

### Funnel field schema

The table lists the value types of the fields described in `data.fields`.

| Field | Type | RO | Description |
|------|-----|:--:|---------|
| `id` | number | RO | Funnel ID. For deals, the main funnel has ID `0` |
| `entityTypeId` | number | RO | CRM entity type ID, mirrors the path parameter |
| `name` | string | | Funnel name. Required on creation |
| `sort` | number | | Sort order |
| `isDefault` | boolean | RO | Marks the main funnel. Read-only — a write is rejected with `400 READONLY_FIELD` |
| `code` | string | RO | Symbolic code of a system funnel, for example `CATALOG_CONTRACTOR_CONTACT`. Returned only for contact and company funnels; `filter[code]` filters by it. Read-only — a write is rejected with `400 READONLY_FIELD` |
| `isSystem` | string |  | System funnel: `Y` or `N`, as Bitrix24 returns it. Returned only for contact and company funnels. Passed to Bitrix24 as is: Bitrix24 does not allow creating a funnel with `Y` and responds with `422 BITRIX_ERROR`; on update, the field is ignored |
| `createdDate` | datetime | RO | Creation date. Bitrix24 does not return it: the field is not returned for any funnel type, even when requested in `select`, and the schema marks it `notReturned: true` |
| `originId` | string | RO | External identifier of the funnel in the system it was imported from. Read-only — a write is rejected with `400 READONLY_FIELD`: Bitrix24 does not store the value |
| `originatorId` | string | RO | Source system of the external binding. Read-only — a write is rejected with `400 READONLY_FIELD`: Bitrix24 does not store the value |

The `batch` field lists the operations available in a [batch request](/docs/batch): `create`, `update`, `delete`.

The `label` captions come straight from the Bitrix24 account, so they are returned in the account language — and for some fields they repeat the Bitrix24 field name, like `ORIGIN_ID` in the example below. Request headers do not switch the language.

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true },
      "entityTypeId": { "type": "number", "readonly": true },
      "name": { "type": "string", "readonly": false },
      "sort": { "type": "number", "readonly": false },
      "isDefault": { "type": "boolean", "readonly": true },
      "code": { "type": "string", "readonly": true },
      "isSystem": { "type": "string", "readonly": false },
      "createdDate": { "type": "datetime", "readonly": true, "notReturned": true },
      "originId": { "type": "string", "readonly": true, "label": "ORIGIN_ID" },
      "originatorId": { "type": "string", "readonly": true, "label": "ORIGINATOR_ID" }
    },
    "batch": ["create", "update", "delete"]
  }
}
```

## Error response example

404 — type not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Smart process not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | `entityTypeId` does not match an existing CRM type |
| 422 | `BITRIX_ERROR` | The CRM type does not support funnels. Quotes (type `7`) have no funnels |
| 403 | `SCOPE_DENIED` | The API key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 429 | `RATE_LIMITED` | Rate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the `x-ratelimit-limit` header. Retry after the delay in the `Retry-After` header |

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

## See also

- [List pipelines](/docs/entities/categories/list)
- [Create a pipeline](/docs/entities/categories/create)
- [Get pipeline](/docs/entities/categories/get)
- [Smart process types](/docs/entities/smart-processes)
- [Entity API](/docs/entity-api)
