Is there is a way to access api level middleware in strapi v4.5

Yes.
Don’t add the middleware in /config/middlewares.ts (this adds it to all routes).
Add the middleware to the routes you want to apply it on instead.

See this doc: