---
title: AuthorizationApi
---
## PureCloud::AuthorizationApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**delete_roles_role_id**](AuthorizationApi.html#delete_roles_role_id) | **DELETE** /api/v2/authorization/roles/{roleId} | Delete an organization role.|
|[**delete_user_id_roles**](AuthorizationApi.html#delete_user_id_roles) | **DELETE** /api/v2/users/{userId}/roles | Removes all the roles from the user.|
|[**get_permissions**](AuthorizationApi.html#get_permissions) | **GET** /api/v2/authorization/permissions | Get all permissions.|
|[**get_products**](AuthorizationApi.html#get_products) | **GET** /api/v2/authorization/products | Get the list of enabled products|
|[**get_roles**](AuthorizationApi.html#get_roles) | **GET** /api/v2/authorization/roles | Retrieve a list of all roles defined for the organization|
|[**get_roles_leftrole_id_comparedefault_rightrole_id**](AuthorizationApi.html#get_roles_leftrole_id_comparedefault_rightrole_id) | **GET** /api/v2/authorization/roles/{leftRoleId}/comparedefault/{rightRoleId} | Get an org role to default role comparison comparison|
|[**get_roles_role_id**](AuthorizationApi.html#get_roles_role_id) | **GET** /api/v2/authorization/roles/{roleId} | Get a single organization role.|
|[**get_user_id_roles**](AuthorizationApi.html#get_user_id_roles) | **GET** /api/v2/users/{userId}/roles | Returns a listing of roles and permissions for a user.|
|[**patch_roles_role_id**](AuthorizationApi.html#patch_roles_role_id) | **PATCH** /api/v2/authorization/roles/{roleId} | Patch Organization Role for needsUpdate Field|
|[**post_roles**](AuthorizationApi.html#post_roles) | **POST** /api/v2/authorization/roles | Create an organization role.|
|[**post_roles_default**](AuthorizationApi.html#post_roles_default) | **POST** /api/v2/authorization/roles/default | Restores all default roles|
|[**post_roles_leftrole_id_comparedefault_rightrole_id**](AuthorizationApi.html#post_roles_leftrole_id_comparedefault_rightrole_id) | **POST** /api/v2/authorization/roles/{leftRoleId}/comparedefault/{rightRoleId} | Get an unsaved org role to default role comparison|
|[**put_roles_default**](AuthorizationApi.html#put_roles_default) | **PUT** /api/v2/authorization/roles/default | Restore specified default roles|
|[**put_roles_role_id**](AuthorizationApi.html#put_roles_role_id) | **PUT** /api/v2/authorization/roles/{roleId} | Update an organization role.|
|[**put_roles_role_id_users_add**](AuthorizationApi.html#put_roles_role_id_users_add) | **PUT** /api/v2/authorization/roles/{roleId}/users/add | Sets the users for the role|
|[**put_roles_role_id_users_remove**](AuthorizationApi.html#put_roles_role_id_users_remove) | **PUT** /api/v2/authorization/roles/{roleId}/users/remove | Removes the users from the role|
|[**put_user_id_roles**](AuthorizationApi.html#put_user_id_roles) | **PUT** /api/v2/users/{userId}/roles | Sets the user's roles|
{: class="table table-striped"}
## - delete_roles_role_id(role_id)
Delete an organization role.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
begin
#Delete an organization role.
api_instance.delete_roles_role_id(role_id)
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->delete_roles_role_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## - delete_user_id_roles(user_id)
Removes all the roles from the user.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::AuthorizationApi.new
user_id = "user_id_example" # String | User ID
begin
#Removes all the roles from the user.
api_instance.delete_user_id_roles(user_id)
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->delete_user_id_roles: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| User ID |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**PermissionCollectionEntityListing**](PermissionCollectionEntityListing.html) get_permissions(opts)
Get all permissions.
Retrieve a list of all permission defined in the system.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::AuthorizationApi.new
opts = {
page_size: 25, # Integer | Page size
page_number: 1 # Integer | Page number
}
begin
#Get all permissions.
result = api_instance.get_permissions(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_permissions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page_size** | **Integer**| Page size | [optional] [default to 25]
**page_number** | **Integer**| Page number | [optional] [default to 1]
{: class="table table-striped"}
### Return type
[**PermissionCollectionEntityListing**](PermissionCollectionEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationProductEntityListing**](OrganizationProductEntityListing.html) get_products
Get the list of enabled products
Gets the list of enabled products. Some example product names are: collaborateFree, collaboratePro, communicate, and engage.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::AuthorizationApi.new
begin
#Get the list of enabled products
result = api_instance.get_products
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_products: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**OrganizationProductEntityListing**](OrganizationProductEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html) get_roles(opts)
Retrieve a list of all roles defined for the organization
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::AuthorizationApi.new
opts = {
page_size: 25, # Integer | The total page size requested
page_number: 1, # Integer | The page number requested
sort_by: "sort_by_example", # String | variable name requested to sort by
expand: nil, # Array