Timo6 if you self-host Flarum, there is no constraint. It can be an apex/top level domain or any level of subdomains, or a subfolder.
If you are referring to the FreeFlarum service, the service is managed by a community member and you should consult their documentation. I believe they use CNAME records and as such apex domains cannot be used.