---
title: "Entities client"
slug: "entities-client"
abstract: "Use the Entities client to get, create, update, or delete entities in Content Hub with support for validation and load configurations."
---
# Entities client

The Entities client can be used to perform CRUD operations on entities.

## Get entities { .notintoc }

The following method gets an entity by ID:

```csharp
IEntity entity = await MClient.Entities.GetAsync(<ENTITY_ID>);

```

If the entity doesn't exist or the user doesn't have permission to read it, the method returns `null`.

> [!note]
> There are many [options to load entities](https://doc.sitecore.com/ch/en/developers/cloud-dev/overview.html "Overview") by ID, by identifier, or by definition. For more information about loading configurations, please refer to the [load configurations section](https://doc.sitecore.com/ch/en/developers/cloud-dev/load-configurations.html "Load configurations").

## Create entities { .notintoc }

You can only create an entity with the `CreateAsync` method.

In the following code snippet, an *Asset* entity is created locally.

```csharp
IEntity asset = await MClient.EntityFactory.CreateAsync("M.Asset");

```

In the following code snippet, the locally created *Asset* entity is sent to the server to be validated and persisted.

```csharp
long id = await MClient.Entities.SaveAsync(asset);

```

The returned `id` is the ID of the newly created entity. You can use this ID to get the latest version of the entity from the server.

## Copy entities { .notintoc }

The configuration of the [Copy options builder](https://doc.sitecore.com/ch/en/developers/api-reference/sdk--stylelabs.m.sdk.models.content.entitycopyoptionsbuilder) can be done in multiple ways, for example:

```csharp

var copyOptions = new EntityCopyOptionsBuilder()
  .WithCopyProfile(<COPY_PROFILE_IDENTIFIER>)
  .Build();

long copyId = await MClient.Entities.CopyAsync(<ORIGINAL_ENITITY_ID>, copyOptions);

```

## Update entities { .notintoc }

Use the `SaveAsync` method on the entities client after making a change.

```csharp
long id = await MClient.Entities.SaveAsync(<ASSET>);

```

The returned `id` is the same ID of the entity. To get the latest version of this entity, use the ID to get it from the server again.

## Delete entities { .notintoc }

You can delete an entity with the `DeleteAsync` method and the entity ID.

```csharp
await MClient.Entities.DeleteAsync(<ENTITY_ID>);

```