Content Analysis
mathieu.isabel  

Cross-Document Assertions with the Content API

A common challenge in document workflows is validating whether information found in one document is properly reflected in another. For example, confirming that a charge on a credit card statement corresponds to a booking recorded in an invoice. In this post, we’ll walk through how the Content API can be used to create a custom analysis that performs assertions across multiple documents.

Our example involves verifying a booking payment: we’ll check if a transaction on a credit card statement matches a trip booking invoice. This walkthrough includes:

  1. Creating the analysis definition to perform the assertions
  2. Uploading the credit card statement and booking invoice
  3. Running the analysis
  4. Interpreting the results

1. Create the Analysis Definition

We’ll define an analysis that checks whether the booking was indeed paid with the credit card.

Here’s an example analysisDefinition you might post to /analysis/definitions:

{
    "analysisType": "Content Assertion",
    "title": "Validate CC Paid Booking",
    "publishingStatus": "Draft",
    "assertionDefinitions": {
        "assertionMethodVersion": "v3",
        "subject": "",
        "content": "",
        "desiredAssertions": [
            {
                "assertionInstruction": "Determine if the booking was paid with the credit card.",
                "reasoning": "In order to for the claim to be eligible for settlement, it needs to have been paid with the credit card.",
                "outcomeDataType": "boolean",
                "possibleOutcomes": [],
                "provideReasoning": true,
                "provideEvidence": true,
                "assertionReasoningLevel": "advanced"
            }
        ],
        "provideProposal": false,
        "validationMethod": "self-validate"
    }
}

2. Upload the Documents

For demo purposes, we’ll be using the following documents as a reference:

Next, create and upload the booking invoice and credit card statement via the /contents and /contents/{contentId}/upload endpoints:

POST /contents
{
    "contentType": "Booking Invoice"
}
POST /contents/{contentId}/upload
file: {the booking invoice file}
filenName: booking_invoice.pdf
POST /contents
{
    "contentType": "Credit Card Statement"
}
POST /contents/{contentId}/upload
file: {the credit card statement file}
filenName: credit_card_statement.pdf

3. Run the Analysis

With the definition and documents in place, call the /contents/analysis/process endpoint:

POST /contents/analysis/process?mode=refresh&definition-id={{booking_payment_analysis_definition_id}}&content-ids={{bi_tc2_content_id}},{{cc_tc2_content_id}}

This will trigger the assertion logic against the two documents.

4. Interpret the Results

Once the analysis is complete, the API returns a structured response that includes a summary, specific assertion outcomes, and supporting evidence. Here’s how to read it:

✅ Key Assertion: Was the Booking Paid with the Credit Card?

The analysis tackled one main question: Did the credit card statement confirm payment for the booking? This is represented by the assertion:

{
  "assertionInstruction": "Determine if the booking was paid with the credit card.",
  "outcome": true,
  ...
}

Outcome: true — This means the assertion was successful. The Content API determined that the credit card statement does support the claim that the booking was paid using the card.

Reasoning: The API provides natural-language reasoning that explains why the outcome was true. In this case, it found:

  • A matching transaction from Air Canada
  • The same amount as the flight in the booking invoice
  • A date match with the invoice issue date
  • The same payment method (“Mastercard ending in 1234”)

🔍 Evidence

The evidence array pinpoints exactly where the system found the matching details:

{
  "extract": "Payment Method: Mastercard ending in 1234",
  "source": "Booking Invoice",
  "relevanceLevel": "direct"
}
{
  "extract": "March 5, 2025 - Air Canada - Flight 5678 (Quebec to Paris) - CAD $850.00",
  "source": "Transaction Details",
  "relevanceLevel": "direct"
}

This shows that the assertion was based on direct evidence, making the conclusion trustworthy and explainable.

📝 Summary Highlights

The analysis also includes a natural-language summary:

Positive Aspects:

  1. Clear Evidence of Payment
  2. Date Consistency
  3. Matching Payment Method

These bullet points summarize why the assertion passed, making it easy for business users or auditors to understand the conclusion.


This kind of response structure is especially valuable in semi-automated workflows, like reviewing travel claims or verifying reimbursement requests. By providing not just a “yes/no” result, but traceable reasoning and evidence, the Content API enables transparency, trust, and explainability in document validation.

Here’s the complete response from the analysis:

{
    "id": "a1b9868b-cb21-40e3-ae5c-f812ec528d64",
    "contentReferences": [
        {
            "id": "926e4e0f-98d9-43fd-88a0-ee43accea94f",
            "contentType": "",
            "structureType": "full-text"
        },
        {
            "id": "2c98a1cd-8276-426e-aef2-5061edd51d54",
            "contentType": "",
            "structureType": "full-text"
        }
    ],
    "definitionId": "5f434581-da50-4ab0-a4d5-d2588c1007aa",
    "definitionVersionId": "1b411f8d-3098-4eeb-935f-fd74236bf445",
    "analysisType": "Content Assertion",
    "title": "",
    "objective": "",
    "positivityRatio": 0,
    "summaries": [
        {
            "languageCode": "en_us",
            "value": "### Summary of Analysis Assertions\n\n**Positive Aspects:**\n1. **Clear Evidence of Payment:** The analysis provides strong evidence that the booking was paid using a credit card, as indicated by the transaction details in the statement. This includes a specific charge from Air Canada that matches the flight amount.\n2. **Date Consistency:** The transaction date aligns with the invoice issue date, reinforcing the validity of the payment claim.\n3. **Matching Payment Method:** The payment method details in the booking invoice correspond with the transaction details, further supporting the assertion.\n\n**Aspects for Improvement:**\n1. **Additional Documentation:** While the transaction details are compelling, including additional documentation (e.g., a screenshot of the transaction or a confirmation email) could strengthen the assertion.\n2. **Clarification of Terms:** Providing clearer definitions or explanations of terms used (e.g., \"invoice issue date\") could enhance understanding for all stakeholders involved.\n3. **Broader Context:** Including context about the booking process or any potential discrepancies that could arise in similar situations may help in preemptively addressing concerns or questions."
        }
    ],
    "assertionResults": [
        {
            "assertionInstruction": "Determine if the booking was paid with the credit card.",
            "outcome": true,
            "reasoning": "The booking was paid with the credit card as evidenced by the transaction details in the statement, which show a charge from Air Canada for the exact amount of the flight on the same date as the invoice issue date. This matches the payment method details in the booking invoice.",
            "proposal": "",
            "evidence": [
                {
                    "extract": "Payment Method: Mastercard ending in 1234",
                    "source": "Booking Invoice",
                    "relevance": "This indicates the credit card used for the booking payment.",
                    "relevanceLevel": "direct"
                },
                {
                    "extract": "March 5, 2025 - Air Canada - Flight 5678 (Quebec to Paris) - CAD $850.00",
                    "source": "Transaction Details",
                    "relevance": "This transaction matches the flight booking amount and date, confirming the payment was made with the credit card.",
                    "relevanceLevel": "direct"
                }
            ]
        }
    ],
    "branch": {
        "id": "redacted"
    },
    "version": {
        "id": "redacted",
        "createdDateTime": "2025-04-03 16:59:49"
    }
}

Conclusion

Cross-document assertions are an essential part of many verification and compliance workflows—from validating reimbursements to auditing financial records. With the Content API, you can define custom logic that ties together information from multiple sources and generates explainable, evidence-backed conclusions.

In this post, we demonstrated how to verify that a credit card transaction matches a booking invoice using a structured analysis definition. The Content API not only checks for field-level consistency, but also provides human-readable reasoning and highlights the exact evidence it used to make its decision.

Whether you’re building an automated claim review system, reconciling payment data, or creating a document integrity checker, the Content API gives you a powerful and flexible way to perform document-level assertions at scale.

👉 Ready to try it yourself?
Check out the Content API Documentation to start building your own analysis definitions and assertions.

Leave A Comment