Okta.Sdk.Api.RoleAssignmentClientApi
January 26, 2026 ยท View on GitHub
All URIs are relative to https://subdomain.okta.com
| Method | HTTP request | Description |
|---|---|---|
| AssignRoleToClient | POST /oauth2/v1/clients/{clientId}/roles | Assign a client role |
| DeleteRoleFromClient | DELETE /oauth2/v1/clients/{clientId}/roles/{roleAssignmentId} | Unassign a client role |
| ListRolesForClient | GET /oauth2/v1/clients/{clientId}/roles | List all client role assignments |
| RetrieveClientRole | GET /oauth2/v1/clients/{clientId}/roles/{roleAssignmentId} | Retrieve a client role |
AssignRoleToClient
ListGroupAssignedRoles200ResponseInner AssignRoleToClient (string clientId, AssignRoleToGroupRequest assignRoleToGroupRequest)
Assign a client role
Assigns a standard role to a client app. You can also assign a custom role to a client app, but the preferred method to assign a custom role to a client is to create a binding between the custom role, the resource set, and the client app. See Create a role resource set binding. > Notes: > * The request payload is different for standard and custom role assignments. > * For IAM-based standard role assignments, use the request payload for standard roles. However, the response payload for IAM-based role assignments is similar to the custom role's assignment response.
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class AssignRoleToClientExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleAssignmentClientApi(config);
var clientId = 52Uy4BUWVBOjFItcg2jWsmnd83Ad8dD; // string | Client app ID
var assignRoleToGroupRequest = new AssignRoleToGroupRequest(); // AssignRoleToGroupRequest |
try
{
// Assign a client role
ListGroupAssignedRoles200ResponseInner result = apiInstance.AssignRoleToClient(clientId, assignRoleToGroupRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleAssignmentClientApi.AssignRoleToClient: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| clientId | string | Client app ID | |
| assignRoleToGroupRequest | AssignRoleToGroupRequest |
Return type
ListGroupAssignedRoles200ResponseInner
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteRoleFromClient
void DeleteRoleFromClient (string clientId, string roleAssignmentId)
Unassign a client role
Unassigns a role assignment (identified by roleAssignmentId) from a client app (identified by clientId)
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class DeleteRoleFromClientExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleAssignmentClientApi(config);
var clientId = 52Uy4BUWVBOjFItcg2jWsmnd83Ad8dD; // string | Client app ID
var roleAssignmentId = JBCUYUC7IRCVGS27IFCE2SKO; // string | The `id` of the role assignment
try
{
// Unassign a client role
apiInstance.DeleteRoleFromClient(clientId, roleAssignmentId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleAssignmentClientApi.DeleteRoleFromClient: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| clientId | string | Client app ID | |
| roleAssignmentId | string | The `id` of the role assignment |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 204 | No Content | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListRolesForClient
List<ListGroupAssignedRoles200ResponseInner> ListRolesForClient (string clientId)
List all client role assignments
Lists all roles assigned to a client app identified by clientId
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class ListRolesForClientExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleAssignmentClientApi(config);
var clientId = 52Uy4BUWVBOjFItcg2jWsmnd83Ad8dD; // string | Client app ID
try
{
// List all client role assignments
List<ListGroupAssignedRoles200ResponseInner> result = apiInstance.ListRolesForClient(clientId).ToListAsync();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleAssignmentClientApi.ListRolesForClient: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| clientId | string | Client app ID |
Return type
List<ListGroupAssignedRoles200ResponseInner>
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RetrieveClientRole
ListGroupAssignedRoles200ResponseInner RetrieveClientRole (string clientId, string roleAssignmentId)
Retrieve a client role
Retrieves a role assignment (identified by roleAssignmentId) for a client app (identified by clientId)
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class RetrieveClientRoleExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleAssignmentClientApi(config);
var clientId = 52Uy4BUWVBOjFItcg2jWsmnd83Ad8dD; // string | Client app ID
var roleAssignmentId = JBCUYUC7IRCVGS27IFCE2SKO; // string | The `id` of the role assignment
try
{
// Retrieve a client role
ListGroupAssignedRoles200ResponseInner result = apiInstance.RetrieveClientRole(clientId, roleAssignmentId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleAssignmentClientApi.RetrieveClientRole: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| clientId | string | Client app ID | |
| roleAssignmentId | string | The `id` of the role assignment |
Return type
ListGroupAssignedRoles200ResponseInner
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]