Can I do admin operations using api

Hello, I want to make a custom admin page, because there are lots of unnecessary settings in default one. Therefore I would like to know if I can do admin operations like adding “course access role” using api instead of doing it from admin page.
Thanks in advance.