any way to have different .notFound depending on parent path ?

I have 2 main path:
api
dashboard

I would like anything path under api/.... that do not exit to return a json object
but anything under dashboard/... to return a web page for not found

is that possible and how ?
Was this page helpful?