# Poll results

`GET /v1/polls/:pollId/results`

Returns the poll with counters and a voter preview for each answer. Nobody can see voter identities in an anonymous poll.

Results follow Bitrix24 visibility rules: when `resultsVisible: false`, counters and percentages are `null`, `voters` is empty and `votersComplete` is `false`. See the [poll object](/docs/polls) for visibility rules.

**Scope:** `vote`. Key restrictions: [Polls](/docs/polls).

## Parameters

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `pollId` (path) | number | yes | — | Positive attachment ID: the `id` field from [poll discovery](/docs/polls/list), rather than `voteId` |
| `votersLimit` (query) | number | no | 10 | Integer from 1 to 50: maximum voters in each answer preview |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/polls/7/results?votersLimit=10" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/polls/7/results?votersLimit=10" \
  -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/polls/7/results?votersLimit=10', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})
const result = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/polls/7/results?votersLimit=10', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const result = await res.json()
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| `success` | boolean | `true` on success |
| `data` | object | [Poll object](/docs/polls) |
| `data.questions[].answers[].voters` | array | Preview: `{id, name, position, avatarUrl}`; the last two fields may be `null`. For an anonymous poll: `[]` |
| `data.questions[].answers[].votersComplete` | boolean | For a non-anonymous poll: preview length equals the answer counter. For an anonymous poll or hidden results: always `false` |

For the full list, use [voters for an answer](/docs/polls/voters). Excel reports and result links are not returned; export the report in the Bitrix24 interface.

## Response example

Illustrative response based on the normalizer and test fixtures; not a live Bitrix24 response.

```json
{
  "success": true,
  "data": {
    "id": 7,
    "voteId": 8,
    "status": "active",
    "anonymous": false,
    "allowRevote": true,
    "resultsHidden": true,
    "resultsVisible": true,
    "votersCount": 3,
    "questions": [
      {
        "id": 10,
        "text": "First",
        "multipleChoice": false,
        "required": false,
        "votesCount": 0,
        "answers": [
          {
            "id": 11,
            "text": "One",
            "votesCount": 0,
            "percent": 0,
            "voters": [],
            "votersComplete": true
          },
          {
            "id": 12,
            "text": "Two",
            "votesCount": 0,
            "percent": 0,
            "voters": [],
            "votersComplete": true
          }
        ]
      },
      {
        "id": 20,
        "text": "Second",
        "multipleChoice": true,
        "required": true,
        "votesCount": 2,
        "answers": [
          {
            "id": 22,
            "text": "A",
            "votesCount": 2,
            "percent": 100,
            "voters": [
              {
                "id": 9,
                "name": "Ada",
                "position": "Engineer",
                "avatarUrl": null
              }
            ],
            "votersComplete": false
          },
          {
            "id": 23,
            "text": "B",
            "votesCount": 0,
            "percent": 0,
            "voters": [],
            "votersComplete": true
          }
        ]
      }
    ],
    "myVote": {
      "voted": true,
      "answerIds": [
        22
      ]
    },
    "permissions": {
      "canVote": false,
      "canRevote": true,
      "canManage": true
    }
  }
}
```

## Errors

| HTTP | Code | Cause and action |
| --- | --- | --- |
| 400 | `INVALID_PARAMS` | Invalid ID or request parameter |
| 401 | `TOKEN_MISSING` | No Bitrix24 user session |
| 403 | `SCOPE_DENIED` | Required scope is missing |
| 403 | `COWORK_READONLY` | Operation forbidden for a Cowork portal-readonly key |
| 404 | `POLL_NOT_FOUND` | Poll missing or inaccessible |
| 403 | `POLL_ACCESS_DENIED` | Bitrix24 denied the operation |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request, for example because the method is unavailable in this version |

Other authentication refusals, limits and shared errors: [error codes](/docs/errors).

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Invalid poll parameters."
  }
}
```
