Skip to main content
Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

Policy management API

Download OpenAPI (YAML)Version v1

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
ScopeDescription
readinternal_policy_mgt_view
writeinternal_policy_mgt_create
updateinternal_policy_mgt_update
deleteinternal_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

NameInTypeRequiredDescription
typequerystringYes

Type of the policies to list, for example DEVICE.

limitqueryinteger

Maximum number of records to return.

Default: 30

offsetqueryinteger

Number of records to skip for pagination.

Default: 0

filterquerystring

Filter policies whose name contains the given value (case-insensitive). If omitted, all policies of the type are returned.

Responses

CodeDescriptionSchema
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
NameTypeRequiredDescription
namestringYes

The name of the policy.

typestringYes

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.

resourcesarray of PolicyResourceRequestYes

Resources attached to the policy. Each target may have at most one resource of each type.

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
typequerystringYes

Policy type, for example DEVICE.

targetquerystringYes

Resource target, for example a device platform such as android.

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
policy-idpathstringYes

ID of the policy

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
policy-idpathstringYes

ID of the policy

Request body (required): application/json

Schema: PolicyUpdateRequest

1 property
NameTypeRequiredDescription
resourcesarray of PolicyResourceRequestYes

Resources attached to the policy. Each target may have at most one resource of each type.

Responses

CodeDescriptionSchema
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

NameInTypeRequiredDescription
policy-idpathstringYes

ID of the policy

Responses

CodeDescriptionSchema
204

Successfully Deleted

400

Bad Request

Error
401

Unauthorized

403

Forbidden

500

Server Error

Error

Schemas​

PolicyRequest​

Type: object

3 properties
NameTypeRequiredDescription
namestringYes

The name of the policy.

typestringYes

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.

resourcesarray of PolicyResourceRequestYes

Resources attached to the policy. Each target may have at most one resource of each type.

PolicyUpdateRequest​

Type: object

1 property
NameTypeRequiredDescription
resourcesarray of PolicyResourceRequestYes

Resources attached to the policy. Each target may have at most one resource of each type.

PolicyResourceRequest​

Type: object

3 properties
NameTypeRequiredDescription
targetstringYes

The selector value this resource applies to (e.g. platform - android, ios, macos, windows).

resourceTypestringYes

The type of resource. Only RULE is currently supported.

Allowed values: RULE, ACTION

ruleRuleRequestYes

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
NameTypeRequiredDescription
conditionstring

The logical operator combining the sub-rules. Always "OR".

Allowed values: OR

rulesarray of ANDRuleRequestYes

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
NameTypeRequiredDescription
conditionstringYes

The logical operator combining the expressions. Always "AND".

Allowed values: AND

expressionsarray of ExpressionRequestYes

The list of expressions combined with AND.

ExpressionRequest​

Type: object

3 properties
NameTypeRequiredDescription
fieldstringYes

The field to evaluate.

operatorstringYes

The operator to apply.

valuestringYes

The value to compare against.

PolicyListResponse​

Type: object

5 properties
NameTypeRequiredDescription
totalResultsinteger

Number of results that match the listing operation.

startIndexinteger

Index of the first element of the page, which will be equal to offset + 1.

countinteger

Number of elements in the returned page.

policiesarray of PolicyListItem

Page of policy summaries.

linksarray of PolicyListLink

Pagination links (next/previous).

PolicyListItem​

Type: object

4 properties
NameTypeRequiredDescription
idstring

The policy resource ID.

namestring

The name of the policy.

typestring

The type of the policy.

selfstring

Location of the policy resource.

Type: object

2 properties
NameTypeRequiredDescription
hrefstring

Relative URL to the linked page.

relstring

Relation to the current page.

PolicyResponse​

Type: object

4 properties
NameTypeRequiredDescription
idstringYes

The policy resource ID.

namestringYes

The name of the policy.

typestringYes

The type of the policy.

resourcesarray of PolicyResourceResponse

Resources associated with the policy.

PolicyResourceResponse​

Type: object

3 properties
NameTypeRequiredDescription
targetstring

The selector value this resource applies to (e.g. device platform).

resourceTypestring

The type of resource.

Allowed values: RULE, ACTION

ruleRuleResponse

RuleResponse​

Type: object

1 property
NameTypeRequiredDescription
rulesarray of ANDRuleResponse

List of AND-combined expression groups, OR'd together.

ANDRuleResponse​

Type: object

1 property
NameTypeRequiredDescription
expressionsarray of ExpressionResponse

Expressions combined with AND logic.

ExpressionResponse​

Type: object

3 properties
NameTypeRequiredDescription
fieldstring

The field to evaluate.

operatorstring

The operator to apply.

valueExpressionValue

ExpressionValue​

Type: object

2 properties
NameTypeRequiredDescription
typestring

The value type.

Allowed values: STRING, NUMBER, BOOLEAN, DATE_TIME, REFERENCE, RAW

valuestring

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
NameTypeRequiredDescription
fieldRuleField
operatorsarray of RuleOperator

Operators that can be applied to the field in rule expressions.

valueRuleFieldValue

RuleField​

Type: object

2 properties
NameTypeRequiredDescription
namestring

Name of the field, used in rule expressions.

displayNamestring

User friendly label of the field.

RuleOperator​

Type: object

2 properties
NameTypeRequiredDescription
namestring

Name of the operator, used in rule expressions.

displayNamestring

User friendly label of the operator.

RuleFieldValue​

Type: object

6 properties
NameTypeRequiredDescription
inputTypestring

Whether the value is entered directly or selected from options.

Allowed values: input, options

valueTypestring

Data type of the value.

Allowed values: string, number, boolean, date, reference

valueReferenceAttributestring

Attribute of the options data used as the value. Only available when 'valueType' is 'reference'.

valueDisplayAttributestring

Attribute of the options data shown as the label. Only available when 'valueType' is 'reference'.

linksarray of RuleFieldValueLink

Endpoints to retrieve or search for options. Only available when 'valueType' is 'reference'.

valuesarray of RuleFieldValueOption

Selectable values of an options field.

RuleFieldValueOption​

Type: object

2 properties
NameTypeRequiredDescription
namestring

Value used in rule expressions.

displayNamestring

User friendly label of the value.

Type: object

3 properties
NameTypeRequiredDescription
hrefstring

URL of the endpoint.

methodstring

HTTP method.

Allowed values: GET

relstring

Relation of the endpoint to retrieving or filtering the values.

Allowed values: values, filter

Error​

Type: object

4 properties
NameTypeRequiredDescription
codestring
messagestring
descriptionstring
traceIdstring

Was this page helpful?