crud
Type
External
Status
Published
Created
Mar 5, 2026
Updated
May 11, 2026
Updated by
Dosu Bot
Source
View

import ManagingRelations from '/docs/snippets/managing-relations.md'
import ESdeprecated from '/docs/snippets/entity-service-deprecated.md'

CRUD operations with the Entity Service API#

The Entity Service API is built on top of the the Query Engine API and uses it to perform CRUD operations on entities.

The uid parameter used in function calls for this API is a string built with the following format: [category]::[content-type] where category is one of: admin, plugin or api.

Examples:

  • A correct uid to get users of the Strapi admin panel is admin::user.
  • A possible uid for the Upload plugin could be plugin::upload.file.
  • As the uids for user-defined custom content-types follow the api::[content-type] syntax, if a content-type article exists, it is referenced by api::article.article.

findOne()#

Finds the first entry matching the parameters.

Syntax: findOne(uid: string, id: ID, parameters: Params)Entry

Parameters#

ParameterDescriptionType
fieldsAttributes to returnString[]
populateRelations, components and dynamic zones to populatePopulateParameter
localeLocale code (for example fr-FR) when the Internationalization plugin is enabled. Targets the localized variant instead of the default locale.string

Example#

const entry = await strapi.entityService.findOne('api::article.article', 1, {
  fields: ['title', 'description'],
  populate: { category: true },
});

findMany()#

Finds entries matching the parameters.

Syntax: findMany(uid: string, parameters: Params)Entry[]

Parameters#

ParameterDescriptionType
fieldsAttributes to returnString[]
filtersFilters to useFiltersParameters
startNumber of entries to skip (see pagination)Number
limitNumber of entries to return (see pagination)Number
sortOrder definitionOrderByParameter
populateRelations, components and dynamic zones to populatePopulateParameter
publicationStatePublication state, can be:
  • live to return only published entries
  • preview to return both draft entries & published entries (default)
PublicationStateParameter
localeLocale code when the Internationalization plugin is enabled. Restricts results to that locale (omit for the default locale).string

Example#

const entries = await strapi.entityService.findMany('api::article.article', {
  fields: ['title', 'description'],
  filters: { title: 'Hello World' },
  sort: { createdAt: 'DESC' },
  populate: { category: true },
});

create()#

Creates one entry and returns it

Syntax: create(uid: string, parameters: Params)Entry

Parameters#

ParameterDescriptionType
fieldsAttributes to returnString[]
populateRelations, components and dynamic zones to populatePopulateParameter
localeLocale code when the Internationalization plugin is enabled. Creates the entry for that locale.string
dataInput dataObject

Example#

const entry = await strapi.entityService.create('api::article.article', {
  data: {
    title: 'My Article',
  },
});

update()#

Updates one entry and returns it.

Syntax: update(uid: string, id: ID, parameters: Params)Entry

Parameters#

ParameterDescriptionType
fieldsAttributes to returnString[]
populateRelations, components and dynamic zones to populatePopulateParameter
localeLocale code when the Internationalization plugin is enabled. Updates the matching localized variant.string
dataInput dataobject

Example#

const entry = await strapi.entityService.update('api::article.article', 1, {
  data: {
    title: 'xxx',
  },
});

delete()#

Deletes one entry and returns it.

Syntax: delete(uid: string, id: ID, parameters: Params)Entry

Parameters#

ParameterDescriptionType
fieldsAttributes to returnString[]
populateRelations, components and dynamic zones to populatePopulateParameter
localeLocale code when the Internationalization plugin is enabled. Deletes the localized variant that matches this locale.string

Example#

const entry = await strapi.entityService.delete('api::article.article', 1);
crud | Dosu