Skip to main content

Strapi 5 has a new, flattened response format for API calls

In Strapi 5, the response format has been simplified and flattened.

This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

Is this breaking change affecting plugins?Yes

Breaking change description

In Strapi v4

The Content API returns all the attributes of requested content wrapped inside an attributes parameter:

{
"data": {
// system fields
"id": 14,
"attributes": {
// user fields
"title": "Article A"
"relation": {
"data": {
"id": "clkgylw7d000108lc4rw1bb6s"
"name": "Category A"
}
}
}
}
"meta": {
"pagination": {
"page": 1,
"pageSize": 10
}
}
}

In Strapi 5

The Content API returns attributes of requested content without wrapping them in an attributes object:

{
"data": {
// system fields
"documentId": "clkgylmcc000008lcdd868feh",
"locale": "en",
// user fields
"title": "Article A"
"relation": {
// system fields
"documentId": "clkgylw7d000108lc4rw1bb6s"
// user fields
"name": "Category A"
}
}
"meta": {
"pagination": {
"page": 1,
"pageSize": 10
}
}
}

Migration

A codemod will automatically handle the change.