---
title: "Commands client"
slug: "commands-client-1523395"
abstract: "Overview of the Commands client used to execute commands that are publicly registered, including examples."
---
# Commands client

The SDK provides a `Commands client` to execute commands that are publicly registered in Sitecore Content Hub.

> [!note]
> The `client` variable in the following code examples refers to the `IMClient` instance. When using the Web SDK, the variable name can be chosen freely, but it is also called `client` at instantiation in the documentation.

## Executing commands

The following information is needed to execute a command:

- Command name
- Command namespace
- Command arguments (depending on the command)

To execute a command through the SDK:

```shell
JToken result = await MClient.Commands.ExecuteCommandAsync(namespace, name, args);

```

The result contains the output of the command.

## Supported commands

Here is a list of available commands by namespace:

### external.action

- Command name: Arguments
- `external.action`:

```csharp
new JObject(
    new JProperty("entity_id", <long>),
    new JProperty("action_id", <long>),
    new JProperty("properties", <collection>),
    new JProperty("relations", <long>),
    new JProperty("action_execution_source", <string>)),
    new JProperty("extra_data", <collection>))

```

### base

- Command name: Arguments
- `delete.entities`:

```csharp
new JObject(
    new JProperty("ids", <collection>),
    new JProperty("identifiers", <collection>))

```

### m.asset

- Command name: Arguments
- `checkin`:

```csharp
new JObject(new JProperty("asset_id", <long>))

```

- `checkout`:

```csharp
new JObject(new JProperty("entity_ids", <collection>))

```

- `create.draft`:

```csharp
new JObject(new JProperty("entity_id", <long>))

```

- `discard`:

```csharp
new JObject(new JProperty("asset_id", <long>))

```

- `download.onedrive`:

```csharp
new JObject(new JArray("entity_ids", <collection>))

```

- `import`:

```csharp
new JObject(
    new JProperty("entityId", <long>),
    new JProperty("type", <ImportSchemaType>),
    new JProperty("remove_schema", <boolean>),
    new JProperty("url", <string>))

```

- `publish.draft`:

```csharp
new JObject(new JProperty("entity_id", <long>))

```

- `setmaster`:

```csharp
new JObject(
    new JProperty("new_master_id", <long>),
    new JProperty("entity_id", <long>),
    new JProperty("master_relation", <string>))

```

- `unlock`:

```csharp
new JObject(new JProperty("entity_id", <long>))

```

### m.chili

- Command name: Arguments
- `createpublication`:

```csharp
new JObject(new JProperty("id", <long>))

```

- `deletechilipublication`:

```csharp
new JObject(new JProperty("publicationId", <long>))

```

- `duplicatepublication`:

```csharp
new JObject(new JProperty("id", <long>))

```

- `getgenerationconfiguration`:

```csharp
new JObject(
    new JProperty("qualities", <collection>),
    new JProperty("endpoint", <string>),
    new JProperty("load_endpoint", <string>),
    new JProperty("editor_token", <string>))

```

### m.collection

- Command name: Arguments
- `enable.collection`:

```csharp
new JObject(
    new JProperty("definition_id", <long>),
    new JProperty("enable", <boolean>),
    new JProperty("page_name", <string>))

```

### m.drm

- Command name: Arguments
- `ask.usagerights`:

```text
new JObject(new JProperty("requestId", <long>))

```

- `order`:

```csharp
new JObject(
    new JProperty("requestId", <long>),
    new JProperty("order_request", <OrderRequestResource>),
    new JProperty("item_name_resolver_id", <string>),
    new JProperty("culture", <string>),
    new JProperty("order_id", <long>),
    new JProperty("custom_name", <string>),
    new JProperty("setting_category", <string>),
    new JProperty("setting_name", <string>))

```

- `order.restricted.authorized`:

```csharp
new JObject(
    new JProperty("requestId", <long>),
    new JProperty("order_request", <OrderRequestResource>),
    new JProperty("item_name_resolver_id", <string>),
    new JProperty("culture", <string>),
    new JProperty("authorized", <boolean>),
    new JProperty("custom_name", <string>),
    new JProperty("setting_category", <string>),
    new JProperty("setting_name", <string>),
    new JProperty("order_id", <long>))

```

- `order.restricted.nonauthorized`:

```csharp
new JObject(
    new JProperty("requestId", <long>),
    new JProperty("order_request", <OrderRequestResource>),
    new JProperty("item_name_resolver_id", <string>),
    new JProperty("culture", <string>),
    new JProperty("authorized", <boolean>),
    new JProperty("custom_name", <string>),
    new JProperty("setting_category", <string>),
    new JProperty("setting_name", <string>))

```

- `validate.usagerights`:

```csharp
new JObject(
    new JProperty("requestId", <long>),
    new JProperty("restricted", <boolean>),
    new JProperty("authorized", <boolean>),
    new JProperty("explicitApprovalRequired", <boolean>),
    new JProperty("renditions", <JToken>),
    new JProperty("targetId", <long>))

```

- `validate.usagerights.request`:

```csharp
new JObject(
    new JProperty("targetId", <long>),
    new JProperty("relations", <collection>),
    new JProperty("start_date", <DateTimeOffset>),
    new JProperty("end_date", <DateTimeOffset>))

```

### m.entity

- Command name: Arguments
- `removefromrelation`:

```csharp
new JObject(
    new JProperty("entityId", <long>),
    new JProperty("relationName", <string>),
    new JProperty("relationRole", <RelationRole>),
    new JProperty("ids", <collection>))

```

- `updaterelation`:

```csharp
new JObject(
    new JProperty("entityId", <long>),
    new JProperty("relation", <string>),
    new JProperty("role", <RelationRole>),
    new JProperty("action", <RelationAction>),
    new JProperty("ids", <collection>))

```

### m.file

- Command name: Arguments
- `create.video.alternative`:

```csharp
new JObject(
    new JProperty("entityId", <long>),
    new JProperty("seekPosition", <double>))

```

### m.job

- Command name: Arguments
- `canceljob`:

```csharp
new JObject(new JProperty("entity_Id", <long>))

```

> [!note]
> The `canceljob` command stops processes for *Import* and *MassEdit table* [jobs](https://doc.sitecore.com/ch/en/users/content-hub/job-type.html) only. It does not affect *Processing* jobs.

### m.portal.senddummyemail

- Command name: Arguments
- `send.email`:

```csharp
new JObject(
    new JProperty("template_Id", <long>),
    new JProperty("user_email", <string>),
    new JProperty("variables", <JToken>),
    new JProperty("templateType", <string>))

```

### m.portal.theme

- Command name: Arguments
- `duplicate.theme`:

```csharp
new JObject(new JProperty("themeId", <long>))

```

- `generate.theme`:

```csharp
new JObject(new JProperty("entity_id", <long>))

```

- `enabledisable.theme`:

```csharp
new JObject(
    new JProperty("theme_Id", <long>),
    new JProperty("enable", <boolean>))

```

- `set.default`:

```csharp
new JObject(
    new JProperty("entity_Id", <long>))

```

### m.portal.version

- Command name: Arguments
- `publish.version`:

```csharp
new JObject(
    new JProperty("version_Id", <long>))

```

### m.print

- Command name: Arguments
- `copy.publication`:

```csharp
new JObject(
    new JProperty("template_id", <long>),
    new JProperty("culture", <CultureInfo>))

```

- `create.annotation`:

```csharp
new JObject(
    new JProperty("annotation", <JToken>),
    new JProperty("publicationId", <long>))

```

- `delete.annotation`:

```csharp
new JObject(
    new JProperty("annotationId", <long>))

```

- `delete.publication`:

```csharp
new JObject(
    new JProperty("publicationId", <long>))

```

### m.security

- Command name: Arguments
- `applyusergrouprole`:

```csharp
new JObject(
    new JProperty("usergroup_id", <long>),
    new JProperty("role", <string>),
    new JProperty("target_id", <long>))

```

- `applyuserrole`:

```csharp
new JObject(
    new JProperty("user_id", <long>),
    new JProperty("role", <string>),
    new JProperty("target_id", <long>))

```

- `getpermissions`:

```csharp
new JObject(new JProperty("definitions", <collection>))

```

- `removeusergrouprole`:

```csharp
new JObject(
    new JProperty("usergroup_id", <long>),
    new JProperty("role", <string>),
    new JProperty("target_id", <long>))

```

- `removeuserrole`:

```csharp
new JObject(
    new JProperty("user_id", <long>),
    new JProperty("role", <string>),
    new JProperty("target_id", <long>))

```

- `setroles`:

```csharp
new JObject(
    new JProperty("user_roles", <collection>),
    new JProperty("usergroup_roles", <collection>),
    new JProperty("target_id", <long>))

```

### m.taxonomy

- Command name: Arguments
- `move.taxonomy`:

```csharp
new JObject(
    new JProperty("relation", <string>),
    new JProperty("id_to_move", <long>),
    new JProperty("parentId", <long>))

```

- `update.sortorder`:

```csharp
new JObject(new JProperty("sortOrder", <collection>))

```

### portal

- Command name: Arguments
- `change.layout`:

```csharp
new JObject(
    new JProperty("pageId", <long>),
    new JProperty("layoutName", <string>))

```

- `clone.page`:

```csharp
new JObject(
    new JProperty("TemplatePageId", <long>),
    new JProperty("ParentPageId", <long>),
    new JProperty("PageName", <string>),
    new JProperty("CalculatedIdentifier", <boolean>))

```

- `create.pagecomponent`:

```csharp
new JObject(
    new JProperty("pageId", <long>),
    new JProperty("zoneId", <long>),
    new JProperty("componentType", <string>),
    new JProperty("componentData", <string>),
    new JProperty("componentSettings", <string>),
    new JProperty("componentName", <string>),
    new JProperty("componentTitle", <string>),
    new JProperty("componentIsVisible", <boolean>),
    new JProperty("componentUIVisibility", <string>),
    new JProperty("componentIsNested", <boolean>),
    new JProperty("zoneName", <string>))

```

- `delete.page`:

```csharp
new JObject(new JProperty("pageId", <long>))

```

- `delete.tabspagecomponenttab`:

```csharp
new JObject(
    new JProperty("id", <long>),
    new JProperty("tab_name", <string>))

```

- `deleteormarkasdeleted.discussion`:

```csharp
new JObject(new JProperty("id", <long>))

```

- `download.excel`:

```csharp
new JObject(
    new JProperty("entityIds", <collection>),
    new JProperty("cultures", <collection>),
    new JProperty("query", <string>),
    new JProperty("type", <string>),
    new JProperty("request_uri", <string>),
    new JProperty("userFriendlyColumnHeaders", <boolean>),
    new JProperty("userFriendlyCellValues", <boolean>),
    new JProperty("filename", <string>),
    new JProperty("selectionComponentId", <long>))

```

- `duplicate.pagecomponent`:

```csharp
new JObject(
    new JProperty("componentContainerId", <long>),
    new JProperty("originalPageComponentId", <long>),
    new JProperty("componentType", <string>),
    new JProperty("calculatedIdentifier", <boolean>))

```

- `log.speedtest`:

```csharp
new JObject(
    new JProperty("testStatus", <string>),
    new JProperty("portalPing", <string>),
    new JProperty("portalDownload", <string>),
    new JProperty("portalUpload", <string>),
    new JProperty("deliveryPing", <string>),
    new JProperty("deliveryDownload", <string>),
    new JProperty("deliveryUpload", <string>))

```

- `migrate.layout`:

```csharp
new JObject(new JProperty("pageId", <long>))

```

- `paste.pagecomponent`:

```csharp
new JObject(
    new JProperty("action", <string>),
    new JProperty("page_component_identifier", <string>),
    new JProperty("source_identifier", <string>),
    new JProperty("destination_identifier", <string>))

```

- `save.translation`:

```csharp
new JObject(
    new JProperty("values", <collection>),
    new JProperty("entry_name", <string>),
    new JProperty("context_name", <string>))

```

- `setbackground`:

```csharp
new JObject(
    new JProperty("pageId", <long>),
    new JProperty("assetId", <long>),
    new JProperty("position", <string>),
    new JProperty("renditionName", <string>))

```

- `whatsNewVisualized`:

```csharp
new JObject()

```

### project

- Command name: Arguments
- `accept.task`:

```csharp
new JObject(new JProperty("taskId", <long>))

```

- `add.predecessor`:

```csharp
new JObject(
        new JProperty("predecessorid", <long>),
        new JProperty("dependentid", <long>))

```

- `block.review`:

```csharp
new JObject(
        new JProperty("entityId", <long>),
        new JProperty("pageEntityId", <long>),
        new JProperty("reviewStatusRelation", <string>),
        new JProperty("reviewRelation", <string>),
        new JProperty("status", <string>),
        new JProperty("reason", <string>))

```

- `cancel.task`:

```csharp
new JObject(new JProperty("taskId", <long>))

```

- `complete.task`:

```csharp
new JObject(
        new JProperty("taskid", <long>),
        new JProperty("feedback", <string>))

```

- `copy.block`:

```csharp
new JObject(
        new JProperty("parentId", <long>),
        new JProperty("templateId", <long>),
        new JProperty("overwritePropertyNames", <collection>),
        new JProperty("overwriteRelationNames", <collection>),
        new JProperty("overwritePropertyValues", <JToken>),
        new JProperty("overwriteRelationValues", <collection>),
        new JProperty("overwriteTemplateChildren", <boolean>))

```

- `create.asset.localization`:

```csharp
new JObject(
        new JProperty("parentassetid", <long>),
        new JProperty("localizationids", <collection>))

```

- `decline.task`:

```csharp
new JObject(
        new JProperty("taskId", <long>),
        new JProperty("feedback", <string>))

```

- `enable.mproject`:

```csharp
new JObject(
        new JProperty("definition_id", <long>),
        new JProperty("enable", <boolean>),
        new JProperty("force", <boolean>))

```

- `invoke.task`:

```csharp
new JObject(new JProperty("id", <long>))

```

- `like`:

```csharp
new JObject(
        new JProperty("entity_id", <long>),
        new JProperty("value", <string>),
        new JProperty("relation", <string>))

```

- `parallel.approve`:

```csharp
new JObject(
        new JProperty("entityId", <long>),
        new JProperty("pageEntityId", <long>),
        new JProperty("relation", <string>),
        new JProperty("status", <string>),
        new JProperty("reason", <string>))

```

- `remove.predecessor`:

```csharp
new JObject(
        new JProperty("predecessorid", <long>),
        new JProperty("dependentid", <long>))

```

- `send.to.dam`:

```csharp
new JObject(
        new JProperty("entityIds", <collection>),
        new JProperty("statusIdentifier", <string>))

```

- `set.block.lifecyclestatus`:

```csharp
new JObject(
        new JProperty("id", <long>),
        new JProperty("status", <string>))

```

- `set.deliverables.lifecyclestatus`:

```csharp
new JObject(
        new JProperty("entityId", <long>),
        new JProperty("status", <string>),
        new JProperty("statusRelation", <string>),
        new JProperty("reason", <string>),
        new JProperty("reasonProperty", <string>))

```

- `set.inherits.security`:

```csharp
new JObject(
        new JProperty("id", <long>),
        new JProperty("value", <boolean>))

```

- `status.deliverable`:

```csharp
new JObject(
        new JProperty("id", <long>),
        new JProperty("block_id", <long>),
        new JProperty("content_repository_relation", <string>),
        new JProperty("block_deliverables_relation", <string>),
        new JProperty("block_brief_relation", <string>),
        new JProperty("task_relation", <string>),
        new JProperty("exists_in_dam", <boolean>),
        new JProperty("count_deliverable_blocks", <int>),
        new JProperty("count_brief_blocks", <int>),
        new JProperty("count_tasks", <int>))

```

- `take.task`:

```csharp
new JObject(new JProperty("taskid", <long>))

```

- `task.remind`:

```csharp
new JObject(new JProperty("id", <long>))

```

- `update.timeline`:

```csharp
new JObject(new JProperty("items", <collection>))

```

### derivatives

- Command name: Arguments
- `create.variant`:

```csharp
new JObject(
                new JProperty("properties_overrides", new JObject()),
                new JProperty("relations_overrides", new JObject()))

```

- `create.draft`:

```csharp
new JObject(
                new JProperty("state_flow_id", <long>))

```

- `detach.draft`:

```csharp
new JObject(
                new JProperty("target_entities", <collection>))

```

### stateflow

- Command name: Arguments
- `assign.stateflow`: target_id - the ID of the entity to add the state flow to. Required.state_flow_id - the ID of the state flow to assign to the entity. Required.initial_state_id - the ID of the initial state to apply within the state flow. Optional.Example:

```csharp
await MClient.Commands.ExecuteCommandAsync("automation","assign.stateflow", new JObject
{
    new JProperty("state_flow_id", 222),
    new JProperty("target_id", 111),
    new JProperty("initial_state_id", 555)
});

```

- `apply.state`: target_id - the ID of the entity to apply the state to. Required.route_id - the ID of the route to apply for state transition. Required.Example:

```csharp
await MClient.Commands.ExecuteCommandAsync("automation", "apply.state", new JObject
{
    new JProperty("target_id", 111),
    new JProperty("route_id", 999)
});

```