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

# getAll()

**`getAll(page?: number, itemsPerPage?: number, orderBy = OrderBy.Desc): Promise<{ items: Poll[]; meta: PaginationMeta }>`**

Get a list of all polls with pagination support.

**Parameters:**

* `page` (number, optional): The page number to retrieve. Default is `undefined`, which retrieves the first page.
* `itemsPerPage` (number, optional): The number of items to retrieve per page. Default is `undefined`, which retrieves the default number of items per page.
* `orderBy` (OrderBy, optional): The order in which to retrieve polls. Default is `OrderBy.Desc` (descending).

**Returns:**

* A `Promise` resolving to an object with two properties:
  * `items` (Poll\[]): An array of poll objects (`Poll`).
  * `meta` (PaginationMeta): An object containing metadata about the retrieved polls, including the total count, current page, items per page, and the total number of pages.

**Example:**

```javascript
try {
  const pollsList = await pollz.polls.getAll(1, 10, OrderBy.Desc);
  console.log('Polls List:', pollsList);
} catch (error) {
  console.error('Failed to retrieve polls:', error.message);
}
```

The `getAll` method allows you to retrieve a paginated list of all polls. You can specify the page number (`page`), the number of items to retrieve per page (`itemsPerPage`), and the order in which to retrieve polls (`orderBy`).

The method returns a `Promise` resolving to an object with an array of poll objects (`Poll`) and metadata (`PaginationMeta`) providing information about the total count, current page, items per page, and total number of pages.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pollz.gitbook.io/pollz/api-reference/polls/getall.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
