NextJS application as an application & api


I have a standard nextjs application with auth0 handling login and protecting most my routes using middleware, as defined by nextjs-auth0 sdk. I have a few endpoints on this nextjs application I want to expose via api using the auth0 m2m flow.

How will I go about achieving this? Will I have to create an api application that points at the same nextjs application as well and decrypt jwts prior to using the nextjs-auth0 sdk? Is there another approach that allows me to use the nextjs auth0 sdk?