Technical Articles

Review Cloudmersive's technical library.

How to Enforce Custom Content Policies using Document AI in Power Automate
1/22/2026 - Brian O'Neill


Cloudmersive Document AI is here, and it’s ready to revolutionize your document processing workflows.

Document AI empowers enterprises to intelligently summarize or categorize document contents, retrieve form responses, pull data from tables, and extract fields of data from invoices, receipts, tax forms, and other standard documents.

Cloudmersive Document AI Content Policly Enforcement

The Document AI API is brand new and ready to be imported to Power Automate as a Custom Connector. From there, Document AI actions – including custom content policy enforcement – can be implemented into new and existing document processing workflows with ease.

In this article, we’ll walk through an example Power Automate flow which takes advantage of the Document AI API’s content policy enforcement capabilities to determine whether a document should move forward in the flow (or divert to some different path). We’ll use an invoice document in our example flow to provide a realistic use-case.

Uploading a Custom Document AI Connector to Power Automate

Before we get started, we’ll first address that we’re uploading the Document AI API to Power Automate as a custom connector in this case. To upload any Cloudmersive API to Power Automate as a custom connector, we’ll need to 1) upload the API specification to the power platform via JSON file or OpenAPI URL and 2) set a host endpoint and base path in the General information tab of the custom connector editor.

1_Custom Upload Options

2_Set Host and Path in General Custom

If we’re a Cloudmersive customer using a private or managed instance endpoint, we can use that endpoint as the host in our custom connector to take full advantage of our deployed infrastructure in Power Automate.

Enforcing Custom Content Policies in a Power Automate Flow

After we’ve successfully created our Document AI custom connector, we’ll begin building our custom content policy enforcement flow.

To keep things as simple as possible in this walkthrough, we’ll build an example Instant Cloud Flow with a manual file input trigger. This way, we’ll be able to easily control our input.

3_Select Instant Cloud FLow
1 - enforce content policies

We’ll begin editing our flow by first selectin the Manually trigger a flow box and configuring a File input option.

2 - add file input

Next, we’ll add a new action and navigate to the Custom runtime tab. We’ll find our custom-uploaded Document AI connector in this tab.

3 - select custom runtime

From the Document AI actions list, we’ll select the action titled Enforce Policies to a Document to allow or block it using Advanced AI. This should be the very first option available on the top left of the actions list.

4 - select policies

We’ll next configure our Enforce Policies to a Document parameters.

To begin, we’ll first pass our dynamic file content placeholder into the Body/InputFile field.

5 - pass in file content

We’ll then click Add new item in the Body/Rules field, and we’ll begin creating our custom rule.

To create a custom rule, we need to provide a Ruleid, a Ruletype, and a Ruledescription. The underlying AI will interpret our rule using the Ruledescription, so that’s the field we need to pay the closest attention to.

In this example, we’ll create a policy that checks if an invoice contains a due date. We’ll set the Ruleid to “1”, set the Ruletype posture to “ALLOW”, and enter the Ruledescription prompt as “Ensure an invoice number and date are both present”.

6 - show example rule

This rule will allow invoices only if both an invoice number and invoice date are present.

We’ll only create one rule for now, but it’s important to note that we can add as many rules as we want to the Rules array by simply clicking Add new item.

Now that we’ve successfully configured our rule, we’ll save our flow and run a test.

Since we’ve elected to run our flow manually, we’ll pass in our example document at runtime.

7 - upload example

When our flow finishes running, we’ll navigate to the raw outputs to see whether our invoice violated our content policy.

8 - flow output

As we can see above, our document returned ”CleanResult”: true with and ”RiskScore”: 0.1, which indicates the document did in fact contain the invoice number and invoice date we wanted.

In the event our invoice did NOT contain the invoice number and date we wanted, we would receive a response like the below example:

{
  "CleanResult": false,
  "RiskScore": 0.95,
  "RuleViolations": [
    {
      "RuleId": "1",
      "RuleViolationRiskScore": 0.95,
      "RuleViolationRationale": "The invoice document did not clearly show an invoice number or an invoice date, thus violating the rule."
    }
  ]
}

Implementing and enforcing a custom policy on this invoice document shows that we can easily control and validate content in our Power Automate flows on our own terms. We can only involve human intervention when documents violate some crucial aspect of our expectations.

Conclusion

In this article, we learned how to easily enforce custom content policies on a (invoice) document using the Document AI Enforce Policies to a Document to allow or block it using Advanced AI action. Our example flow run returned a clear ”CleanResult”: true response which correctly indicated our invoice contained the necessary information to proceed in our Power Automate flow.

Including Document AI in Power Automate instantly improves our ability to process and validate documents. With Document AI, we can easily prevent documents from moving forward in our workflows when they contain subtle violations of our self-determined policies.

For expert advice on using the Cloudmersive Document AI API in Power Automate, please reach out to a Cloudmersive representative.

800 free API calls/month, with no expiration

Get started now! or Sign in with Google

Questions? We'll be your guide.

Contact Sales