First of all, the roles param is optional and I believe the default value is the "Standard User". The roles param is an array of object which has the "id" and "uri", which are internal values. For some reason we have no public API to query roles so it seems you can't define the roles param when creating an extension using API.
Please submit a support ticket to ask for accessing the read roles API. Please mention me on your request so I can talk to the support engineer.
+ Phong Vu
Just to add, as you can go through the API documentation here
https://developers.ringcentral.com/api-reference/Extensions/createExtension
As already mentioned in previous answer, roles param is optional so that's the reason you are able to create extension without issue. Please go the document carefully, you can get details of the API and each parameter description. You can even test you API here.
@Anirban That doesn't answer OP's original question about if a role can be assigned via API. While yes, the role parameter is optional, as you stated, OP is requesting to know how to change the role if necessary/desired.
@eric-olsen
It appears to assign/change a user's Role the Role Management APIs need to be used.
Any Role in the Account's inventory can be set as the Default Role. That implies all new users/extensions created will get that Role. I haven't seen where an existing Role can be specified in any of the Provisioning APIs (Extensions nor SCIM).