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

***

# Function: getEvent()

> **getEvent**(`directory`): (`id`, `version`?, `options`?) => `Promise`<`Event`>

Defined in: events.ts:40

Returns an event from EventCatalog.

You can optionally specify a version to get a specific version of the event

## 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                           |
| ----------------------- | ------------------------------ |
| `id`                    | `string`                       |
| `version`?              | `string`                       |
| `options`?              | { `attachSchema`: `boolean`; } |
| `options.attachSchema`? | `boolean`                      |

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

`Promise`<`Event`>

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

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

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

// Gets the latest version of the event
const event = await getEvent('InventoryAdjusted');

// Gets a version of the event
const event = await getEvent('InventoryAdjusted', '0.0.1');

// Get the event with the schema attached
const event = await getEvent('InventoryAdjusted', '0.0.1', { attachSchema: true });
```
