CAPPORT RFC API Returns Reponse 404

Hi everyone! Im experiencing some problems with the CAPPORT API.
I have configured everything just like in this tutorial

When I call /hotspot/api.json I get the raw file with unreplaced variables. I understand that this is the way it should behave because the web server returns the file when it's requested to... but based on the tutorial above, I should make the api call like this /hotspot/api or like this /api , and this is where everything goes wrong because I keep getting a 404 response. I have no idea how it can be solved.
EDIT: By chance, can any conflict happen with hotspot routes and Mikrotik web management page routes?

removed links that pointed to dangerous targets.

Sorry I dint know... I replaced the links with just endpoints

What is the version of your RouterOS? In RouterOS 7 you don't have to manually add the DHCP option like what that acticle described. Everything is automatically done for you if you have the DNS name and the correct TLS certificate configured. See:

However, you should read the warning on that page: If you upgraded from older RouterOS versions then you'll have to use the "Reset HTML" function to have the proper content added.

Yes my mikrotik is RouterOS 7.20.6... And you know I dont really have problems with devices understanding that they are behind a captive portal since this was done by mikrotik like you said but I dint know that... anyway some Google Searches and AI responses told me that this API can be used to notify users that their internet is expiring... Im not sure how real this is... Maybe I should post another Topic since this is a different problem.. Do you have any idea please

As you can see from the template of the API output from the documentation, the data is there to "notify the client that their internet is expiring" like you wrote. The part with the DHCP option (that RouterOS takes care of for you) is from RFC 8910 (previously 7710) and only has the purpose of telling the clients where the API URL is located.

The "API" itself is defined in this RFC 8908, here are the supported JSON data fields:

RFC 8908 - Captive Portal API

The information you are interested in is provided by the seconds-remaining and bytes-remaining JSON fields. And as you can see, the default template from RouterOS already includes those, with the corresponding placeholder variables.

Which means if the client devices support RFC 8908 then they will know about the hotspot session nearing expiration.

ok i will try

Thanks a lot, you were right about everything you said. Everything is working as expected, requests at /api work... DHCP options weren't necessary because Mikrotik handled it very well once SSL was valid. Everything works fine.

I HAVE 1 PROBLEM
Not a single notification pops up to the user to tell them that the session is about to end or anything like that. Im not sure if that thing even works because I have never seen a video demostrating it just some theories

It depends on the software running on the clients. Android should display the remaining time (using seconds-remaining) when you go to the settings, you can see the screenshot from the documentation:

https://source.android.com/docs/core/connect/android-custom-tabs-captive-portal#act-discovery

Apparently bytes-remaining is not used.

I have no idea about Apple devices, because I own none. You can forget Windows because it currently doesn't support RFC 8910 and doesn't make use of the advertised API URL from the DHCP option at all and still tries to access www.msftncsi.com ( Captive Portal Detection and User Experience in Windows - Windows drivers | Microsoft Learn).

Well, I think Im done on my side now, the other part is the responsibility of the device. Thanks a lot for your help, I appreciate it