I would like to build a program which takes a username as parameter and creates the user and its home folder (with some hard-coded specifications like folde
Probably your best bet is to invoke useradd; it will do the right things (given appropriate parameters).
Trying to create one manually by calling the appropriate APIs is possible but not desirable.
You mean like adduser or useradd? Try looking at their source code.
There is no API for this. You just write into /etc/passwd and /etc/group (and possibly the shadow versions as well) using normal file access system calls.