---
title: "POST /guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply"
method: POST
path: "/guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply"
---

# POST /guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply

`POST /guardrail/{guardrailIdentifier}/version/{guardrailVersion}/apply`

The action to apply a guardrail.

For troubleshooting some of the common errors you might encounter when using the `ApplyGuardrail` API, see [Troubleshooting Amazon Bedrock API Error Codes](https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html) in the Amazon Bedrock User Guide

## Path parameters

- `guardrailIdentifier` string, required
- `guardrailVersion` string, required

## Request body

- object
  - `source` 'INPUT' | 'OUTPUT', required — The source of data used in the request to apply the guardrail.
  - `content` GuardrailContentBlock[], required — The content details used in the request to apply the guardrail.
    - `text` object — Text within content block to be evaluated by the guardrail.
      - `text` string, required — The input text details to be evaluated by the guardrail.
      - `qualifiers` GuardrailContentQualifier[] — The qualifiers describing the text block.
    - `image` object — Image within guardrail content block to be evaluated by the guardrail.
      - `format` 'png' | 'jpeg', required — The format details for the file type of the image blocked by the guardrail.
      - `source` object, required — The image source (image bytes) details of the image blocked by the guardrail.
        - `bytes` string — The bytes details of the guardrail image source. Object used in independent api.
  - `outputScope` 'INTERVENTIONS' | 'FULL' — <p>Specifies the scope of the output that you get in the response. Set to <code>FULL</code> to return the entire output, including any detected and non-detected entries in the response for enhanced debugging.</p> <p>Note that the full output scope doesn't apply to word filters or regex in sensitive information filters. It does apply to all other filtering policies, including sensitive information with filters that can detect personally identifiable information (PII).</p>

## Response `200`

Success

- ApplyGuardrailResponse
  - `usage` object, required — The usage details in the response from the guardrail.
    - `topicPolicyUnits` integer, required — The topic policy units processed by the guardrail.
    - `contentPolicyUnits` integer, required — The content policy units processed by the guardrail.
    - `wordPolicyUnits` integer, required — The word policy units processed by the guardrail.
    - `sensitiveInformationPolicyUnits` integer, required — The sensitive information policy units processed by the guardrail.
    - `sensitiveInformationPolicyFreeUnits` integer, required — The sensitive information policy free units processed by the guardrail.
    - `contextualGroundingPolicyUnits` integer, required — The contextual grounding policy units processed by the guardrail.
    - `contentPolicyImageUnits` integer — The content policy image units processed by the guardrail.
    - `automatedReasoningPolicyUnits` integer — The number of text units processed by the automated reasoning policy.
    - `automatedReasoningPolicies` integer — The number of automated reasoning policies that were processed during the guardrail evaluation.
  - `action` 'NONE' | 'GUARDRAIL_INTERVENED', required — The action taken in the response from the guardrail.
  - `actionReason` string — The reason for the action taken when harmful content is detected.
  - `outputs` GuardrailOutputContent[], required — The output details in the response from the guardrail.
    - `text` string — The specific text for the output content produced by the guardrail.
  - `assessments` GuardrailAssessment[], required — The assessment details in the response from the guardrail.
    - `topicPolicy` object — The topic policy.
      - `topics` GuardrailTopic[], required — The topics in the assessment.
        - `name` string, required — The name for the guardrail.
        - `type` 'DENY', required — The type behavior that the guardrail should perform when the model detects the topic.
        - `action` 'BLOCKED' | 'NONE', required — The action the guardrail should take when it intervenes on a topic.
        - `detected` boolean — Indicates whether topic content that breaches the guardrail configuration is detected.
    - `contentPolicy` object — The content policy.
      - `filters` GuardrailContentFilter[], required — The content policy filters.
        - `type` 'INSULTS' | 'HATE' | 'SEXUAL' | 'VIOLENCE' | 'MISCONDUCT' | 'PROMPT_ATTACK', required — The guardrail type.
        - `confidence` 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH', required — The guardrail confidence.
        - `filterStrength` 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' — The filter strength setting for the guardrail content filter.
        - `action` 'BLOCKED' | 'NONE', required — The guardrail action.
        - `detected` boolean — Indicates whether content that breaches the guardrail configuration is detected.
    - `wordPolicy` object — The word policy.
      - `customWords` GuardrailCustomWord[], required — Custom words in the assessment.
        - `match` string, required — The match for the custom word.
        - `action` 'BLOCKED' | 'NONE', required — The action for the custom word.
        - `detected` boolean — Indicates whether custom word content that breaches the guardrail configuration is detected.
      - `managedWordLists` GuardrailManagedWord[], required — Managed word lists in the assessment.
        - `match` string, required — The match for the managed word.
        - `type` 'PROFANITY', required — The type for the managed word.
        - `action` 'BLOCKED' | 'NONE', required — The action for the managed word.
        - `detected` boolean — Indicates whether managed word content that breaches the guardrail configuration is detected.
    - `sensitiveInformationPolicy` object — The sensitive information policy.
      - `piiEntities` GuardrailPiiEntityFilter[], required — The PII entities in the assessment.
        - `match` string, required — The PII entity filter match.
        - `type` 'ADDRESS' | 'AGE' | 'AWS_ACCESS_KEY' | 'AWS_SECRET_KEY' | 'CA_HEALTH_NUMBER' | 'CA_SOCIAL_INSURANCE_NUMBER' | 'CREDIT_DEBIT_CARD_CVV' | 'CREDIT_DEBIT_CARD_EXPIRY' | 'CREDIT_DEBIT_CARD_NUMBER' | 'DRIVER_ID' | 'EMAIL' | 'INTERNATIONAL_BANK_ACCOUNT_NUMBER' | 'IP_ADDRESS' | 'LICENSE_PLATE' | 'MAC_ADDRESS' | 'NAME' | 'PASSWORD' | 'PHONE' | 'PIN' | 'SWIFT_CODE' | 'UK_NATIONAL_HEALTH_SERVICE_NUMBER' | 'UK_NATIONAL_INSURANCE_NUMBER' | 'UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER' | 'URL' | 'USERNAME' | 'US_BANK_ACCOUNT_NUMBER' | 'US_BANK_ROUTING_NUMBER' | 'US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER' | 'US_PASSPORT_NUMBER' | 'US_SOCIAL_SECURITY_NUMBER' | 'VEHICLE_IDENTIFICATION_NUMBER', required — The PII entity filter type.
        - `action` 'ANONYMIZED' | 'BLOCKED' | 'NONE', required — The PII entity filter action.
        - `detected` boolean — Indicates whether personally identifiable information (PII) that breaches the guardrail configuration is detected.
      - `regexes` GuardrailRegexFilter[], required — The regex queries in the assessment.
        - `name` string — The regex filter name.
        - `match` string — The regesx filter match.
        - `regex` string — The regex query.
        - `action` 'ANONYMIZED' | 'BLOCKED' | 'NONE', required — The region filter action.
        - `detected` boolean — Indicates whether custom regex entities that breach the guardrail configuration are detected.
    - `contextualGroundingPolicy` object — The contextual grounding policy used for the guardrail assessment.
      - `filters` GuardrailContextualGroundingFilter[] — The filter details for the guardrails contextual grounding filter.
        - `type` 'GROUNDING' | 'RELEVANCE', required — The contextual grounding filter type.
        - `threshold` number, double, required — The threshold used by contextual grounding filter to determine whether the content is grounded or not.
        - `score` number, double, required — The score generated by contextual grounding filter.
        - `action` 'BLOCKED' | 'NONE', required — The action performed by the guardrails contextual grounding filter.
        - `detected` boolean — Indicates whether content that fails the contextual grounding evaluation (grounding or relevance score less than the corresponding threshold) was detected.
    - `automatedReasoningPolicy` object — The automated reasoning policy assessment results, including logical validation findings for the input content.
      - `findings` GuardrailAutomatedReasoningFinding[] — List of logical validation results produced by evaluating the input content against automated reasoning policies.
        - `valid` object — Contains the result when the automated reasoning evaluation determines that the claims in the input are logically valid and definitively true based on the provided premises and policy rules.
          - `translation` object — The logical translation of the input that this finding validates.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as the foundation or assumptions for the claims.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are being validated against the premises and policy rules.
              - …
            - `untranslatedPremises` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the premises but could not be fully translated.
              - …
            - `untranslatedClaims` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the claims but could not be fully translated.
              - …
            - `confidence` number, double — A confidence score between 0 and 1 indicating how certain the system is about the logical translation.
          - `claimsTrueScenario` object — An example scenario demonstrating how the claims are logically true.
            - `statements` GuardrailAutomatedReasoningStatement[] — List of logical assignments and statements that define this scenario.
              - …
          - `supportingRules` GuardrailAutomatedReasoningRule[] — The automated reasoning policy rules that support why this result is considered valid.
            - `identifier` string — The unique identifier of the automated reasoning rule.
            - `policyVersionArn` string — The ARN of the automated reasoning policy version that contains this rule.
          - `logicWarning` object — Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules.
            - `type` 'ALWAYS_FALSE' | 'ALWAYS_TRUE' — The category of the detected logical issue, such as statements that are always true or always false.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as premises under which the claims are validated.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are validated while assuming the policy and premises.
              - …
        - `invalid` object — Contains the result when the automated reasoning evaluation determines that the claims in the input are logically invalid and contradict the established premises or policy rules.
          - `translation` object — The logical translation of the input that this finding invalidates.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as the foundation or assumptions for the claims.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are being validated against the premises and policy rules.
              - …
            - `untranslatedPremises` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the premises but could not be fully translated.
              - …
            - `untranslatedClaims` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the claims but could not be fully translated.
              - …
            - `confidence` number, double — A confidence score between 0 and 1 indicating how certain the system is about the logical translation.
          - `contradictingRules` GuardrailAutomatedReasoningRule[] — The automated reasoning policy rules that contradict the claims in the input.
            - `identifier` string — The unique identifier of the automated reasoning rule.
            - `policyVersionArn` string — The ARN of the automated reasoning policy version that contains this rule.
          - `logicWarning` object — Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules.
            - `type` 'ALWAYS_FALSE' | 'ALWAYS_TRUE' — The category of the detected logical issue, such as statements that are always true or always false.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as premises under which the claims are validated.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are validated while assuming the policy and premises.
              - …
        - `satisfiable` object — Contains the result when the automated reasoning evaluation determines that the claims in the input could be either true or false depending on additional assumptions not provided in the input context.
          - `translation` object — The logical translation of the input that this finding evaluates.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as the foundation or assumptions for the claims.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are being validated against the premises and policy rules.
              - …
            - `untranslatedPremises` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the premises but could not be fully translated.
              - …
            - `untranslatedClaims` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the claims but could not be fully translated.
              - …
            - `confidence` number, double — A confidence score between 0 and 1 indicating how certain the system is about the logical translation.
          - `claimsTrueScenario` object — An example scenario demonstrating how the claims could be logically true.
            - `statements` GuardrailAutomatedReasoningStatement[] — List of logical assignments and statements that define this scenario.
              - …
          - `claimsFalseScenario` object — An example scenario demonstrating how the claims could be logically false.
            - `statements` GuardrailAutomatedReasoningStatement[] — List of logical assignments and statements that define this scenario.
              - …
          - `logicWarning` object — Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules.
            - `type` 'ALWAYS_FALSE' | 'ALWAYS_TRUE' — The category of the detected logical issue, such as statements that are always true or always false.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as premises under which the claims are validated.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are validated while assuming the policy and premises.
              - …
        - `impossible` object — Contains the result when the automated reasoning evaluation determines that no valid logical conclusions can be drawn due to contradictions in the premises or policy rules themselves.
          - `translation` object — The logical translation of the input that this finding evaluates.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as the foundation or assumptions for the claims.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are being validated against the premises and policy rules.
              - …
            - `untranslatedPremises` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the premises but could not be fully translated.
              - …
            - `untranslatedClaims` GuardrailAutomatedReasoningInputTextReference[] — References to portions of the original input text that correspond to the claims but could not be fully translated.
              - …
            - `confidence` number, double — A confidence score between 0 and 1 indicating how certain the system is about the logical translation.
          - `contradictingRules` GuardrailAutomatedReasoningRule[] — The automated reasoning policy rules that contradict the claims and/or premises in the input.
            - `identifier` string — The unique identifier of the automated reasoning rule.
            - `policyVersionArn` string — The ARN of the automated reasoning policy version that contains this rule.
          - `logicWarning` object — Indication of a logic issue with the translation without needing to consider the automated reasoning policy rules.
            - `type` 'ALWAYS_FALSE' | 'ALWAYS_TRUE' — The category of the detected logical issue, such as statements that are always true or always false.
            - `premises` GuardrailAutomatedReasoningStatement[] — The logical statements that serve as premises under which the claims are validated.
              - …
            - `claims` GuardrailAutomatedReasoningStatement[] — The logical statements that are validated while assuming the policy and premises.
              - …
        - `translationAmbiguous` object — Contains the result when the automated reasoning evaluation detects that the input has multiple valid logical interpretations, requiring additional context or clarification to proceed with validation.
          - `options` GuardrailAutomatedReasoningTranslationOption[] — Different logical interpretations that were detected during translation of the input.
            - `translations` GuardrailAutomatedReasoningTranslation[] — Example translations that provide this possible interpretation of the input.
              - …
          - `differenceScenarios` GuardrailAutomatedReasoningScenario[] — Scenarios showing how the different translation options differ in meaning.
            - `statements` GuardrailAutomatedReasoningStatement[] — List of logical assignments and statements that define this scenario.
              - …
        - `tooComplex` object — Contains the result when the automated reasoning evaluation cannot process the input due to its complexity or volume exceeding the system's processing capacity for logical analysis.
        - `noTranslations` object — Contains the result when the automated reasoning evaluation cannot extract any relevant logical information from the input that can be validated against the policy rules.
    - `invocationMetrics` object — The invocation metrics for the guardrail assessment.
      - `guardrailProcessingLatency` integer — The processing latency details for the guardrail invocation metrics.
      - `usage` object — The usage details for the guardrail invocation metrics.
        - `topicPolicyUnits` integer, required — The topic policy units processed by the guardrail.
        - `contentPolicyUnits` integer, required — The content policy units processed by the guardrail.
        - `wordPolicyUnits` integer, required — The word policy units processed by the guardrail.
        - `sensitiveInformationPolicyUnits` integer, required — The sensitive information policy units processed by the guardrail.
        - `sensitiveInformationPolicyFreeUnits` integer, required — The sensitive information policy free units processed by the guardrail.
        - `contextualGroundingPolicyUnits` integer, required — The contextual grounding policy units processed by the guardrail.
        - `contentPolicyImageUnits` integer — The content policy image units processed by the guardrail.
        - `automatedReasoningPolicyUnits` integer — The number of text units processed by the automated reasoning policy.
        - `automatedReasoningPolicies` integer — The number of automated reasoning policies that were processed during the guardrail evaluation.
      - `guardrailCoverage` object — The coverage details for the guardrail invocation metrics.
        - `textCharacters` object — The text characters of the guardrail coverage details.
          - `guarded` integer — The text characters that were guarded by the guardrail coverage.
          - `total` integer — The total text characters by the guardrail coverage.
        - `images` object — The guardrail coverage for images (the number of images that guardrails guarded).
          - `guarded` integer — The count (integer) of images guardrails guarded.
          - `total` integer — Represents the total number of images (integer) that were in the request (guarded and unguarded).
    - `appliedGuardrailDetails` AppliedGuardrailDetails — Details about the specific guardrail that was applied during this assessment, including its identifier, version, ARN, origin, and ownership information.
      - `guardrailId` string — The unique ID of the guardrail that was applied.
      - `guardrailVersion` string — The version of the guardrail that was applied.
      - `guardrailArn` string — The ARN of the guardrail that was applied.
      - `guardrailOrigin` GuardrailOrigin[] — The origin of how the guardrail was applied. This can be either requested at the API level or enforced at the account or organization level as a default guardrail.
      - `guardrailOwnership` 'SELF' | 'CROSS_ACCOUNT' — The ownership type of the guardrail, indicating whether it is owned by the requesting account or is a cross-account guardrail shared from another AWS account.
  - `guardrailCoverage` object — The guardrail coverage details in the apply guardrail response.
    - `textCharacters` object — The text characters of the guardrail coverage details.
      - `guarded` integer — The text characters that were guarded by the guardrail coverage.
      - `total` integer — The total text characters by the guardrail coverage.
    - `images` object — The guardrail coverage for images (the number of images that guardrails guarded).
      - `guarded` integer — The count (integer) of images guardrails guarded.
      - `total` integer — Represents the total number of images (integer) that were in the request (guarded and unguarded).

## Other responses

- `480` — AccessDeniedException
- `481` — ResourceNotFoundException
- `482` — ThrottlingException
- `483` — InternalServerException
- `484` — ServiceUnavailableException
- `485` — ValidationException
- `486` — ServiceQuotaExceededException

---

[API](https://skmtc.net/aws/apis/bedrock-runtime.md) · [All operations](https://skmtc.net/aws/apis/bedrock-runtime/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/bedrock-runtime/revisions/8a393198b636/schema)
