> For the complete documentation index, see [llms.txt](https://pollz.gitbook.io/pollz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pollz.gitbook.io/pollz/api-reference/anonymous/voteanonymously.md).

# voteAnonymously()

**`voteAnonymously(anonymousPollToken: string, optionIds: EntryIdType[], userId?: string): Promise<boolean>`**

Submit an anonymous vote for a poll.

**Parameters:**

* `anonymousPollToken` (string): The anonymous voting token for the target poll.
* `optionIds` (EntryIdType\[]): An array of option IDs representing the user's vote.
* `userId` (string, optional): An optional unique user identifier.

**Returns:**

* A `Promise` resolving to a boolean indicating whether the vote was successfully submitted.

**Example:**

```javascript
const voteResult = await pollz.anonymous.voteAnonymously('your-anonymous-token', [1, 2], 'user-123');
console.log('Anonymous Vote Submitted:', voteResult);
```

The `voteAnonymously` method enables users to anonymously cast their votes for a specific poll using the provided anonymous voting token. Users can select multiple options (`optionIds`) and may optionally provide a unique user identifier (`userId`).

This method returns a boolean value indicating the success of the vote submission. A `true` value means the vote was successfully recorded, while `false` indicates an unsuccessful attempt.

**Note:** Ensure that the provided `anonymousPollToken` is valid and corresponds to an existing anonymous voting session.
