Skip to main content

Query Engine API

The Strapi backend provides a Query Engine API to interact with the database layer at a lower level.

βœ‹ Caution

In most cases you should not use the Query Engine API and rather use the Document Service API.

Only use the Query Engine API if you exactly know what you are doing, for instance if you want to use a lower-level API that directly interacts with unique rows of the database.

Please keep in mind that the Query Engine API is not aware of the most advanced Strapi 5 features like Draft & Publish, Internationalization, Content History, and possibly more.

β˜‘οΈ Prerequisites

Before diving deeper into the Query Engine API documentation, it is recommended that you read the following introductions:

Basic usage​

The Query Engine is available through strapi.db.query:

strapi.db.query('api::blog.article').findMany({ // uid syntax: 'api::api-name.content-type-name'
where: {
title: {
$startsWith: '2021',
$endsWith: 'v4',
},
},
populate: {
category: true,
},
});

Available operations​

The Query Engine allows the following operations on database entries: