# Entities API

Use the Entities API to retrieve, create, update, and delete entities. An entity is a set of data that belongs together (such as for a product, campaign, project, story, recipe, or asset).

## Authentication

To use the Entities API, you need:

- The URL of your Content Hub server. You can get this from your Content Hub Administrator. Enter this URL in the <b>{{server}}</b> variable by hovering your mouse  over the variable in the <b>Try it</b> pane and then clicking <b>Edit</b>.
- An access token and the client ID. Both are sent with every request. You can create a token through the [Content Hub interface](https://doc.sitecore.com/ch/en/users/content-hub/create-an-oauth-client.html) or by [requesting one using the API itself](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#grant-flows)
   {% admonition type="info" name="Note" %}A [Copy method](https://doc.sitecore.com/ch/en/developers/cloud-dev/entity-1523348.html) is also available. {% /admonition %}


Version: v2.0
License: closed source
Metadata:
  - product: Content Hub

## Servers

```
https://{server}
```

Variables:
- `server`
Default: "your-server"

## Security

### OAuth2

Type: oauth2

## Download OpenAPI description

[Entities API](https://api-docs.sitecore.com/_bundle/ch/entities-api/@v2.0/index.yaml)

## Entities

The Entities endpoint is used to manage entities.  

### Retrieve an entity using its ID

 - [GET /api/entities/{id}](https://api-docs.sitecore.com/ch/entities-api/entities/entitybyid.md): Retrieves an entity using its ID and loads related data, including entity properties, member groups, renditions, permissions, and so on. You can also specify cultures for multi-language support.

### Update an entity using its ID

 - [PUT /api/entities/{id}](https://api-docs.sitecore.com/ch/entities-api/entities/updateentity.md): Updates an entity with the new details provided, including properties, relations, associated members and groups, and so on. Properties or relations not included in the request will be set to null.

### Delete an entity using its ID

 - [DELETE /api/entities/{id}](https://api-docs.sitecore.com/ch/entities-api/entities/deleteentity.md): Deletes an entity with the specified ID.

### Retrieve an entity using its identifier

 - [GET /api/entities/identifier/{identifier}](https://api-docs.sitecore.com/ch/entities-api/entities/entitybyidentifier.md): Retrieves an entity with the specified identifier, including related data such as properties, member groups, renditions, permissions, and so on.

### Update an entity using its identifier

 - [PUT /api/entities/identifier/{identifier}](https://api-docs.sitecore.com/ch/entities-api/entities/updateentitybyidentifier.md): Updates an entity with the new details provided, including properties, relations, associated members and groups, and so on. Properties or relations not included in the request will be set to null.

### Delete an entity using its identifier

 - [DELETE /api/entities/identifier/{identifier}](https://api-docs.sitecore.com/ch/entities-api/entities/deleteentitybyidentifier.md): Deletes an entity with the specified identifier.

### Retrieve a list of all entities for a specific entity definition

 - [GET /api/entitydefinitions/{name}/entities](https://api-docs.sitecore.com/ch/entities-api/entities/entitiesbydefinition.md): Lists all entities for the specified entity definition.

### Create an entity

 - [POST /api/entities](https://api-docs.sitecore.com/ch/entities-api/entities/addentity.md): Creates an entity with the specified details, including associated members and groups. The link to the associated Entity Definition Resource is required. The self property is ignored and can be omitted.   If the request body contains an id, the request is treated as a possible UPSERT. If the id is omitted and only an identifier is provided, the request returns a conflict instead of updating the existing entity. The request then checks for the existence of the entity and if the response is positive, it updates the entity based on the provided body elements. When an id is present, the header contains the same Location property as with a normal POST response. When an identifier is used, the header contains an X-Global-Identifier property with the updated identifier as its value.   Use the Upload API to upload assets to Content Hub. {% admonition type="info" name="Note" %}It is not possible to set relations while creating an entity unless the relations are nested. Additionally, this functionality is available only through the REST API and not through the Web Client SDK. For non-nested relations one call is made for each relation that is updated. {% /admonition %}

### Retrieve renditions for a specified entity

 - [GET /api/entities/{entityId}/v2.0/renditions](https://api-docs.sitecore.com/ch/entities-api/entities/getrenditionsv2.md): Retrieves information about all renditions that exist for a specified entity, including their gateway links and delivery links.

### Retrieve renditions for a specified entity

 - [POST /api/entities/{entityId}/v2.0/renditions](https://api-docs.sitecore.com/ch/entities-api/entities/getfilteredrenditionsv2.md): Retrieves information about renditions that exist for a specified entity, including their gateway links and delivery links. Renditions can be filtered by area of use or by their rendition link name, or both.

### Retrieve the count of user renditions for a specified entity

 - [GET /api/entities/{entityId}/v2.0/renditions/GetUserRenditionsCount](https://api-docs.sitecore.com/ch/entities-api/entities/getuserrenditioncountv2.md): Retrieves the count of user renditions for a specified entity.

## Lifecycle

The Lifecycle endpoint is used to manage the entity lifecycle and validate user permissions to perform various actions.

### Retrieve lifecycle actions

 - [GET /api/entities/{id}/lifecycle](https://api-docs.sitecore.com/ch/entities-api/lifecycle/entitylifecycle.md): Retrieves the lifecycle actions that are available for the entity based on its permissions (independent of its current state). For example, if a user is allowed to submit an entity, the submit action will be returned in the list, even if  the entity has already been approved.

### Submit an entity for review

 - [POST /api/entities/{id}/lifecycle/submit](https://api-docs.sitecore.com/ch/entities-api/lifecycle/submitentity.md): Submits an entity in the created state for review allowing the user to approve or reject it. Requires the Submit permission.

### Publish an entity directly

 - [POST /api/entities/{id}/lifecycle/directpublish](https://api-docs.sitecore.com/ch/entities-api/lifecycle/directpublishentity.md): Publishes an entity with the created state directly, without going through the approval process. Requires the DirectPublish permission.

### Approve an entity

 - [POST /api/entities/{id}/lifecycle/approve](https://api-docs.sitecore.com/ch/entities-api/lifecycle/approveentity.md): Approves an entity in the review state. Requires the Approve permission.

### Reject an entity

 - [POST /api/entities/{id}/lifecycle/reject](https://api-docs.sitecore.com/ch/entities-api/lifecycle/rejectentity.md): Rejects an entity in the review state. A reason for the rejection must be provided. Requires the Reject permission.

### Archive an entity

 - [POST /api/entities/{id}/lifecycle/archive](https://api-docs.sitecore.com/ch/entities-api/lifecycle/archiveentity.md): Archives an approved entity. The entity can be restored if needed. Requires the Archive permission.

### Restore an entity

 - [POST /api/entities/{id}/lifecycle/restore](https://api-docs.sitecore.com/ch/entities-api/lifecycle/restoreentity.md): Restores an archived entity to the approved state. Requires the Archive permission.

### Restore an entity from the deleted state

 - [POST /api/entities/{id}/lifecycle/restorefromdelete](https://api-docs.sitecore.com/ch/entities-api/lifecycle/restorefromdelete.md): Restores an entity that has been soft deleted. Hard deleted entities cannot be restored. Requires the Delete permission.

### Soft delete an entity

 - [POST /api/entities/{id}/lifecycle/softdeleteentity](https://api-docs.sitecore.com/ch/entities-api/lifecycle/softdeleteentity.md): Deletes an entity, marking it as deleted but without permanently removing it from the system (soft deletion). This action can be reversed by restoring the entity later. Requires the Delete permission.

