Para agentes de IA: markdown desta página — /docs-content-en/polls.md índice da documentação — /llms.txt
Os artigos da documentação estão disponíveis atualmente em inglês.
Polls
Feed polls cannot be created through the API: the Bitrix24 REST API does not officially support creating a Feed poll. Existing polls can be read and managed. Chat polls can be created through the API.
Scope: vote | Base URL: https://vibecode.bitrix24.com/v1 | Authorization: X-Api-Key
Access
All operations require the vote scope. Creating a poll in a personal chat (dialogId is a user ID or me) also requires im; vote alone is sufficient for chatN. The current user's Bitrix24 permissions still apply. Chat polls are managed by the message author; Feed polls require post management rights.
| Key | Read | Write |
|---|---|---|
| KeyOrdinary read-only key | ReadAll four GET operations | WriteDenied |
| KeyCowork key with read-only access to the Bitrix24 account | ReadDenied | WriteDenied |
| KeyCompany key | ReadDenied | WriteDenied |
All four GET operations read the poll and subscribe the user to Bitrix24 events, so these operations are unavailable to a Cowork key that forbids writes to the Bitrix24 account. Poll methods are also unavailable through batch requests.
Finding a poll
In the post list (GET /v1/posts), select entries with hasPoll: true. Then pass the post IDs to GET /v1/polls?postIds=42.
In chat messages (GET /v1/chats/:dialogId/messages), a poll has data.messages[].params.componentId = "VoteMessage". The value of params.componentParams.id is the Bitrix24 poll number, voteId. To find its attachment, pass the message ID, rather than voteId, to GET /v1/polls?messageIds=42.
In the returned object, id is the attachment ID (pollId in API paths). It differs from voteId, the post ID and the message ID. If the attachment is not recognized, source may be omitted.
Poll object
| Field | Type | Description |
|---|---|---|
Fieldid |
Typenumber | DescriptionAttachment ID used as pollId |
FieldvoteId |
Typenumber | DescriptionBitrix24 poll number |
Fieldsource |
Typeobject | DescriptionOptional: {type: "post", postId} or {type: "chatMessage", messageId} |
Fieldstatus |
Typestring | Descriptionactive or finished |
Fieldanonymous |
Typeboolean | DescriptionWhether the poll is anonymous |
FieldallowRevote |
Typeboolean | DescriptionWhether revoting is allowed |
FieldresultsHidden |
Typeboolean | DescriptionBitrix24 hidden-results flag |
FieldresultsVisible |
Typeboolean | DescriptionWhether results are visible to the current user under Bitrix24 rules |
FieldvotersCount |
Typenumber | null | DescriptionParticipant counter |
Fieldquestions |
Typearray | DescriptionActive questions and answers only, in Bitrix24 sort order |
Fieldquestions[].id |
Typenumber | DescriptionQuestion ID |
Fieldquestions[].text |
Typestring | DescriptionQuestion text |
Fieldquestions[].multipleChoice |
Typeboolean | DescriptionWhether multiple answers can be selected |
Fieldquestions[].required |
Typeboolean | DescriptionWhether an answer is required |
Fieldquestions[].votesCount |
Typenumber | null | DescriptionQuestion vote counter |
Fieldquestions[].answers |
Typearray | DescriptionAnswer choices |
Fieldquestions[].answers[].id |
Typenumber | DescriptionAnswer ID for voting and voter lists |
Fieldquestions[].answers[].text |
Typestring | DescriptionAnswer text |
Fieldquestions[].answers[].votesCount |
Typenumber | null | DescriptionAnswer vote counter |
Fieldquestions[].answers[].percent |
Typenumber | null | DescriptionPercentage supplied by Bitrix24 |
FieldmyVote.voted |
Typeboolean | DescriptionWhether the current user has voted |
FieldmyVote.answerIds |
Typenumber[] | DescriptionAnswers selected by the current user |
Fieldpermissions.canVote |
Typeboolean | DescriptionWhether voting is permitted |
Fieldpermissions.canRevote |
Typeboolean | DescriptionWhether revoting is permitted |
Fieldpermissions.canManage |
Typeboolean | DescriptionWhether management is permitted |
Results and anonymity
Results are hidden when resultsHidden: true, or while the poll is active and the user can vote but has not voted. The exception is the poll author when Bitrix24 reports authorship (chat polls on Bitrix24 versions that support reporting authorship); post or message management rights do not reveal results. The author of a Feed poll sees hidden results in the Bitrix24 interface. Missing permission data hides results; a finished poll without hidden results remains visible. When resultsVisible: false, votersCount, questions[].votesCount, questions[].answers[].votesCount and percent are null, and answers have voters: [] and votersComplete: false in every API response containing a poll object.
In an anonymous poll, nobody, including the author and administrators, can see who voted: counters are available when resultsVisible: true. In results, voters is always empty and votersComplete is false. Results for a non-anonymous poll include a limited voter preview for each answer; use the separate operation for the full list. Counters are not cached.
The API does not return an Excel report or result links. Export the report in the Bitrix24 interface.
Handling writes
The creation idempotencyKey must be a UUID. On supported Bitrix24 versions, repeating the same key with the same body returns the existing poll in data.poll. On such a retry, data.voteId arrives as a new number that matches no poll, so take the poll number from data.poll.voteId. Use a new key for a new poll. Bitrix24 does not compare bodies: keep the question, answers and settings unchanged on a retry. If idempotencyKey is omitted, the server generates a new UUID for each request. Duplicate protection depends on the Bitrix24 version.
The platform does not retry writes automatically. After 502 POLL_CREATE_OUTCOME_UNKNOWN, inspect the chat first: the message may already exist. After other 502 …_OUTCOME_UNKNOWN errors, read the poll and decide whether another write is needed. Do not immediately create a new key after an unknown outcome.
When revoting in the Feed, if someone edits the poll during the vote, Bitrix24 may erase the previous vote, just as in the interface. Check myVote after an error.
Deletion
There is no separate poll deletion operation. Delete the post or message that contains the poll, using its existing endpoint.
Quick start
Read a poll by its attachment ID:
curl -H "X-Api-Key: YOUR_API_KEY" "https://vibecode.bitrix24.com/v1/polls/25"
Response fields: Get a poll.
Full example
Create a chat poll, vote, read the results and stop the poll:
const BASE = 'https://vibecode.bitrix24.com/v1'
const headers = { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }
async function call(method, path, body) {
const res = await fetch(`${BASE}${path}`, {
method,
headers: body ? headers : { 'X-Api-Key': headers['X-Api-Key'] },
body: body ? JSON.stringify(body) : undefined,
})
const json = await res.json()
if (!json.success) throw new Error(`${res.status} ${json.error.code}: ${json.error.message}`)
return json
}
// 1. Create a chat poll
const created = await call('POST', '/chats/chat5/polls', {
question: 'When?',
answers: ['Now', 'Later'],
idempotencyKey: crypto.randomUUID(),
})
const poll = created.data.poll
console.log('Poll', poll.id, 'in message', created.data.messageId)
// 2. Vote for the first answer
const firstAnswer = poll.questions[0].answers[0].id
await call('POST', `/polls/${poll.id}/vote`, { answerIds: [firstAnswer] })
// 3. Read the results
const results = await call('GET', `/polls/${poll.id}/results`)
for (const answer of results.data.questions[0].answers) {
console.log(answer.text, answer.votesCount, `${answer.percent}%`)
}
// 4. Stop the poll
await call('POST', `/polls/${poll.id}/stop`)
const finished = await call('GET', `/polls/${poll.id}`)
console.log('Status:', finished.data.status)
Endpoint reference
| Method | Path | Bitrix24 method | Description |
|---|---|---|---|
| MethodPOST | Path/v1/chats/:dialogId/polls |
Bitrix24 methodvote.Integration.Im.send | DescriptionCreate a chat poll |
| MethodGET | Path/v1/polls/:pollId |
Bitrix24 methodvote.AttachedVote.get | DescriptionGet a poll |
| MethodGET | Path/v1/polls |
Bitrix24 methodvote.AttachedVote.getMany | DescriptionFind polls by posts or messages |
| MethodGET | Path/v1/polls/:pollId/results |
Bitrix24 methodvote.AttachedVote.getWithVoted | DescriptionPoll results |
| MethodGET | Path/v1/polls/:pollId/answers/:answerId/voters |
Bitrix24 methodvote.AttachedVote.getAnswerVoted | DescriptionList voters for an answer |
| MethodPOST | Path/v1/polls/:pollId/vote |
Bitrix24 methodvote.AttachedVote.vote | DescriptionVote or revote |
| MethodDELETE | Path/v1/polls/:pollId/vote |
Bitrix24 methodvote.AttachedVote.recall | DescriptionRecall a vote |
| MethodPOST | Path/v1/polls/:pollId/stop |
Bitrix24 methodvote.AttachedVote.stop | DescriptionStop a poll |
| MethodPOST | Path/v1/polls/:pollId/resume |
Bitrix24 methodvote.AttachedVote.resume | DescriptionResume a poll |
Error codes
Poll errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_ANSWERS |
DescriptionThe answerIds set does not match the poll questions |
| HTTP403 | CodePOLL_ACCESS_DENIED |
DescriptionBitrix24 denied the poll operation |
| HTTP403 | CodeCHAT_ACCESS_DENIED |
DescriptionNo access to the chat where the poll is being created |
| HTTP403 | CodeRESULTS_HIDDEN |
DescriptionResults are hidden by Bitrix24 rules |
| HTTP404 | CodePOLL_NOT_FOUND |
DescriptionThe poll does not exist or the key cannot access it |
| HTTP404 | CodeANSWER_NOT_FOUND |
DescriptionBitrix24 explicitly denied access to the voter list of the answer |
| HTTP404 | CodeCHAT_NOT_FOUND |
DescriptionThe personal chat could not be resolved |
| HTTP409 | CodePOLL_FINISHED |
DescriptionBitrix24 reported that the poll has finished |
| HTTP409 | CodePOLL_CREATE_IN_PROGRESS |
DescriptionCreation with this idempotencyKey is still in progress |
| HTTP409 | CodeIDEMPOTENCY_KEY_CONFLICT |
DescriptionThe idempotencyKey has already been used by another user or in another chat |
| HTTP502 | CodePOLL_CREATE_OUTCOME_UNKNOWN, POLL_VOTE_OUTCOME_UNKNOWN, POLL_RECALL_OUTCOME_UNKNOWN, POLL_STOP_OUTCOME_UNKNOWN, POLL_RESUME_OUTCOME_UNKNOWN |
DescriptionThe write reached Bitrix24, but the outcome was not confirmed. See "Handling writes" above for what to do |
System errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionInvalid ID in the path or invalid request parameter |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionNo Bitrix24 user session |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the vote scope or, for a personal chat, the im scope |
| HTTP403 | CodeCOWORK_READONLY |
DescriptionThe operation is forbidden for a Cowork key with read-only Bitrix24 account access |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key allows reads only |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the request |
Full list of shared API errors: Errors.