How can i set posting option through api?

I want to send a message to particular group through API. In discourse setting, there is one posting option that includes this two settings like Who can @mention this group?
and Who can message this group?

Basically i want to perform this two operations through discourse api.

Glad you are interested in using the API :slightly_smiling_face:. Please take a look at How to reverse engineer the Discourse API and then perform those actions in the UI and you will be able to see which specific api calls are made in the browsers console network tab.