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

***

# Function: getDataProducts()

> **getDataProducts**(`directory`): (`options`?) => `Promise`<`DataProduct`\[]>

Defined in: data-products.ts:58

Returns all data products from EventCatalog.

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

## 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`?            | { `latestOnly`: `boolean`; } |
| `options.latestOnly`? | `boolean`                    |

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

`Promise`<`DataProduct`\[]>

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

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

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

// Gets all data products (and versions) from the catalog
const dataProducts = await getDataProducts();

// Gets all data products (only latest version) from the catalog
const dataProducts = await getDataProducts({ latestOnly: true });
```
