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

***

# Entities CLI Commands

Manage entities in your EventCatalog from the command line.

## getEntity[​](#getentity "Direct link to getEntity")

Returns an entity from EventCatalog by its ID

**Arguments:**

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

**Examples:**

```
# Get the latest entity
npx @eventcatalog/cli getEntity "Order"

# Get a specific version
npx @eventcatalog/cli getEntity "Order" "1.0.0"
```

***

## getEntities[​](#getentities "Direct link to getEntities")

Returns all entities from EventCatalog

**Arguments:**

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

**Examples:**

```
# Get all entities
npx @eventcatalog/cli getEntities
```

***

## writeEntity[​](#writeentity "Direct link to writeEntity")

Writes an entity to EventCatalog

**Arguments:**

| Name    | Type | Required | Description                                          |
| ------- | ---- | -------- | ---------------------------------------------------- |
| entity  | json | Yes      | Entity object with id, name, version, and markdown   |
| options | json | No       | Options: {path?, override?, versionExistingContent?} |

***

## rmEntity[​](#rmentity "Direct link to rmEntity")

Removes an entity by its path

**Arguments:**

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

**Examples:**

```
# Remove an entity
npx @eventcatalog/cli rmEntity "/Order"
```

***

## rmEntityById[​](#rmentitybyid "Direct link to rmEntityById")

Removes an entity by its ID

**Arguments:**

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

**Examples:**

```
# Remove an entity
npx @eventcatalog/cli rmEntityById "Order"
```

***

## versionEntity[​](#versionentity "Direct link to versionEntity")

Moves the current entity to a versioned directory

**Arguments:**

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

**Examples:**

```
# Version an entity
npx @eventcatalog/cli versionEntity "Order"
```

***

## entityHasVersion[​](#entityhasversion "Direct link to entityHasVersion")

Checks if a specific version of an entity exists

**Arguments:**

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

**Examples:**

```
# Check if version exists
npx @eventcatalog/cli entityHasVersion "Order" "1.0.0"
```

***
