Policy management API
Base URL: https://api.asgardeo.io/t/<ORGANIZATION_NAME>/api/server/v1
The WSO2 Identity Platform - Policy API Definition (version v1).
Download the OpenAPI definition (YAML)
Security schemes
OAuth2: oauth2
authorizationCode flow, token URL https://api.asgardeo.io/t/{org-name}/oauth2/token, authorization URL https://api.asgardeo.io/t/{org-name}/oauth2/authorize
4 scopes
| Scope | Description |
|---|---|
read | internal_policy_mgt_view |
write | internal_policy_mgt_create |
update | internal_policy_mgt_update |
delete | internal_policy_mgt_delete |
Policy Management
List policies.
GET /policies
This API provides the capability to retrieve a paginated list of policies of a given type for the organization, optionally filtered by name.
Scope (Permission) required: internal_policy_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | query | string | Yes | Type of the policies to list, for example DEVICE. |
limit | query | integer | Maximum number of records to return. Default: | |
offset | query | integer | Number of records to skip for pagination. Default: | |
filter | query | string | Filter policies whose name contains the given value (case-insensitive). If omitted, all policies of the type are returned. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Successful Response | PolicyListResponse |
400 | Bad Request | Error |
401 | Unauthorized | |
403 | Forbidden | |
500 | Server Error | Error |
Create a policy.
POST /policies
This API provides the capability to create a new policy.
Scope (Permission) required: internal_policy_mgt_create
Request body (required): application/json
Schema: PolicyRequest
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the policy. |
type | string | Yes | The type of the policy, for example DEVICE. Policy names are unique within a type. The type cannot be changed after the policy is created. |
resources | array of PolicyResourceRequest | Yes | Resources attached to the policy. Each target may have at most one resource of each type. |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Successfully Created | PolicyResponse |
400 | Bad Request | Error |
401 | Unauthorized | |
403 | Forbidden | |
409 | Conflict | Error |
500 | Server Error | Error |
Get rule metadata for a policy type.
GET /policies/metadata/rule
This API provides the fields, operators and values that rule resources of a policy type can use for a target. For device policies, the target is the device platform, and only the fields that apply to that platform are returned.
Scope (Permission) required: internal_policy_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type | query | string | Yes | Policy type, for example DEVICE. |
target | query | string | Yes | Resource target, for example a device platform such as android. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Successful Response | RuleMetadata |
400 | Bad Request | Error |
401 | Unauthorized | |
403 | Forbidden | |
500 | Server Error | Error |
Get a policy by ID.
GET /policies/{policy-id}
This API provides the capability to retrieve a policy by ID.
Scope (Permission) required: internal_policy_mgt_view
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
policy-id | path | string | Yes | ID of the policy |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Successful Response | PolicyResponse |
400 | Bad Request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | Not Found | Error |
500 | Server Error | Error |
Update a policy.
PUT /policies/{policy-id}
This API provides the capability to update an existing policy.
Scope (Permission) required: internal_policy_mgt_update
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
policy-id | path | string | Yes | ID of the policy |
Request body (required): application/json
Schema: PolicyUpdateRequest
1 property
| Name | Type | Required | Description |
|---|---|---|---|
resources | array of PolicyResourceRequest | Yes | Resources attached to the policy. Each target may have at most one resource of each type. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Successful Response | PolicyResponse |
400 | Bad Request | Error |
401 | Unauthorized | |
403 | Forbidden | |
404 | Not Found | Error |
500 | Server Error | Error |
Delete a policy.
DEL /policies/{policy-id}
This API provides the capability to delete a policy by ID.
Scope (Permission) required: internal_policy_mgt_delete
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
policy-id | path | string | Yes | ID of the policy |
Responses
| Code | Description | Schema |
|---|---|---|
204 | Successfully Deleted | |
400 | Bad Request | Error |
401 | Unauthorized | |
403 | Forbidden | |
500 | Server Error | Error |
Schemas
PolicyRequest
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the policy. |
type | string | Yes | The type of the policy, for example DEVICE. Policy names are unique within a type. The type cannot be changed after the policy is created. |
resources | array of PolicyResourceRequest | Yes | Resources attached to the policy. Each target may have at most one resource of each type. |
PolicyUpdateRequest
Type: object
1 property
| Name | Type | Required | Description |
|---|---|---|---|
resources | array of PolicyResourceRequest | Yes | Resources attached to the policy. Each target may have at most one resource of each type. |
PolicyResourceRequest
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
target | string | Yes | The selector value this resource applies to (e.g. platform - android, ios, macos, windows). |
resourceType | string | Yes | The type of resource. Only RULE is currently supported. Allowed values: |
rule | RuleRequest | Yes | A rule that combines one or more AND-grouped sub-rules with an OR condition; the rule is satisfied when any sub-rule is satisfied. |
RuleRequest
Type: object
A rule that combines one or more AND-grouped sub-rules with an OR condition; the rule is satisfied when any sub-rule is satisfied.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
condition | string | The logical operator combining the sub-rules. Always "OR". Allowed values: | |
rules | array of ANDRuleRequest | Yes | The AND-grouped sub-rules combined with OR. |
ANDRuleRequest
Type: object
A sub-rule that combines expressions with an AND condition; satisfied only when all of its expressions evaluate to true.
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
condition | string | Yes | The logical operator combining the expressions. Always "AND". Allowed values: |
expressions | array of ExpressionRequest | Yes | The list of expressions combined with AND. |
ExpressionRequest
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
field | string | Yes | The field to evaluate. |
operator | string | Yes | The operator to apply. |
value | string | Yes | The value to compare against. |
PolicyListResponse
Type: object
5 properties
| Name | Type | Required | Description |
|---|---|---|---|
totalResults | integer | Number of results that match the listing operation. | |
startIndex | integer | Index of the first element of the page, which will be equal to offset + 1. | |
count | integer | Number of elements in the returned page. | |
policies | array of PolicyListItem | Page of policy summaries. | |
links | array of PolicyListLink | Pagination links (next/previous). |
PolicyListItem
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | The policy resource ID. | |
name | string | The name of the policy. | |
type | string | The type of the policy. | |
self | string | Location of the policy resource. |
PolicyListLink
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
href | string | Relative URL to the linked page. | |
rel | string | Relation to the current page. |
PolicyResponse
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The policy resource ID. |
name | string | Yes | The name of the policy. |
type | string | Yes | The type of the policy. |
resources | array of PolicyResourceResponse | Resources associated with the policy. |
PolicyResourceResponse
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
target | string | The selector value this resource applies to (e.g. device platform). | |
resourceType | string | The type of resource. Allowed values: | |
rule | RuleResponse |
RuleResponse
Type: object
1 property
| Name | Type | Required | Description |
|---|---|---|---|
rules | array of ANDRuleResponse | List of AND-combined expression groups, OR'd together. |
ANDRuleResponse
Type: object
1 property
| Name | Type | Required | Description |
|---|---|---|---|
expressions | array of ExpressionResponse | Expressions combined with AND logic. |
ExpressionResponse
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
field | string | The field to evaluate. | |
operator | string | The operator to apply. | |
value | ExpressionValue |
ExpressionValue
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
type | string | The value type. Allowed values: | |
value | string | The value to compare against. |
RuleMetadata
Type: array of RuleFieldMetadata
Fields that rule resources of a policy type can use for a target.
RuleFieldMetadata
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
field | RuleField | ||
operators | array of RuleOperator | Operators that can be applied to the field in rule expressions. | |
value | RuleFieldValue |
RuleField
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Name of the field, used in rule expressions. | |
displayName | string | User friendly label of the field. |
RuleOperator
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Name of the operator, used in rule expressions. | |
displayName | string | User friendly label of the operator. |
RuleFieldValue
Type: object
6 properties
| Name | Type | Required | Description |
|---|---|---|---|
inputType | string | Whether the value is entered directly or selected from options. Allowed values: | |
valueType | string | Data type of the value. Allowed values: | |
valueReferenceAttribute | string | Attribute of the options data used as the value. Only available when 'valueType' is 'reference'. | |
valueDisplayAttribute | string | Attribute of the options data shown as the label. Only available when 'valueType' is 'reference'. | |
links | array of RuleFieldValueLink | Endpoints to retrieve or search for options. Only available when 'valueType' is 'reference'. | |
values | array of RuleFieldValueOption | Selectable values of an options field. |
RuleFieldValueOption
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Value used in rule expressions. | |
displayName | string | User friendly label of the value. |
RuleFieldValueLink
Type: object
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
href | string | URL of the endpoint. | |
method | string | HTTP method. Allowed values: | |
rel | string | Relation of the endpoint to retrieving or filtering the values. Allowed values: |
Error
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | ||
message | string | ||
description | string | ||
traceId | string |
Was this page helpful?