Railings can definately be created via the API. A quick search yieled several results of working methods as far back as 2018.
Have you tried any of these?