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

***

# Data Products CLI Commands

Manage data products in your EventCatalog from the command line.

## getDataProduct[​](#getdataproduct "Direct link to getDataProduct")

Returns a data product from EventCatalog by its ID

**Arguments:**

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

**Examples:**

```
# Get the latest data product
npx @eventcatalog/cli getDataProduct "customer-360"

# Get a specific version
npx @eventcatalog/cli getDataProduct "customer-360" "1.0.0"
```

***

## getDataProducts[​](#getdataproducts "Direct link to getDataProducts")

Returns all data products from EventCatalog

**Arguments:**

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

**Examples:**

```
# Get all data products
npx @eventcatalog/cli getDataProducts
```

***

## writeDataProduct[​](#writedataproduct "Direct link to writeDataProduct")

Writes a data product to EventCatalog

**Arguments:**

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

***

## writeDataProductToDomain[​](#writedataproducttodomain "Direct link to writeDataProductToDomain")

Writes a data product to a specific domain

**Arguments:**

| Name        | Type | Required | Description                      |
| ----------- | ---- | -------- | -------------------------------- |
| dataProduct | json | Yes      | Data product object              |
| domain      | json | Yes      | Domain reference: {id, version?} |
| options     | json | No       | Options                          |

***

## rmDataProduct[​](#rmdataproduct "Direct link to rmDataProduct")

Removes a data product by its path

**Arguments:**

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

**Examples:**

```
# Remove a data product
npx @eventcatalog/cli rmDataProduct "/customer-360"
```

***

## rmDataProductById[​](#rmdataproductbyid "Direct link to rmDataProductById")

Removes a data product by its ID

**Arguments:**

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

**Examples:**

```
# Remove a data product
npx @eventcatalog/cli rmDataProductById "customer-360"
```

***

## versionDataProduct[​](#versiondataproduct "Direct link to versionDataProduct")

Moves the current data product to a versioned directory

**Arguments:**

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

**Examples:**

```
# Version a data product
npx @eventcatalog/cli versionDataProduct "customer-360"
```

***

## addFileToDataProduct[​](#addfiletodataproduct "Direct link to addFileToDataProduct")

Adds a file to a data product

**Arguments:**

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

***

## addDataProductToDomain[​](#adddataproducttodomain "Direct link to addDataProductToDomain")

Adds a data product reference to a domain

**Arguments:**

| Name          | Type   | Required | Description                           |
| ------------- | ------ | -------- | ------------------------------------- |
| domainId      | string | Yes      | The ID of the domain                  |
| dataProduct   | json   | Yes      | Data product reference: {id, version} |
| domainVersion | string | No       | Specific domain version               |

***

## dataProductHasVersion[​](#dataproducthasversion "Direct link to dataProductHasVersion")

Checks if a specific version of a data product exists

**Arguments:**

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

***
