Copy as Markdown[View as Markdown](/docs/sdk/functions/getQueries.md)

***

# Function: getQueries()

> **getQueries**(`directory`): (`options`?) => `Promise`<`Query`\[]>

Defined in: queries.ts:131

Returns all queries from EventCatalog.

You can optionally specify if you want to get the latest version of the queries.

## Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type     |
| ----------- | -------- |
| `directory` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter               | Type                                                    |
| ----------------------- | ------------------------------------------------------- |
| `options`?              | { `attachSchema`: `boolean`; `latestOnly`: `boolean`; } |
| `options.attachSchema`? | `boolean`                                               |
| `options.latestOnly`?   | `boolean`                                               |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`Query`\[]>

## Example[​](#example "Direct link to Example")

```
import utils from '@eventcatalog/utils';

const { getQueries } = utils('/path/to/eventcatalog');

// Gets all queries (and versions) from the catalog
const queries = await getQueries();

// Gets all queries (only latest version) from the catalog
const queries = await getQueries({ latestOnly: true });

// Gets all queries with the schema attached
const queries = await getQueries({ attachSchema: true });
```
