# Entity Service API

> Source: https://docs.strapi.io/cms/api/entity-service

The Entity Service API is a backend layer that handles complex content structures like components and dynamic zones, providing CRUD operations, filtering, populating relations, and pagination via `strapi.entityService`.

:::caution
The Entity Service API is deprecated in Strapi v5. Please consider using the [Document Service API](/cms/api/document-service) instead.
:::

:::prerequisites
Before diving deeper into the Entity Service API documentation, it is recommended that you read the following introductions:
- the [backend customization introduction](/cms/backend-customization),
- and the [Content APIs introduction](/cms/api/content-api).
:::

The Strapi backend provides an Entity Service API, built on top of the [Query Engine API](/cms/api/query-engine/). The Entity Service is the layer that handles Strapi's complex content structures like [components](/cms/backend-customization/models#components-json) and [dynamic zones](/cms/backend-customization/models#dynamic-zones), and uses the Query Engine API under the hood to execute database queries.

:::strapi Entity Service API vs. Query Engine API

Strapi v4 offers several layers to interact with the backend and build your queries:

* The Document Service API is the recommended API to interact with your application's database. The Document Service is the layer that handles Strapi's document model and the complex content structures like components and dynamic zones, which the lower-level layers are not aware of.
* The Query Engine API interacts with the database layer at a lower level and is used under the hood to execute database queries. It gives unrestricted internal access to the database layer, but should be used only if the Document Service API does not cover your use case.
* If you need direct access to `knex` functions, use `strapi.db.connection`.

:::

:::info Disambiguation: Services vs. Entity Service
While [services](/cms/backend-customization/services) can use the Entity Service API, services and the Entity Service API are not directly related. You can find more information about the core elements of the Strapi back end in the [back-end customization](/cms/backend-customization) documentation.
:::

## Basic usage

The Entity Service is available through `strapi.entityService`:

```js
const entry = await strapi.entityService.findOne('api::article.article', 1, {
  populate: { someRelation: true },
});
```

## Available operations

The Entity Service API allows the following operations on entities:

- [CRUD operations](/cms/api/entity-service/crud): Create, read, update, and delete entities with the Entity Service API.
- [Filters](/cms/api/entity-service/filter): Get exactly what you need by filtering entities with your Entity Service API queries.
- [Populate](/cms/api/entity-service/populate): Get additional data with your Entity Service API queries by populating relations.
- [Order & Pagination](/cms/api/entity-service/order-pagination): Sort and paginate the results of your Entity Service API queries.
- [Components/Dynamic Zones](/cms/api/entity-service/components-dynamic-zones): Create and update components and dynamic zones with your Entity Service API queries.
