---
title: "Create a workspace-wide policy"
method: POST
path: "/guardrails/policies/account"
tags: ["Guardrail Policies"]
---

# Create a workspace-wide policy

`POST /guardrails/policies/account`

## Request

- Base URL: `https://openrouter.ai/api/v1`
- URL: `https://openrouter.ai/api/v1/guardrails/policies/account`
- Auth: HTTP bearer

Create a workspace-wide budget, moderation, or model availability policy. [Management key](/docs/guides/overview/auth/management-api-keys) required.

## Request body

- union
  - BudgetAccountGuardrailPolicyRequest
    - `config` GuardrailBudgetPolicyAuthoringConfig, required
      - `include_byok_in_budgets` boolean, required
      - `limit_usd` number, nullable, required
      - `reset_interval` 'daily' | 'weekly' | 'monthly' | 'null', nullable, required
    - `floor_reassignment` object: Move workspaces off this policy onto another workspace-wide policy in the same write
      - `policy_id` string, uuid, required: Policy ID
      - `workspace_ids` string[], required
    - `is_default` boolean: Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.
    - `keep_previous_default_workspaces` boolean: Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.
    - `name` string, required: Policy name
    - `opted_out_workspace_ids` string[]: Workspaces left out of a default policy
    - `policy_type` 'budget', required
    - `released_floor_workspace_ids` string[]: Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default
    - `workspace_ids` string[]: Workspaces the policy covers when it is not the default
  - ModerationAccountGuardrailPolicyRequest
    - `config` GuardrailModerationPolicyConfig, required
      - `armor` object, nullable
        - `classifier_context` ArmorContext: The Armor context: Claude Code's `classifier_context` (v1), with `auto_mode.{hard_deny,soft_deny,allow}` rules as strings or `{ id, instructions, threshold? }` objects and `auto_mode.environment` entries as `"Name: value"` strings or `{ name, value }` objects. `threshold` applies when Armor evaluates; when the provider evaluates natively (Anthropic dangerous-tool-use beta) rules are judged at the provider's own boundary.
          - `auto_mode` ArmorAutoMode
            - `allow` union[]
              - …
            - `environment` union[]
              - …
            - `hard_deny` union[]
              - …
            - `soft_deny` union[]
              - …
          - `v` 1, required
        - `mode` 'enforce' | 'audit': `enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.
        - `on_error` 'log' | 'block': When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.
        - `use_cc_style_default_rules` boolean: Prepend Claude Code's built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere.
      - `broadcast_model_armor_flagged_requests` boolean, nullable
      - `content_filter_blocks_requests` boolean
      - `content_filter_builtins` object[], nullable
        - `action` 'redact' | 'block' | 'flag', required
        - `label` string
        - `scan_scope` 'user_only' | 'all_messages'
        - `slug` 'email' | 'phone' | 'ssn' | 'credit-card' | 'ip-address' | 'secrets' | 'person-name' | 'address' | 'regex-prompt-injection', required
      - `content_filter_patterns` string[], nullable
      - `content_filters` object[], nullable
        - `action` 'redact' | 'block' | 'flag', required
        - `label` string, nullable
        - `pattern` string, required
      - `enable_model_armor_injection_protection` boolean, nullable
      - `lakera_injection_protection_mode` 'block' | 'flag' | 'null', nullable
      - `model_armor_injection_confidence_level` 'low' | 'medium' | 'high'
      - `model_armor_injection_protection_mode` 'block' | 'flag' | 'null', nullable
      - `pii_filters` object[], nullable
        - `action` 'redact' | 'block' | 'flag', required
        - `entity_type` string, required
        - `score_threshold` number
      - `platform_image_moderated_providers` string[], nullable
      - `platform_moderated_providers` string[], nullable
    - `floor_reassignment` object: Move workspaces off this policy onto another workspace-wide policy in the same write
      - `policy_id` string, uuid, required: Policy ID
      - `workspace_ids` string[], required
    - `is_default` boolean: Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.
    - `keep_previous_default_workspaces` boolean: Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.
    - `name` string, required: Policy name
    - `opted_out_workspace_ids` string[]: Workspaces left out of a default policy
    - `policy_type` 'moderation', required
    - `released_floor_workspace_ids` string[]: Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default
    - `workspace_ids` string[]: Workspaces the policy covers when it is not the default
  - ModelAvailabilityAccountGuardrailPolicyRequest
    - `config` GuardrailModelAvailabilityPolicyAuthoringConfig, required
      - `allow_provisional_providers` boolean, nullable
      - `allow_safety_retention_google` boolean, nullable
      - `allow_safety_retention_openai` boolean, nullable
      - `allow_safety_retention_other` boolean, nullable
      - `allowed_data_regions` string[], nullable
      - `allowed_models` string[], nullable
      - `allowed_providers` string[], nullable
      - `enable_free_model_publication` boolean, nullable
      - `enable_free_model_training` boolean, nullable
      - `enable_paid_model_training` boolean, nullable
      - `enforce_first_party_harness_models` boolean, nullable
      - `enforce_zdr` boolean, nullable
      - `enforce_zdr_anthropic` boolean, nullable
      - `enforce_zdr_google` boolean, nullable
      - `enforce_zdr_openai` boolean, nullable
      - `enforce_zdr_other` boolean, nullable
      - `enforce_zdr_xai` boolean, nullable
      - `ignored_models` string[], nullable
      - `ignored_providers` string[], nullable
      - `platform_banned_authors` string[], nullable
      - `platform_banned_models` string[], nullable
      - `platform_banned_providers` string[], nullable
      - `require_eu_data_region` boolean, nullable
    - `floor_reassignment` object: Move workspaces off this policy onto another workspace-wide policy in the same write
      - `policy_id` string, uuid, required: Policy ID
      - `workspace_ids` string[], required
    - `is_default` boolean: Cover every workspace in the account except `opted_out_workspace_ids`. On update, `false` on the current default unsets it.
    - `keep_previous_default_workspaces` boolean: Keep workspaces that inherited the replaced default on that policy. Cannot be combined with `released_floor_workspace_ids`.
    - `name` string, required: Policy name
    - `opted_out_workspace_ids` string[]: Workspaces left out of a default policy
    - `policy_type` 'model_availability', required
    - `released_floor_workspace_ids` string[]: Workspaces whose own workspace-wide policy of this type is dropped so they inherit this default
    - `workspace_ids` string[]: Workspaces the policy covers when it is not the default

## Response `201`

Workspace-wide policy created

- AccountGuardrailPolicyResponse
  - `data` union, required
    - BudgetAccountGuardrailPolicy
      - `config` GuardrailBudgetPolicyConfig, required
        - `include_byok_in_budgets` boolean: Whether BYOK (bring-your-own-key) inference spend counts toward this guardrail's limit_usd, in addition to OpenRouter credit spend. Defaults to false.
        - `limit_usd` number, double, nullable: Spending limit in USD. Must be provided together with `reset_interval`: a request that sets only one of the two is rejected with a 400.
        - `reset_interval` 'daily' | 'weekly' | 'monthly' | 'null', nullable: Interval at which the limit resets (daily, weekly, monthly)
      - `created_at` string, required
      - `id` string, uuid, required: Policy ID
      - `is_default` boolean, required
      - `is_synced` boolean, required: Kept in sync with a v1 guardrail; saving changes creates an account copy
      - `is_workspace_default_synced` boolean, required: Synced from a v1 workspace default guardrail
      - `name` string, required: Policy name
      - `opted_out_workspace_ids` string[], required
      - `policy_type` 'budget', required
      - `updated_at` string, nullable, required
      - `workspace_count` integer, required
      - `workspace_ids` string[], required
    - ModerationAccountGuardrailPolicy
      - `config` GuardrailModerationPolicyConfig, required
        - `armor` object, nullable
          - `classifier_context` ArmorContext: The Armor context: Claude Code's `classifier_context` (v1), with `auto_mode.{hard_deny,soft_deny,allow}` rules as strings or `{ id, instructions, threshold? }` objects and `auto_mode.environment` entries as `"Name: value"` strings or `{ name, value }` objects. `threshold` applies when Armor evaluates; when the provider evaluates natively (Anthropic dangerous-tool-use beta) rules are judged at the provider's own boundary.
            - `auto_mode` ArmorAutoMode
              - …
            - `v` 1, required
          - `mode` 'enforce' | 'audit': `enforce` withholds blocked calls; `audit` evaluates and reports the same verdicts without withholding any calls, regardless of `on_error`. Default `enforce`.
          - `on_error` 'log' | 'block': When the classifier cannot answer (timeout, upstream error, context too long) the call is reported `unavailable`; `block` rejects it and `log` releases it. Default `block`.
          - `use_cc_style_default_rules` boolean: Prepend Claude Code's built-in auto-mode rule set (1 hard-deny, 72 soft-deny, 17 allow, 21 environment slots) ahead of every configured rule. Defaults to true on the Anthropic Messages API and false elsewhere.
        - `broadcast_model_armor_flagged_requests` boolean, nullable
        - `content_filter_blocks_requests` boolean
        - `content_filter_builtins` object[], nullable
          - `action` 'redact' | 'block' | 'flag', required
          - `label` string
          - `scan_scope` 'user_only' | 'all_messages'
          - `slug` 'email' | 'phone' | 'ssn' | 'credit-card' | 'ip-address' | 'secrets' | 'person-name' | 'address' | 'regex-prompt-injection', required
        - `content_filter_patterns` string[], nullable
        - `content_filters` object[], nullable
          - `action` 'redact' | 'block' | 'flag', required
          - `label` string, nullable
          - `pattern` string, required
        - `enable_model_armor_injection_protection` boolean, nullable
        - `lakera_injection_protection_mode` 'block' | 'flag' | 'null', nullable
        - `model_armor_injection_confidence_level` 'low' | 'medium' | 'high'
        - `model_armor_injection_protection_mode` 'block' | 'flag' | 'null', nullable
        - `pii_filters` object[], nullable
          - `action` 'redact' | 'block' | 'flag', required
          - `entity_type` string, required
          - `score_threshold` number
        - `platform_image_moderated_providers` string[], nullable
        - `platform_moderated_providers` string[], nullable
      - `created_at` string, required
      - `id` string, uuid, required: Policy ID
      - `is_default` boolean, required
      - `is_synced` boolean, required: Kept in sync with a v1 guardrail; saving changes creates an account copy
      - `is_workspace_default_synced` boolean, required: Synced from a v1 workspace default guardrail
      - `name` string, required: Policy name
      - `opted_out_workspace_ids` string[], required
      - `policy_type` 'moderation', required
      - `updated_at` string, nullable, required
      - `workspace_count` integer, required
      - `workspace_ids` string[], required
    - ModelAvailabilityAccountGuardrailPolicy
      - `config` GuardrailModelAvailabilityPolicyConfig, required
        - `allow_provisional_providers` boolean, nullable
        - `allow_safety_retention_google` boolean, nullable
        - `allow_safety_retention_openai` boolean, nullable
        - `allow_safety_retention_other` boolean, nullable
        - `allowed_data_regions` string[], nullable
        - `allowed_models` string[], nullable
        - `allowed_providers` string[], nullable
        - `enable_free_model_publication` boolean, nullable
        - `enable_free_model_training` boolean, nullable
        - `enable_paid_model_training` boolean, nullable
        - `enforce_first_party_harness_models` boolean, nullable
        - `enforce_zdr` boolean, nullable
        - `enforce_zdr_anthropic` boolean, nullable
        - `enforce_zdr_google` boolean, nullable
        - `enforce_zdr_openai` boolean, nullable
        - `enforce_zdr_other` boolean, nullable
        - `enforce_zdr_xai` boolean, nullable
        - `ignored_models` string[], nullable
        - `ignored_providers` string[], nullable
        - `platform_banned_authors` string[], nullable
        - `platform_banned_models` string[], nullable
        - `platform_banned_providers` string[], nullable
        - `require_eu_data_region` boolean, nullable
      - `created_at` string, required
      - `id` string, uuid, required: Policy ID
      - `is_default` boolean, required
      - `is_synced` boolean, required: Kept in sync with a v1 guardrail; saving changes creates an account copy
      - `is_workspace_default_synced` boolean, required: Synced from a v1 workspace default guardrail
      - `name` string, required: Policy name
      - `opted_out_workspace_ids` string[], required
      - `policy_type` 'model_availability', required
      - `updated_at` string, nullable, required
      - `workspace_count` integer, required
      - `workspace_ids` string[], required

## Other responses

- `400`: Bad Request - Invalid request parameters or malformed input
- `401`: Unauthorized - Authentication required or invalid credentials
- `403`: Forbidden - Authentication successful but insufficient permissions
- `404`: Not Found - Resource does not exist
- `409`: Conflict - Resource conflict or concurrent modification
- `500`: Internal Server Error - Unexpected server error

## Changes

- **2026-11-24** `3fc38b061734`: 2 info
  - added the new optional request property `oneOf[#/components/schemas/ModelAvailabilityAccountGuardrailPolicyRequest]/config/allow_safety_retention_openai`
  - added the optional property `data/oneOf[#/components/schemas/ModelAvailabilityAccountGuardrailPolicy]/config/allow_safety_retention_openai` to the response with the `201` status
- **2026-11-23** `c5f9c8b37e97`: 2 info
  - added the new optional request property `oneOf[#/components/schemas/ModelAvailabilityAccountGuardrailPolicyRequest]/config/allow_provisional_providers`
  - added the optional property `data/oneOf[#/components/schemas/ModelAvailabilityAccountGuardrailPolicy]/config/allow_provisional_providers` to the response with the `201` status
- **2026-11-06** `02121928ccaf`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/openrouterteam/apis/openrouter-api/changes/guardrails/policies/account/post.md)

---

[API](https://skmtc.dev/openrouterteam/apis/openrouter-api.md) - [All operations](https://skmtc.dev/openrouterteam/apis/openrouter-api/llms.txt) - [OpenAPI document](https://skmtc.dev/openrouterteam/apis/openrouter-api/revisions/f797e38f23b4?raw)
