Microsoft Cognitive Services Subscription Rai Policy API
The SubscriptionRaiPolicy API from Microsoft Cognitive Services — 1 operation(s) for subscriptionraipolicy.
The SubscriptionRaiPolicy API from Microsoft Cognitive Services — 1 operation(s) for subscriptionraipolicy.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/microsoft-cognitive-services:microsoft-cognitive-services-subscriptionraipolicy-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: CognitiveServicesManagementClient Subscription Rai Policy…
version: '2026-11-01'
description: Cognitive Services Management Client
x-typespec-generated:
- emitter: '@azure-tools/typespec-autorest'
servers:
- url: https://management.azure.com
security:
- azure_auth:
- user_impersonation
tags:
- name: SubscriptionRaiPolicy
paths:
/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/raiPolicy/{raiPolicyName}:
get:
operationId: SubscriptionRaiPolicy_Get
tags:
- SubscriptionRaiPolicy
description: Gets the specified Content Filters associated with the Subscription.
parameters:
- $ref: '#/components/parameters/ApiVersionParameter'
- $ref: '#/components/parameters/SubscriptionIdParameter'
- name: raiPolicyName
in: path
description: The name of the RaiPolicy associated with the Cognitive Services Account
required: true
schema:
type: string
pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
responses:
'200':
description: Azure operation completed successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/RaiPolicy'
default:
description: An unexpected error response.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
summary: Subscription rai policy get
x-summary-source: derived
put:
operationId: SubscriptionRaiPolicy_CreateOrUpdate
tags:
- SubscriptionRaiPolicy
description: Update the state of specified Content Filters associated with the subscription.
parameters:
- $ref: '#/components/parameters/ApiVersionParameter'
- $ref: '#/components/parameters/SubscriptionIdParameter'
- name: raiPolicyName
in: path
description: The name of the RaiPolicy associated with the Cognitive Services Account
required: true
schema:
type: string
pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
responses:
'200':
description: Resource 'RaiPolicy' update operation succeeded
content:
application/json:
schema:
$ref: '#/components/schemas/RaiPolicy'
'201':
description: Resource 'RaiPolicy' create operation succeeded
content:
application/json:
schema:
$ref: '#/components/schemas/RaiPolicy'
default:
description: An unexpected error response.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RaiPolicy'
description: Properties describing the Content Filters.
required: true
summary: Subscription rai policy create or update
x-summary-source: derived
delete:
operationId: SubscriptionRaiPolicy_Delete
tags:
- SubscriptionRaiPolicy
description: Deletes the specified Content Filters associated with the subscription.
parameters:
- $ref: '#/components/parameters/ApiVersionParameter'
- $ref: '#/components/parameters/SubscriptionIdParameter'
- name: raiPolicyName
in: path
description: The name of the RaiPolicy associated with the Cognitive Services Account
required: true
schema:
type: string
pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$
responses:
'202':
description: Resource deletion accepted.
headers:
Retry-After:
description: The Retry-After header can indicate how long the client should wait before polling the operation status.
schema:
type: integer
format: int32
location:
description: The Location header contains the URL where the status of the long running operation can be checked.
schema:
type: string
'204':
description: Resource does not exist.
default:
description: An unexpected error response.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
x-ms-long-running-operation-options:
final-state-via: location
x-ms-long-running-operation: true
summary: Subscription rai policy delete
x-summary-source: derived
components:
schemas:
systemData:
type: object
description: Metadata pertaining to creation and last modification of the resource.
properties:
createdBy:
type: string
description: The identity that created the resource.
createdByType:
type: string
description: The type of identity that created the resource.
enum:
- User
- Application
- ManagedIdentity
- Key
x-ms-enum:
name: createdByType
modelAsString: true
createdAt:
type: string
format: date-time
description: The timestamp of resource creation (UTC).
lastModifiedBy:
type: string
description: The identity that last modified the resource.
lastModifiedByType:
type: string
description: The type of identity that last modified the resource.
enum:
- User
- Application
- ManagedIdentity
- Key
x-ms-enum:
name: createdByType
modelAsString: true
lastModifiedAt:
type: string
format: date-time
description: The timestamp of resource last modification (UTC)
readOnly: true
RaiEgressDefaultAction:
type: string
description: The default action when no user-defined egress rules match.
enum:
- Allow
- Deny
x-ms-enum:
name: RaiEgressDefaultAction
modelAsString: true
values:
- name: Allow
value: Allow
description: Allow traffic by default when no rules match.
- name: Deny
value: Deny
description: Deny traffic by default when no rules match.
RaiEgressScheme:
type: string
description: URL scheme for rewrite targets. Only HTTP and HTTPS are supported.
enum:
- http
- https
x-ms-enum:
name: RaiEgressScheme
modelAsString: true
values:
- name: Http
value: http
description: HTTP scheme.
- name: Https
value: https
description: HTTPS scheme.
CustomBlocklistConfig:
type: object
description: Gets or sets the source to which filter applies.
properties:
source:
$ref: '#/components/schemas/RaiPolicyContentSource'
description: Content source to apply the Content Filters.
allOf:
- $ref: '#/components/schemas/RaiBlocklistConfig'
RaiPolicyContentSource:
type: string
description: Content source to apply the Content Filters.
enum:
- Prompt
- Completion
- PreToolCall
- PostToolCall
- PreRun
- PostRun
x-ms-enum:
name: RaiPolicyContentSource
modelAsString: true
values:
- name: Prompt
value: Prompt
- name: Completion
value: Completion
- name: PreToolCall
value: PreToolCall
- name: PostToolCall
value: PostToolCall
- name: PreRun
value: PreRun
- name: PostRun
value: PostRun
ProxyResource:
type: object
title: Proxy Resource
description: The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location
allOf:
- $ref: '#/components/schemas/Resource'
RaiEgressManagedIdentityRef:
type: object
description: A reference to a managed-identity token used as a header value.
properties:
resource:
type: string
description: The resource/audience the token is requested for.
format:
type: string
description: Optional format for the resolved token; "{value}" is the placeholder, e.g. "Bearer {value}".
required:
- resource
RaiEgressRuleMatch:
type: object
description: 'The match criteria for an egress rule.
If both host and path are omitted, the rule matches all traffic.
Host uses DNS wildcard syntax (e.g., "\*.openai.com" matches "api.openai.com").
Path uses URI prefix matching with an asterisk as a single-segment wildcard.
For example, "/v1/\*" matches "/v1/chat".'
properties:
host:
type: string
description: 'Host pattern to match using DNS wildcard syntax (e.g., "\*.openai.com").
A leading "\*." matches any subdomain. Omit to match all hosts.'
path:
type: string
description: 'Path pattern to match using URI prefix matching.
An asterisk serves as a single-segment wildcard.
For example, "/v1/\*" matches "/v1/chat". Omit to match all paths.'
ContentLevel:
type: string
description: Level at which content is filtered.
enum:
- Low
- Medium
- High
x-ms-enum:
name: ContentLevel
modelAsString: true
values:
- name: Low
value: Low
- name: Medium
value: Medium
- name: High
value: High
RaiPolicyMode:
type: string
description: 'Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use ''Asynchronous_filter'' after 2025-06-01. It is the same as ''Deferred'' in previous version.'
enum:
- Default
- Deferred
- Blocking
- Asynchronous_filter
x-ms-enum:
name: RaiPolicyMode
modelAsString: true
values:
- name: Default
value: Default
- name: Deferred
value: Deferred
- name: Blocking
value: Blocking
- name: Asynchronous_filter
value: Asynchronous_filter
RaiPolicy:
type: object
description: Cognitive Services RaiPolicy.
properties:
properties:
$ref: '#/components/schemas/RaiPolicyProperties'
description: Properties of Cognitive Services RaiPolicy.
etag:
type: string
description: Resource Etag.
readOnly: true
tags:
type: object
description: Resource tags.
additionalProperties:
type: string
x-ms-mutability:
- read
- update
- create
allOf:
- $ref: '#/components/schemas/ProxyResource'
RaiEgressHeaderTransform:
type: object
description: 'A header transformation applied to matched traffic.
For Set or Insert operations, exactly one of value or valueRef must be provided.
For Remove operations, neither value nor valueRef should be set.'
properties:
operation:
$ref: '#/components/schemas/RaiEgressHeaderOperation'
description: The operation to perform on this header.
name:
type: string
description: The HTTP header name (e.g., "Authorization", "X-Custom-Auth").
value:
type: string
format: password
description: 'A static header value. Write-only: accepted on create/update, never returned on read.
If omitted on update, the existing value is preserved. Use this for non-sensitive values;
for credentials, use valueRef instead.'
x-ms-mutability:
- update
- create
x-ms-secret: true
valueRef:
$ref: '#/components/schemas/RaiEgressHeaderValueRef'
description: A dynamic header value resolved at request time from a secret or managed identity.
required:
- operation
- name
RaiEgressHeaderOperation:
type: string
description: The operation to apply to a header in a Transform or Rewrite action.
enum:
- Set
- Insert
- Remove
x-ms-enum:
name: RaiEgressHeaderOperation
modelAsString: true
values:
- name: Set
value: Set
description: Set or overwrite the header value, creating it if it does not exist.
- name: Insert
value: Insert
description: Add the header only if it is not already present.
- name: Remove
value: Remove
description: Remove the header if present.
RaiEgressRule:
type: object
description: A single egress rule. Rules are evaluated in order; first match wins.
properties:
name:
type: string
description: Name of the rule. Must be unique within the policy.
description:
type: string
description: Description of the rule.
ruleType:
$ref: '#/components/schemas/RaiEgressRuleType'
description: The type of rule (e.g., Fqdn). Determines how match criteria are interpreted.
match:
$ref: '#/components/schemas/RaiEgressRuleMatch'
description: The match criteria for this rule.
action:
$ref: '#/components/schemas/RaiEgressRuleAction'
description: 'The action to take when this rule matches, including the action type and any
type-specific configuration (headers for Transform, rewrite target for Rewrite).'
required:
- name
- ruleType
- action
RaiSafetyProviderConfig:
type: object
description: Azure OpenAI RAI safety provider config.
properties:
safetyProviderName:
type: string
description: Name of RAI Safety Provider.
blocking:
type: boolean
description: If blocking would occur.
RaiPolicyContentFilter:
type: object
description: Azure OpenAI Content Filter.
properties:
name:
type: string
description: Name of ContentFilter.
enabled:
type: boolean
description: If the ContentFilter is enabled.
severityThreshold:
$ref: '#/components/schemas/ContentLevel'
description: Level at which content is filtered.
blocking:
type: boolean
description: If blocking would occur.
source:
$ref: '#/components/schemas/RaiPolicyContentSource'
description: Content source to apply the Content Filters.
action:
$ref: '#/components/schemas/RaiActionType'
description: The action types to apply to the content filters
RaiEgressMode:
type: string
description: 'The enforcement mode for egress rules.
If omitted on create, the server defaults to Enforced.'
enum:
- Enforced
- Audit
x-ms-enum:
name: RaiEgressMode
modelAsString: true
values:
- name: Enforced
value: Enforced
description: Rules are enforced. Matching traffic is allowed or denied per rule actions.
- name: Audit
value: Audit
description: 'Rules are evaluated and logged but not enforced. Traffic is always forwarded regardless of
rule action. A would-be Deny is logged but not applied. Transform and Rewrite actions are
still applied to matching traffic (only Deny enforcement is suppressed).'
RaiPolicyProperties:
type: object
description: Azure OpenAI Content Filters properties.
properties:
type:
$ref: '#/components/schemas/RaiPolicyType'
description: Content Filters policy type.
readOnly: true
mode:
$ref: '#/components/schemas/RaiPolicyMode'
description: 'Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use ''Asynchronous_filter'' after 2025-06-01. It is the same as ''Deferred'' in previous version.'
basePolicyName:
type: string
description: Name of Rai policy.
contentFilters:
type: array
description: The list of Content Filters.
items:
$ref: '#/components/schemas/RaiPolicyContentFilter'
x-ms-identifiers:
- name
customBlocklists:
type: array
description: The list of custom Blocklist.
items:
$ref: '#/components/schemas/CustomBlocklistConfig'
x-ms-identifiers: []
safetyProviders:
type: array
description: The list of Safety Providers.
items:
$ref: '#/components/schemas/SafetyProviderConfig'
x-ms-identifiers: []
egressPolicy:
$ref: '#/components/schemas/RaiEgressPolicyConfig'
description: 'Egress (outbound network) policy controlling which external endpoints sandboxed
agents can reach. Includes rules with Allow/Deny/Transform/Rewrite actions.'
RaiPolicyType:
type: string
description: Content Filters policy type.
enum:
- UserManaged
- SystemManaged
x-ms-enum:
name: RaiPolicyType
modelAsString: true
values:
- name: UserManaged
value: UserManaged
- name: SystemManaged
value: SystemManaged
RaiEgressRuleAction:
type: object
description: 'The action an egress rule takes when it matches.
- Allow/Deny: no additional fields needed; headers and rewrite must not be set.
- Transform: headers is required with at least one entry; rewrite must not be set.
- Rewrite: rewrite is required with at least one of scheme/host/path;
headers is optional for injecting headers alongside the redirect.'
properties:
actionType:
$ref: '#/components/schemas/RaiEgressRuleActionType'
description: The kind of action.
headers:
type: array
description: 'Header transforms to apply. Required for Transform; optional for Rewrite;
not allowed for Allow or Deny.'
items:
$ref: '#/components/schemas/RaiEgressHeaderTransform'
x-ms-identifiers:
- name
rewrite:
$ref: '#/components/schemas/RaiEgressRewriteTarget'
description: Destination override. Required for Rewrite; not allowed otherwise.
required:
- actionType
RaiEgressHeaderValueRef:
type: object
description: A dynamic source for a header value. Exactly one of secretRef or managedIdentityRef must be set.
properties:
secretRef:
$ref: '#/components/schemas/RaiEgressSecretRef'
description: Resolve the value from a stored secret.
managedIdentityRef:
$ref: '#/components/schemas/RaiEgressManagedIdentityRef'
description: Resolve the value from a managed-identity token.
RaiEgressRuleType:
type: string
description: The type of an egress rule, determining what kind of traffic matching it performs.
enum:
- Fqdn
x-ms-enum:
name: RaiEgressRuleType
modelAsString: true
values:
- name: Fqdn
value: Fqdn
description: Fully qualified domain name (FQDN) based rule matching on host and path patterns.
RaiBlocklistConfig:
type: object
description: Azure OpenAI blocklist config.
properties:
blocklistName:
type: string
description: Name of ContentFilter.
blocking:
type: boolean
description: If blocking would occur.
ErrorResponse:
type: object
title: Error response
description: Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).
properties:
error:
$ref: '#/components/schemas/ErrorDetail'
description: The error object.
RaiEgressRewriteTarget:
type: object
description: 'Where a Rewrite action sends matched traffic. At least one field must be set;
omitted fields retain the original request values. This constraint is enforced
by the server (400 Bad Request if all fields are omitted).'
properties:
scheme:
$ref: '#/components/schemas/RaiEgressScheme'
description: Target scheme. Original scheme is kept if omitted.
host:
type: string
description: Target host. Original host is kept if omitted.
path:
type: string
description: Target path (literal string). Original path (and query) is kept if omitted.
Resource:
type: object
title: Resource
description: Common fields that are returned in the response for all Azure Resource Manager resources
properties:
id:
type: string
description: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
readOnly: true
name:
type: string
description: The name of the resource
readOnly: true
type:
type: string
description: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
readOnly: true
systemData:
$ref: '#/components/schemas/systemData'
type: object
description: Azure Resource Manager metadata containing createdBy and modifiedBy information.
readOnly: true
x-ms-azure-resource: true
RaiEgressPolicyConfig:
type: object
description: 'Egress (outbound network) policy configuration nested within an RAI policy.
Controls which external endpoints sandboxed agents can reach and what
transformations (header injection, URL rewrite) are applied to matching traffic.'
properties:
mode:
$ref: '#/components/schemas/RaiEgressMode'
description: 'The enforcement mode for egress rules.
If omitted on create, the server defaults to Enforced. On subsequent GET
requests, the server always returns the effective mode.'
defaultAction:
$ref: '#/components/schemas/RaiEgressDefaultAction'
description: 'The default action when no user-defined rules match.
Deny blocks unmatched traffic; Allow permits it. Transform and Rewrite rules
are always applied to their matched traffic regardless of this setting —
defaultAction only governs traffic that does not match any rule.
If omitted on create, the server defaults to Deny (fail-closed). On subsequent
GET requests, the server always returns the effective value.'
description:
type: string
description: Description of the egress policy.
rules:
type: array
description: 'Ordered list of egress rules. First matching rule wins.
Rules are evaluated in declaration order; the first rule whose match criteria
are satisfied determines the action taken on the request.'
items:
$ref: '#/components/schemas/RaiEgressRule'
x-ms-identifiers:
- name
SafetyProviderConfig:
type: object
description: Gets or sets the source to which safety providers applies.
properties:
source:
$ref: '#/components/schemas/RaiPolicyContentSource'
description: Content source to apply the Content Filters.
allOf:
- $ref: '#/components/schemas/RaiSafetyProviderConfig'
RaiEgressRuleActionType:
type: string
description: The kind of action an egress rule takes when it matches.
enum:
- Allow
- Deny
- Transform
- Rewrite
x-ms-enum:
name: RaiEgressRuleActionType
modelAsString: true
values:
- name: Allow
value: Allow
description: Allow the matched traffic.
- name: Deny
value: Deny
description: Deny the matched traffic.
- name: Transform
value: Transform
description: Forward the matched traffic after applying header transforms. Requires at least one header.
- name: Rewrite
value: Rewrite
description: Redirect the matched traffic to a new destination, optionally applying header transforms. Requires a rewrite target.
RaiActionType:
type: string
description: The action types to apply to the content filters
enum:
- None
- BLOCKING
- ANNOTATING
- HITL
- RETRY
x-ms-enum:
name: RaiActionType
modelAsString: true
values:
- name: None
value: None
- name: BLOCKING
value: BLOCKING
- name: ANNOTATING
value: ANNOTATING
- name: HITL
value: HITL
- name: RETRY
value: RETRY
RaiEgressSecretRef:
type: object
description: A reference to a stored secret used as a header value.
properties:
secretId:
type: string
description: Identifier of the secret to inject.
secretKey:
type: string
format: password
description: Optional key within the secret.
x-ms-secret: true
format:
type: string
description: Optional format for the resolved value; "{value}" is the placeholder, e.g. "Bearer {value}".
required:
- secretId
parameters:
ApiVersionParameter:
name: api-version
in: query
description: The API version to use for this operation.
required: true
schema:
type: string
minLength: 1
SubscriptionIdParameter:
name: subscriptionId
in: path
description: The ID of the target subscription.
required: true
schema:
type: string
minLength: 1
securitySchemes:
azure_auth:
type: oauth2
flows:
implicit:
scopes:
user_impersonation: impersonate your user account
authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
description: Azure Active Directory OAuth2 Flow.