Lifecycles only on api call

System Information
  • Strapi Version: 4.4.3
  • Operating System:
  • Database: Postgress
  • Node Version: 16.17.0
  • NPM Version: 8.19.2
  • Yarn Version:

Hello, is it possible to run lifecycles (afterUpdate) ONLY when triggered by api call? I don’t want to run them after making changes in collection through admin panel.

Don’t think you can as it’s a lifecycle, the admin panel uses the API as well :wink:

I found workaround.

Strapi admin panel uses endpoints like this:
image

and default endpoints starts with this:
image

so you can write a middleware which check which route was called and assign this to strapi config:
image

and then skip lifecycle when this is true
image

Its not perfect of course but it works (at least for now)