Internal names, providers, and exact numbers have been abstracted or generalized for confidentiality — the architecture patterns and trade-offs described are accurate.
Context
Brazilian B2B credit operations historically run on paperwork: regulatory certificates, financial statements, party documentation, judicial records. Each one comes from a different government office or registry, often as PDFs or XML files, and is reconciled manually by operations teams across multiple providers and systems.
The digital credit pipeline replaces that funnel with a structured, instrumented onboarding flow. Buyers and sellers participating in a credit operation enter through the same surface; documents arrive automatically from regulatory APIs rather than being collected by hand; due diligence runs as workflow steps instead of offline tickets.
The pipeline forms the foundation of customer acquisition for the credit product — every new operation flows through it.
The flow has two-sided demand:
- Buyers seeking credit have requirements about their counterparties.
- Sellers participating in operations need verification of their own standing.
A single funnel handles both perspectives without duplicating logic.
Architecture
Onboarding ──► Document collection ──► Document parsing ──► Due diligence ──► Decision
│ │ │ │
▼ ▼ ▼ ▼
Multi-tenant Document AI-integrated Risk + background
admin (Cognito Purchasing API XML processing checks (incl. real
+ granular RBAC) (case #1) estate workflows)
Onboarding
Buyers and sellers enter through a multi-tenant admin backend. Permissions are scoped via granular RBAC on top of AWS Cognito, so different operator roles see different parts of the journey without parallel surfaces.
Document collection
Once parties are identified by CPF/CNPJ, the pipeline triggers automated regulatory document fetches via the Document Purchasing API. What used to be manual chasing through government and registry APIs becomes a single async batch with webhook callbacks.
Document parsing
Many regulatory documents come back as XML with non-trivial structure and inconsistent schemas. An AI-integrated parsing layer extracts and normalizes the relevant fields, replacing what previously required a human reading every page. The AI step sits behind a deterministic schema validator — the model proposes structured data, the validator accepts only well-formed output.
Due diligence
Risk and background checks run as workflow steps tied to the pipeline state. Each step has explicit success/failure semantics so operations can intervene at any stage without losing context. For specific transaction types like real estate, the workflow includes property-side and counterparty verifications.
Decision
Once due diligence completes, the pipeline produces a clean, complete, traceable case as input for credit decisioning. The decision itself is downstream — the pipeline's job is to deliver structured, validated facts for that decision to land on.
Trade-offs
One funnel for buyers and sellers, not two. Building a unified flow added upfront design cost: every stage has to handle both party perspectives. In return, both sides of a credit operation live in the same record, which simplifies everything downstream — risk, decisioning, contracts, ops dashboards.
AI parsing behind a deterministic validator, not freeform. The validator rejects malformed model output, which means some regulatory documents still fall back to manual review. The benefit is that wrong-but-confident model outputs never reach downstream steps — the pipeline either has a structured fact or it admits it doesn't.
Workflow steps with explicit state, not a procedural script. Modeling each stage with explicit success/failure semantics is heavier to build than chaining function calls. The benefit is that every party's journey is inspectable at any moment, ops can replay or intervene at specific stages, and new stages slot in without rewriting upstream code.
Outcome
- Funnel. What used to be email + spreadsheet + ticket coordination became a single structured journey that operations can monitor end-to-end.
- Document handling. Regulatory paperwork that previously required manual reading is now machine-extracted, schema-validated, and stored in a structured form.
- Two-sided coverage. Buyers and sellers in a credit operation share one canonical record across the pipeline.
- Foundation. The pipeline became the entry point for the broader credit product — every new operation flows through it, which makes it the right place to instrument, audit, and improve customer acquisition.