Skip to content

Replace a policy

Request

Replaces an existing policy configuration for an application

This operation is a full replace, not a partial update. The request body must include every required field (name, resourcePath, and rule). Any other optional field that you omit is reset to its default.

Path
applicationIdstring, (uuid)required

Identifier of the application

policyIdstring, (uuid)required

Identifier of the policy

Bodyapplication/jsonrequired
activeboolean

Policy status

Default:true
caseSensitiveboolean

Indicates whether the policy resource is case sensitive

Default:true
customDirectivestring, (multi-line string)

Custom NGINX directives that handle special requirements not covered by the policy type. There is no limit to the number of directives you can add, but each directive must be on its own line.

descriptionstring

Policy description

namestringrequired

Policy name

regexRulestring

Regular expression (regex) that can control authorization for the given resource

resourcePathstringrequired

The path to the resource that the policy manages

rulestringrequired

Policy type

Enum ValueDescription
NO_AUTH

The resource is not protected by any policy

PROTECTED

This policy requires a valid session (authenticated user) to access the associated resource

PROTECTED_REGEX

This policy requires a valid session and an expression that determines who can access the resource

ADAPTIVE

This policy extends the Not Protected policy, but passes header information to the underlying app

CUSTOM

This policy extends the Protected Rule policy, but supports entering a regular expression as the URI

curl -i -X PUT \
  'https://oag.domain.tld/api/v2/apps/{applicationId}/policies/{policyId}' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "root",
    "description": "Protect all application resources",
    "resourcePath": "/",
    "rule": "PROTECTED"
  }'

Responses

policy updated successfully

Bodyapplication/json
activeboolean

Policy status

Default:true
caseSensitiveboolean

Indicates whether the policy resource is case sensitive

Default:true
customDirectivestring, (multi-line string)

Custom NGINX directives that handle special requirements not covered by the policy type. There is no limit to the number of directives you can add, but each directive must be on its own line.

descriptionstring

Policy description

idstring, (uuid)read-only

Unique identifier of the policy

namestring

Policy name

regexRulestring

Regular expression (regex) that can control authorization for the given resource

resourcePathstring

The path to the resource that the policy manages

rulestring

Policy type

Enum ValueDescription
NO_AUTH

The resource is not protected by any policy

PROTECTED

This policy requires a valid session (authenticated user) to access the associated resource

PROTECTED_REGEX

This policy requires a valid session and an expression that determines who can access the resource

ADAPTIVE

This policy extends the Not Protected policy, but passes header information to the underlying app

CUSTOM

This policy extends the Protected Rule policy, but supports entering a regular expression as the URI

Response
{ "id": "9ef3103a-50a7-4517-92d6-442612b6d5c1", "name": "root", "description": "Protect all application resources", "resourcePath": "/", "active": true, "rule": "PROTECTED", "regexRule": null, "caseSensitive": true, "customDirective": null }