Copy as Markdown[View as Markdown](/docs/cli/cli-data-stores.md)

***

# Data Stores CLI Commands

Manage data stores in your EventCatalog from the command line.

## getDataStore[​](#getdatastore "Direct link to getDataStore")

Returns a data store from EventCatalog by its ID

**Arguments:**

| Name    | Type   | Required | Description                          |
| ------- | ------ | -------- | ------------------------------------ |
| id      | string | Yes      | The ID of the data store to retrieve |
| version | string | No       | Specific version to retrieve         |

**Examples:**

```
# Get the latest data store
npx @eventcatalog/cli getDataStore "orders-db"

# Get a specific version
npx @eventcatalog/cli getDataStore "orders-db" "1.0.0"
```

***

## getDataStores[​](#getdatastores "Direct link to getDataStores")

Returns all data stores from EventCatalog

**Arguments:**

| Name    | Type | Required | Description            |
| ------- | ---- | -------- | ---------------------- |
| options | json | No       | Options: {latestOnly?} |

**Examples:**

```
# Get all data stores
npx @eventcatalog/cli getDataStores
```

***

## writeDataStore[​](#writedatastore "Direct link to writeDataStore")

Writes a data store to EventCatalog

**Arguments:**

| Name    | Type | Required | Description                                          |
| ------- | ---- | -------- | ---------------------------------------------------- |
| options | json | No       | Options: {path?, override?, versionExistingContent?} |

***

## writeDataStoreToService[​](#writedatastoretoservice "Direct link to writeDataStoreToService")

Writes a data store to a specific service

**Arguments:**

| Name      | Type | Required | Description                       |
| --------- | ---- | -------- | --------------------------------- |
| dataStore | json | Yes      | Data store object                 |
| service   | json | Yes      | Service reference: {id, version?} |

***

## rmDataStore[​](#rmdatastore "Direct link to rmDataStore")

Removes a data store by its path

**Arguments:**

| Name | Type   | Required | Description            |
| ---- | ------ | -------- | ---------------------- |
| path | string | Yes      | Path to the data store |

**Examples:**

```
# Remove a data store
npx @eventcatalog/cli rmDataStore "/orders-db"
```

***

## rmDataStoreById[​](#rmdatastorebyid "Direct link to rmDataStoreById")

Removes a data store by its ID

**Arguments:**

| Name    | Type   | Required | Description                        |
| ------- | ------ | -------- | ---------------------------------- |
| id      | string | Yes      | The ID of the data store to remove |
| version | string | No       | Specific version to remove         |

**Examples:**

```
# Remove a data store
npx @eventcatalog/cli rmDataStoreById "orders-db"
```

***

## versionDataStore[​](#versiondatastore "Direct link to versionDataStore")

Moves the current data store to a versioned directory

**Arguments:**

| Name | Type   | Required | Description                         |
| ---- | ------ | -------- | ----------------------------------- |
| id   | string | Yes      | The ID of the data store to version |

**Examples:**

```
# Version a data store
npx @eventcatalog/cli versionDataStore "orders-db"
```

***

## addFileToDataStore[​](#addfiletodatastore "Direct link to addFileToDataStore")

Adds a file to a data store

**Arguments:**

| Name    | Type   | Required | Description                      |
| ------- | ------ | -------- | -------------------------------- |
| id      | string | Yes      | The ID of the data store         |
| file    | json   | Yes      | File object: {content, fileName} |
| version | string | No       | Specific version                 |

***

## dataStoreHasVersion[​](#datastorehasversion "Direct link to dataStoreHasVersion")

Checks if a specific version of a data store exists

**Arguments:**

| Name    | Type   | Required | Description              |
| ------- | ------ | -------- | ------------------------ |
| id      | string | Yes      | The ID of the data store |
| version | string | Yes      | Version to check         |

**Examples:**

```
# Check if version exists
npx @eventcatalog/cli dataStoreHasVersion "orders-db" "1.0.0"
```

***
