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

***

# Function: versionDomain()

> **versionDomain**(`directory`): (`id`) => `Promise`<`void`>

Defined in: domains.ts:194

Version a domain by it's id.

Takes the latest domain and moves it to a versioned directory. All files with this domain are also versioned. (e.g /domains/Payment/openapi.yml)

## 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` |

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

`Promise`<`void`>

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

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

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

// moves the latest Payment domain to a versioned directory
// the version within that domain is used as the version number.
await versionDomain('Payment');
```
