@hashirnouman First You need to understand how Strapi users-permissions plugin works
If you look into you db you will see following tables
- up_permissions
- up_permissions_role_links
- up_roles
roles and permissions of user is managed using these tables and you can create custom api and perfrom curd on above tables to add new roles programmatically
you can acess table like
strapi.db.connection
.table('up_roles')
strapi use KNEX ORM under the table so you can read KNEX Documentation for better understanding