## Get a generation field

`GET /v1/sites/ai/fields/:name`

Reads a field definition by its name.

## Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` (path) | string | yes | — | Field name from [field definitions](./fields.md) |

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/sites/ai/fields/id" \
  -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/sites/ai/fields/id", {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY"
  }
});
const result = await res.json();
console.log(result);
```

### JavaScript — OAuth application

```javascript
const res = await fetch("https://vibecode.bitrix24.com/v1/sites/ai/fields/id", {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN"
  }
});
const result = await res.json();
console.log(result);
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | `true` on success |
| `data` | object | Field definition |
| `data.name` | string | Field name |
| `data.type` | string | Value type |
| `data.title` | string | Field title |
| `data.description` | string \| null | Field description or null |
| `data.validationRules` | array | Validation rules |
| `data.requiredGroups` | array \| null | Required groups or null |
| `data.filterable` | boolean | Can be filtered |
| `data.sortable` | boolean | Can be sorted |
| `data.editable` | boolean | Can be edited |
| `data.editableGroups` | array \| null | Editing groups or null |
| `data.multiple` | boolean | Multiple values |
| `data.elementType` | string \| null | Element type or null |

## Response example

```json
{
  "success": true,
  "data": {
    "name": "id",
    "type": "int",
    "title": "Site generation identifier",
    "description": null,
    "validationRules": [],
    "requiredGroups": null,
    "filterable": false,
    "sortable": false,
    "editable": false,
    "editableGroups": null,
    "multiple": false,
    "elementType": null
  }
}
```

## Error response example

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Field `FAKE_UNKNOWN_FIELD` was not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 404 | `ENTITY_NOT_FOUND` | Bitrix24 refused the request |
| 401 | `MISSING_API_KEY`, `INVALID_API_KEY`, `TOKEN_MISSING` | Missing or unusable credentials |
| 403 | `SCOPE_DENIED` | The key lacks the landing scope |

[Common errors](/docs/errors).

## See also

- [AI site generation](../ai.md)
