> 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/polls/create.md).

# create()

**`create(input: CreatePollInput): Promise<Poll>`**

Create a new poll with the specified options.

**Parameters:**

* `input` (CreatePollInput): An object containing the poll creation details.
  * `name` (string): The name of the new poll.
  * `options` (string\[]): An array of strings representing the poll options.
  * `pollTypeId` (EntryIdType): The ID representing the type of poll (SingleChoice or MultipleChoice).

**Returns:**

* A `Promise` resolving to the created poll object (`Poll`).

**Example:**

```javascript
const pollInput = {
  name: 'New Poll',
  options: ['Option A', 'Option B', 'Option C'],
  pollTypeId: PollTypes.SingleChoice,
};

try {
  const createdPoll = await pollz.polls.create(pollInput);
  console.log('New Poll Created:', createdPoll);
} catch (error) {
  console.error('Failed to create poll:', error.message);
}
```

The `create` method allows you to create a new poll by providing essential details such as the poll name, options, and the type of poll (SingleChoice or MultipleChoice). The method returns a `Promise` resolving to the created poll object (`Poll`), which includes details like the poll ID, name, creation date, and associated poll type.

**Note:** Ensure that the provided `pollTypeId` corresponds to a valid poll type (SingleChoice or MultipleChoice).
