
## Comment fields

`GET /v1/timelines/fields`

Returns the field schema of a timeline comment.

## Examples

### curl — personal key

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

### curl — OAuth application

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

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

### JavaScript — OAuth application

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

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

## Response fields

| Field | Bitrix24 | Type | RO | Description |
|------|----------|-----|:--:|---------|
| `id` | `ID` | number | yes | Comment ID |
| `entityType` | `ENTITY_TYPE` | string | | Type of the parent CRM record: `deal`, `lead`, `contact`, `company` or `DYNAMIC_<entityTypeId>` for smart processes (e.g. `DYNAMIC_174`). Returned in lowercase in the response (`dynamic_174`). Set only on creation |
| `entityId` | `ENTITY_ID` | number | | Parent record ID. Set only on creation. Source: `GET /v1/deals`, `GET /v1/leads`, `GET /v1/contacts`, `GET /v1/companies`, `GET /v1/items/:entityTypeId` (smart-process items) |
| `comment` | `COMMENT` | string | | Comment text. Required on creation |
| `authorId` | `AUTHOR_ID` | number | yes | Comment author ID. User data by ID: `GET /v1/users/:id` |
| `createdAt` | `CREATED` | datetime | yes | Creation date, ISO 8601 in UTC |
| `FILES` | `FILES` | attached_diskfile | | Attachments. On write — an array of `[[fileName, base64Content]]` pairs, on read — an object where the key is the Drive file ID. See: [Add comment](/docs/entities/timelines/create) |

## Response example

`GET /v1/timelines/fields` returns field descriptions under the `data.fields` key, where each field is `{ type, readonly, label, description }`. The `FILES` field has no `description`.

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "ID", "description": "Unique numeric identifier of the timeline comment." },
      "entityType": { "type": "string", "readonly": false, "label": "Entity type", "description": "CRM parent record type: deal, lead, contact, company, or DYNAMIC_<entityTypeId> for smart processes. Set only on creation." },
      "entityId": { "type": "number", "readonly": false, "label": "Entity ID", "description": "ID of the CRM parent record the comment belongs to. Set only on creation." },
      "comment": { "type": "string", "readonly": false, "label": "Comment", "description": "Comment text. Required on creation." },
      "authorId": { "type": "number", "readonly": false, "label": "Author", "description": "ID of the user who wrote the comment." },
      "createdAt": { "type": "datetime", "readonly": true, "label": "Created", "description": "Comment creation date and time (ISO 8601, UTC)." },
      "FILES": { "type": "attached_diskfile", "readonly": false, "label": "File list" }
    }
  }
}
```

## Error response example

403 — no scope:

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

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | The API key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## See also

- [Add comment](/docs/entities/timelines/create) — which fields to pass
- [List comments](/docs/entities/timelines/list) — filtering by fields
- [Entity API](/docs/entity-api) — select to query the fields you need
- [Limits and optimization](/docs/optimization) — rate limits
