Perhaps take a look at this post talks a about the difference of creating roles through Kibana and Elasticsearch APIs
Perhaps that will help a bit... Or not i.e they are related but not the same.
Think of role API through Kibana as a higher level abstraction of the lower level elasticsearch API
Hope that makes a little sense.