Skip to main content

Entity Service deprecated

The Entity Service that was used in Strapi v4 is deprecated and replaced by the new Document Service API in Strapi 5.

This section regroups useful notes and procedures about the introduced breaking change.

🔌 Is this breaking change affecting plugins?Yes

Breaking change description

In Strapi v4

The Entity Service API is the go-to API to use to interact with your content-types.

In Strapi 5

The Document Service API replaces the Entity Service API from Strapi v4.

Migration

This section regroups useful notes and procedures about the introduced breaking change.

Notes

The following are the main topics to take into account when using the Document Service API instead of the Entity Service API from Strapi v4:

  • The Document Service API expects a documentId property.
    This breaking change also affects the REST and GraphQL APIs (see the related entry).
  • The response returned by the findMany() function is different in Strapi v4 and Strapi 5:
  • There is no findPage() method anymore in Strapi 5 (see the related breaking change entry)
  • The Draft & Publish feature has been updated in Strapi 5 and this is reflected in the Document Service API:
  • The delete() function of the Document Service API returns a list of affected entries (multiple locales can be deleted all at once), while the delete() function from Strapi v4 returns only the deleted entry.
  • Entity Service decorators can not be used anymore, and Document Service middlewares must be used instead.
  • The Document Service API does not support file uploads.

Migration procedure

The migration is partially handled by a codemod when using the upgrade tool. The Entity Service API to Document Service API migration reference gives additional information about which aspects are handled by the codemod and which use cases require manual migration.