跳到主要内容

API configuration

🏗 Work in progress

The content of this page might not be fully up-to-date with Strapi 5 yet.

General settings for API calls can be set in the ./config/api.js file:

PropertyDescriptionTypeDefault
responsesGlobal API response configurationObject-
responses.privateAttributesSet of globally defined attributes to be treated as private.String array[]
restREST API configurationObject-
rest.prefixThe API prefixString/api
rest.defaultLimitDefault limit parameter used in API calls (see REST API documentation)Integer25
rest.maxLimitMaximum allowed number that can be requested as limit (see REST API documentation).Integer100
✏️ Note

If the rest.maxLimit value is less than the rest.defaultLimit value, maxLimit will be the limit used.

Example:

./config/api.js

module.exports = ({ env }) => ({
responses: {
privateAttributes: ['_v', 'id', 'created_at'],
},
rest: {
prefix: '/v1',
defaultLimit: 100,
maxLimit: 250,
},
});